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_IA32_VIRTUAL_FRAME_IA32_H_ | 28 #ifndef V8_IA32_VIRTUAL_FRAME_IA32_H_ |
29 #define V8_IA32_VIRTUAL_FRAME_IA32_H_ | 29 #define V8_IA32_VIRTUAL_FRAME_IA32_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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 82 |
82 MacroAssembler* masm() { return cgen()->masm(); } | 83 MacroAssembler* masm() { return cgen()->masm(); } |
83 | 84 |
84 // Create a duplicate of an existing valid frame element. | 85 // Create a duplicate of an existing valid frame element. |
85 FrameElement CopyElementAt(int index); | 86 FrameElement CopyElementAt(int index, |
| 87 NumberInfo::Type info = NumberInfo::kUninitialized); |
86 | 88 |
87 // The number of elements on the virtual frame. | 89 // The number of elements on the virtual frame. |
88 int element_count() { return elements_.length(); } | 90 int element_count() { return elements_.length(); } |
89 | 91 |
90 // The height of the virtual expression stack. | 92 // The height of the virtual expression stack. |
91 int height() { return element_count() - expression_base_index(); } | 93 int height() { return element_count() - expression_base_index(); } |
92 | 94 |
93 int register_location(int num) { | 95 int register_location(int num) { |
94 ASSERT(num >= 0 && num < RegisterAllocator::kNumRegisters); | 96 ASSERT(num >= 0 && num < RegisterAllocator::kNumRegisters); |
95 return register_locations_[num]; | 97 return register_locations_[num]; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // Result, which may be a constant or a register. | 380 // Result, which may be a constant or a register. |
379 Result Pop(); | 381 Result Pop(); |
380 | 382 |
381 // Pop and save an element from the top of the expression stack and | 383 // Pop and save an element from the top of the expression stack and |
382 // emit a corresponding pop instruction. | 384 // emit a corresponding pop instruction. |
383 void EmitPop(Register reg); | 385 void EmitPop(Register reg); |
384 void EmitPop(Operand operand); | 386 void EmitPop(Operand operand); |
385 | 387 |
386 // Push an element on top of the expression stack and emit a | 388 // Push an element on top of the expression stack and emit a |
387 // corresponding push instruction. | 389 // corresponding push instruction. |
388 void EmitPush(Register reg); | 390 void EmitPush(Register reg, |
389 void EmitPush(Operand operand); | 391 NumberInfo::Type info = NumberInfo::kUnknown); |
390 void EmitPush(Immediate immediate); | 392 void EmitPush(Operand operand, |
| 393 NumberInfo::Type info = NumberInfo::kUnknown); |
| 394 void EmitPush(Immediate immediate, |
| 395 NumberInfo::Type info = NumberInfo::kUnknown); |
391 | 396 |
392 // Push an element on the virtual frame. | 397 // Push an element on the virtual frame. |
393 void Push(Register reg); | 398 void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); |
394 void Push(Handle<Object> value); | 399 void Push(Handle<Object> value); |
395 void Push(Smi* value) { | 400 void Push(Smi* value) { |
396 Push(Handle<Object> (value)); | 401 Push(Handle<Object> (value)); |
397 } | 402 } |
398 | 403 |
399 // Pushing a result invalidates it (its contents become owned by the | 404 // Pushing a result invalidates it (its contents become owned by the |
400 // frame). | 405 // frame). |
401 void Push(Result* result) { | 406 void Push(Result* result) { |
402 // This assert will trigger if you try to push the same value twice. | 407 // This assert will trigger if you try to push the same value twice. |
403 ASSERT(result->is_valid()); | 408 ASSERT(result->is_valid()); |
404 if (result->is_register()) { | 409 if (result->is_register()) { |
405 Push(result->reg()); | 410 Push(result->reg(), result->number_info()); |
406 } else { | 411 } else { |
407 ASSERT(result->is_constant()); | 412 ASSERT(result->is_constant()); |
408 Push(result->handle()); | 413 Push(result->handle()); |
409 } | 414 } |
410 result->Unuse(); | 415 result->Unuse(); |
411 } | 416 } |
412 | 417 |
413 // Nip removes zero or more elements from immediately below the top | 418 // Nip removes zero or more elements from immediately below the top |
414 // of the frame, leaving the previous top-of-frame value on top of | 419 // of the frame, leaving the previous top-of-frame value on top of |
415 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). | 420 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 bool Equals(VirtualFrame* other); | 580 bool Equals(VirtualFrame* other); |
576 | 581 |
577 // Classes that need raw access to the elements_ array. | 582 // Classes that need raw access to the elements_ array. |
578 friend class DeferredCode; | 583 friend class DeferredCode; |
579 friend class JumpTarget; | 584 friend class JumpTarget; |
580 }; | 585 }; |
581 | 586 |
582 } } // namespace v8::internal | 587 } } // namespace v8::internal |
583 | 588 |
584 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_ | 589 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_ |
OLD | NEW |