js/src/jit/mips/Bailouts-mips.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "jit/mips/Bailouts-mips.h"
michael@0 8
michael@0 9 #include "jscntxt.h"
michael@0 10 #include "jscompartment.h"
michael@0 11
michael@0 12 using namespace js;
michael@0 13 using namespace js::jit;
michael@0 14
michael@0 15 IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
michael@0 16 BailoutStack *bailout)
michael@0 17 : IonFrameIterator(activations),
michael@0 18 machine_(bailout->machine())
michael@0 19 {
michael@0 20 uint8_t *sp = bailout->parentStackPointer();
michael@0 21 uint8_t *fp = sp + bailout->frameSize();
michael@0 22
michael@0 23 current_ = fp;
michael@0 24 type_ = JitFrame_IonJS;
michael@0 25 topFrameSize_ = current_ - sp;
michael@0 26 topIonScript_ = script()->ionScript();
michael@0 27
michael@0 28 if (bailout->frameClass() == FrameSizeClass::None()) {
michael@0 29 snapshotOffset_ = bailout->snapshotOffset();
michael@0 30 return;
michael@0 31 }
michael@0 32
michael@0 33 // Compute the snapshot offset from the bailout ID.
michael@0 34 JitActivation *activation = activations.activation()->asJit();
michael@0 35 JSRuntime *rt = activation->compartment()->runtimeFromMainThread();
michael@0 36 JitCode *code = rt->jitRuntime()->getBailoutTable(bailout->frameClass());
michael@0 37 uintptr_t tableOffset = bailout->tableOffset();
michael@0 38 uintptr_t tableStart = reinterpret_cast<uintptr_t>(code->raw());
michael@0 39
michael@0 40 MOZ_ASSERT(tableOffset >= tableStart &&
michael@0 41 tableOffset < tableStart + code->instructionsSize());
michael@0 42 MOZ_ASSERT((tableOffset - tableStart) % BAILOUT_TABLE_ENTRY_SIZE == 0);
michael@0 43
michael@0 44 uint32_t bailoutId = ((tableOffset - tableStart) / BAILOUT_TABLE_ENTRY_SIZE) - 1;
michael@0 45 MOZ_ASSERT(bailoutId < BAILOUT_TABLE_SIZE);
michael@0 46
michael@0 47 snapshotOffset_ = topIonScript_->bailoutToSnapshot(bailoutId);
michael@0 48 }
michael@0 49
michael@0 50 IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
michael@0 51 InvalidationBailoutStack *bailout)
michael@0 52 : IonFrameIterator(activations),
michael@0 53 machine_(bailout->machine())
michael@0 54 {
michael@0 55 returnAddressToFp_ = bailout->osiPointReturnAddress();
michael@0 56 topIonScript_ = bailout->ionScript();
michael@0 57 const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_);
michael@0 58
michael@0 59 current_ = (uint8_t*) bailout->fp();
michael@0 60 type_ = JitFrame_IonJS;
michael@0 61 topFrameSize_ = current_ - bailout->sp();
michael@0 62 snapshotOffset_ = osiIndex->snapshotOffset();
michael@0 63 }

mercurial