| OLD | NEW |
| (Empty) |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | |
| 2 // Redistribution and use in source and binary forms, with or without | |
| 3 // modification, are permitted provided that the following conditions are | |
| 4 // met: | |
| 5 // | |
| 6 // * Redistributions of source code must retain the above copyright | |
| 7 // notice, this list of conditions and the following disclaimer. | |
| 8 // * Redistributions in binary form must reproduce the above | |
| 9 // copyright notice, this list of conditions and the following | |
| 10 // disclaimer in the documentation and/or other materials provided | |
| 11 // with the distribution. | |
| 12 // * Neither the name of Google Inc. nor the names of its | |
| 13 // contributors may be used to endorse or promote products derived | |
| 14 // from this software without specific prior written permission. | |
| 15 // | |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | |
| 28 #ifndef V8_VIRTUAL_FRAME_IA32_INL_H_ | |
| 29 #define V8_VIRTUAL_FRAME_IA32_INL_H_ | |
| 30 | |
| 31 namespace v8 { namespace internal { | |
| 32 | |
| 33 | |
| 34 // ------------------------------------------------------------------------- | |
| 35 // VirtualFrame inline functions. | |
| 36 | |
| 37 #define __ masm_-> | |
| 38 | |
| 39 void VirtualFrame::PushTryHandler(HandlerType type) { | |
| 40 // Grow the expression stack by handler size less two (the return address | |
| 41 // is already pushed by a call instruction, and PushTryHandler from the | |
| 42 // macro assembler will leave the top of stack in the eax register to be | |
| 43 // pushed separately). | |
| 44 height_ += (kHandlerSize - 2); | |
| 45 __ PushTryHandler(IN_JAVASCRIPT, type); | |
| 46 // TODO(1222589): remove the reliance of PushTryHandler on a cached TOS | |
| 47 Push(eax); | |
| 48 } | |
| 49 | |
| 50 | |
| 51 void VirtualFrame::CallStub(CodeStub* stub, int frame_arg_count) { | |
| 52 ASSERT(frame_arg_count >= 0); | |
| 53 ASSERT(height_ >= frame_arg_count); | |
| 54 height_ -= frame_arg_count; | |
| 55 __ CallStub(stub); | |
| 56 } | |
| 57 | |
| 58 | |
| 59 void VirtualFrame::CallRuntime(Runtime::Function* f, int frame_arg_count) { | |
| 60 ASSERT(frame_arg_count >= 0); | |
| 61 ASSERT(height_ >= frame_arg_count); | |
| 62 height_ -= frame_arg_count; | |
| 63 __ CallRuntime(f, frame_arg_count); | |
| 64 } | |
| 65 | |
| 66 | |
| 67 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int frame_arg_count) { | |
| 68 ASSERT(frame_arg_count >= 0); | |
| 69 ASSERT(height_ >= frame_arg_count); | |
| 70 height_ -= frame_arg_count; | |
| 71 __ CallRuntime(id, frame_arg_count); | |
| 72 } | |
| 73 | |
| 74 | |
| 75 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, | |
| 76 InvokeFlag flag, | |
| 77 int frame_arg_count) { | |
| 78 ASSERT(frame_arg_count >= 0); | |
| 79 ASSERT(height_ >= frame_arg_count); | |
| 80 height_ -= frame_arg_count; | |
| 81 __ InvokeBuiltin(id, flag); | |
| 82 } | |
| 83 | |
| 84 | |
| 85 void VirtualFrame::CallCode(Handle<Code> code, | |
| 86 RelocInfo::Mode rmode, | |
| 87 int frame_arg_count) { | |
| 88 ASSERT(frame_arg_count >= 0); | |
| 89 ASSERT(height_ >= frame_arg_count); | |
| 90 height_ -= frame_arg_count; | |
| 91 __ call(code, rmode); | |
| 92 } | |
| 93 | |
| 94 | |
| 95 void VirtualFrame::Drop(int count) { | |
| 96 ASSERT(count >= 0); | |
| 97 ASSERT(height_ >= count); | |
| 98 if (count > 0) { | |
| 99 __ add(Operand(esp), Immediate(count * kPointerSize)); | |
| 100 height_ -= count; | |
| 101 } | |
| 102 } | |
| 103 | |
| 104 | |
| 105 void VirtualFrame::Pop() { | |
| 106 ASSERT(height_ > 0); | |
| 107 __ add(Operand(esp), Immediate(kPointerSize)); | |
| 108 height_--; | |
| 109 } | |
| 110 | |
| 111 | |
| 112 void VirtualFrame::Pop(Register reg) { | |
| 113 ASSERT(height_ > 0); | |
| 114 __ pop(reg); | |
| 115 height_--; | |
| 116 } | |
| 117 | |
| 118 | |
| 119 void VirtualFrame::Pop(Operand operand) { | |
| 120 ASSERT(height_ > 0); | |
| 121 __ pop(operand); | |
| 122 height_--; | |
| 123 } | |
| 124 | |
| 125 | |
| 126 void VirtualFrame::Push(Register reg) { | |
| 127 height_++; | |
| 128 __ push(reg); | |
| 129 } | |
| 130 | |
| 131 | |
| 132 void VirtualFrame::Push(Operand operand) { | |
| 133 height_++; | |
| 134 __ push(operand); | |
| 135 } | |
| 136 | |
| 137 | |
| 138 void VirtualFrame::Push(Immediate immediate) { | |
| 139 height_++; | |
| 140 __ push(immediate); | |
| 141 } | |
| 142 | |
| 143 #undef __ | |
| 144 | |
| 145 } } // namespace v8::internal | |
| 146 | |
| 147 #endif // V8_VIRTUAL_FRAME_IA32_INL_H_ | |
| OLD | NEW |