| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_X64_VIRTUAL_FRAME_X64_H_ | 28 #ifndef V8_X64_VIRTUAL_FRAME_X64_H_ |
| 29 #define V8_X64_VIRTUAL_FRAME_X64_H_ | 29 #define V8_X64_VIRTUAL_FRAME_X64_H_ |
| 30 | 30 |
| 31 #include "number-info.h" |
| 31 #include "register-allocator.h" | 32 #include "register-allocator.h" |
| 32 #include "scopes.h" | 33 #include "scopes.h" |
| 33 | 34 |
| 34 namespace v8 { | 35 namespace v8 { |
| 35 namespace internal { | 36 namespace internal { |
| 36 | 37 |
| 37 // ------------------------------------------------------------------------- | 38 // ------------------------------------------------------------------------- |
| 38 // Virtual frames | 39 // Virtual frames |
| 39 // | 40 // |
| 40 // The virtual frame is an abstraction of the physical stack frame. It | 41 // The virtual frame is an abstraction of the physical stack frame. It |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Construct an initial virtual frame on entry to a JS function. | 75 // Construct an initial virtual frame on entry to a JS function. |
| 75 VirtualFrame(); | 76 VirtualFrame(); |
| 76 | 77 |
| 77 // Construct a virtual frame as a clone of an existing one. | 78 // Construct a virtual frame as a clone of an existing one. |
| 78 explicit VirtualFrame(VirtualFrame* original); | 79 explicit VirtualFrame(VirtualFrame* original); |
| 79 | 80 |
| 80 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } | 81 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } |
| 81 MacroAssembler* masm() { return cgen()->masm(); } | 82 MacroAssembler* masm() { return cgen()->masm(); } |
| 82 | 83 |
| 83 // Create a duplicate of an existing valid frame element. | 84 // Create a duplicate of an existing valid frame element. |
| 84 FrameElement CopyElementAt(int index); | 85 FrameElement CopyElementAt(int index, |
| 86 NumberInfo::Type info = NumberInfo::kUninitialized); |
| 85 | 87 |
| 86 // The number of elements on the virtual frame. | 88 // The number of elements on the virtual frame. |
| 87 int element_count() { return elements_.length(); } | 89 int element_count() { return elements_.length(); } |
| 88 | 90 |
| 89 // The height of the virtual expression stack. | 91 // The height of the virtual expression stack. |
| 90 int height() { | 92 int height() { |
| 91 return element_count() - expression_base_index(); | 93 return element_count() - expression_base_index(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 int register_location(int num) { | 96 int register_location(int num) { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 // Result, which may be a constant or a register. | 375 // Result, which may be a constant or a register. |
| 374 Result Pop(); | 376 Result Pop(); |
| 375 | 377 |
| 376 // Pop and save an element from the top of the expression stack and | 378 // Pop and save an element from the top of the expression stack and |
| 377 // emit a corresponding pop instruction. | 379 // emit a corresponding pop instruction. |
| 378 void EmitPop(Register reg); | 380 void EmitPop(Register reg); |
| 379 void EmitPop(const Operand& operand); | 381 void EmitPop(const Operand& operand); |
| 380 | 382 |
| 381 // Push an element on top of the expression stack and emit a | 383 // Push an element on top of the expression stack and emit a |
| 382 // corresponding push instruction. | 384 // corresponding push instruction. |
| 383 void EmitPush(Register reg); | 385 void EmitPush(Register reg, |
| 384 void EmitPush(const Operand& operand); | 386 NumberInfo::Type info = NumberInfo::kUnknown); |
| 385 void EmitPush(Heap::RootListIndex index); | 387 void EmitPush(const Operand& operand, |
| 386 void EmitPush(Immediate immediate); | 388 NumberInfo::Type info = NumberInfo::kUnknown); |
| 389 void EmitPush(Heap::RootListIndex index, |
| 390 NumberInfo::Type info = NumberInfo::kUnknown); |
| 391 void EmitPush(Immediate immediate, |
| 392 NumberInfo::Type info = NumberInfo::kUnknown); |
| 387 void EmitPush(Smi* value); | 393 void EmitPush(Smi* value); |
| 388 // Uses kScratchRegister, emits appropriate relocation info. | 394 // Uses kScratchRegister, emits appropriate relocation info. |
| 389 void EmitPush(Handle<Object> value); | 395 void EmitPush(Handle<Object> value); |
| 390 | 396 |
| 391 // Push an element on the virtual frame. | 397 // Push an element on the virtual frame. |
| 392 void Push(Register reg); | 398 void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); |
| 393 void Push(Handle<Object> value); | 399 void Push(Handle<Object> value); |
| 394 void Push(Smi* value) { Push(Handle<Object>(value)); } | 400 void Push(Smi* value) { Push(Handle<Object>(value)); } |
| 395 | 401 |
| 396 // Pushing a result invalidates it (its contents become owned by the | 402 // Pushing a result invalidates it (its contents become owned by the |
| 397 // frame). | 403 // frame). |
| 398 void Push(Result* result) { | 404 void Push(Result* result) { |
| 399 if (result->is_register()) { | 405 if (result->is_register()) { |
| 400 Push(result->reg()); | 406 Push(result->reg(), result->number_info()); |
| 401 } else { | 407 } else { |
| 402 ASSERT(result->is_constant()); | 408 ASSERT(result->is_constant()); |
| 403 Push(result->handle()); | 409 Push(result->handle()); |
| 404 } | 410 } |
| 405 result->Unuse(); | 411 result->Unuse(); |
| 406 } | 412 } |
| 407 | 413 |
| 408 // Nip removes zero or more elements from immediately below the top | 414 // Nip removes zero or more elements from immediately below the top |
| 409 // of the frame, leaving the previous top-of-frame value on top of | 415 // of the frame, leaving the previous top-of-frame value on top of |
| 410 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). | 416 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 | 561 |
| 556 // Classes that need raw access to the elements_ array. | 562 // Classes that need raw access to the elements_ array. |
| 557 friend class DeferredCode; | 563 friend class DeferredCode; |
| 558 friend class JumpTarget; | 564 friend class JumpTarget; |
| 559 }; | 565 }; |
| 560 | 566 |
| 561 | 567 |
| 562 } } // namespace v8::internal | 568 } } // namespace v8::internal |
| 563 | 569 |
| 564 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ | 570 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ |
| OLD | NEW |