1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/x64/Bailouts-x64.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "jit/Bailouts.h" 1.11 + 1.12 +using namespace js; 1.13 +using namespace js::jit; 1.14 + 1.15 +#if defined(_WIN32) 1.16 +# pragma pack(push, 1) 1.17 +#endif 1.18 + 1.19 +namespace js { 1.20 +namespace jit { 1.21 + 1.22 +class BailoutStack 1.23 +{ 1.24 + mozilla::Array<double, FloatRegisters::Total> fpregs_; 1.25 + mozilla::Array<uintptr_t, Registers::Total> regs_; 1.26 + uintptr_t frameSize_; 1.27 + uintptr_t snapshotOffset_; 1.28 + 1.29 + public: 1.30 + MachineState machineState() { 1.31 + return MachineState::FromBailout(regs_, fpregs_); 1.32 + } 1.33 + uint32_t snapshotOffset() const { 1.34 + return snapshotOffset_; 1.35 + } 1.36 + uint32_t frameSize() const { 1.37 + return frameSize_; 1.38 + } 1.39 + uint8_t *parentStackPointer() { 1.40 + return (uint8_t *)this + sizeof(BailoutStack); 1.41 + } 1.42 +}; 1.43 + 1.44 +} // namespace jit 1.45 +} // namespace js 1.46 + 1.47 +#if defined(_WIN32) 1.48 +# pragma pack(pop) 1.49 +#endif 1.50 + 1.51 +IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, 1.52 + BailoutStack *bailout) 1.53 + : JitFrameIterator(activations), 1.54 + machine_(bailout->machineState()) 1.55 +{ 1.56 + uint8_t *sp = bailout->parentStackPointer(); 1.57 + uint8_t *fp = sp + bailout->frameSize(); 1.58 + 1.59 + current_ = fp; 1.60 + type_ = JitFrame_IonJS; 1.61 + topFrameSize_ = current_ - sp; 1.62 + topIonScript_ = script()->ionScript(); 1.63 + snapshotOffset_ = bailout->snapshotOffset(); 1.64 +} 1.65 + 1.66 +IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, 1.67 + InvalidationBailoutStack *bailout) 1.68 + : JitFrameIterator(activations), 1.69 + machine_(bailout->machine()) 1.70 +{ 1.71 + returnAddressToFp_ = bailout->osiPointReturnAddress(); 1.72 + topIonScript_ = bailout->ionScript(); 1.73 + const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_); 1.74 + 1.75 + current_ = (uint8_t*) bailout->fp(); 1.76 + type_ = JitFrame_IonJS; 1.77 + topFrameSize_ = current_ - bailout->sp(); 1.78 + snapshotOffset_ = osiIndex->snapshotOffset(); 1.79 +}