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 "type-info.h" |
32 #include "register-allocator.h" | 32 #include "register-allocator.h" |
33 #include "scopes.h" | 33 #include "scopes.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 // ------------------------------------------------------------------------- | 38 // ------------------------------------------------------------------------- |
39 // Virtual frames | 39 // Virtual frames |
40 // | 40 // |
41 // 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... |
76 inline VirtualFrame(); | 76 inline VirtualFrame(); |
77 | 77 |
78 // Construct a virtual frame as a clone of an existing one. | 78 // Construct a virtual frame as a clone of an existing one. |
79 explicit inline VirtualFrame(VirtualFrame* original); | 79 explicit inline VirtualFrame(VirtualFrame* original); |
80 | 80 |
81 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } | 81 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } |
82 MacroAssembler* masm() { return cgen()->masm(); } | 82 MacroAssembler* masm() { return cgen()->masm(); } |
83 | 83 |
84 // Create a duplicate of an existing valid frame element. | 84 // Create a duplicate of an existing valid frame element. |
85 FrameElement CopyElementAt(int index, | 85 FrameElement CopyElementAt(int index, |
86 NumberInfo info = NumberInfo::Uninitialized()); | 86 TypeInfo info = TypeInfo::Uninitialized()); |
87 | 87 |
88 // The number of elements on the virtual frame. | 88 // The number of elements on the virtual frame. |
89 int element_count() { return elements_.length(); } | 89 int element_count() { return elements_.length(); } |
90 | 90 |
91 // The height of the virtual expression stack. | 91 // The height of the virtual expression stack. |
92 int height() { | 92 int height() { |
93 return element_count() - expression_base_index(); | 93 return element_count() - expression_base_index(); |
94 } | 94 } |
95 | 95 |
96 int register_location(int num) { | 96 int register_location(int num) { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 Result Pop(); | 376 Result Pop(); |
377 | 377 |
378 // 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 |
379 // emit a corresponding pop instruction. | 379 // emit a corresponding pop instruction. |
380 void EmitPop(Register reg); | 380 void EmitPop(Register reg); |
381 void EmitPop(const Operand& operand); | 381 void EmitPop(const Operand& operand); |
382 | 382 |
383 // 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 |
384 // corresponding push instruction. | 384 // corresponding push instruction. |
385 void EmitPush(Register reg, | 385 void EmitPush(Register reg, |
386 NumberInfo info = NumberInfo::Unknown()); | 386 TypeInfo info = TypeInfo::Unknown()); |
387 void EmitPush(const Operand& operand, | 387 void EmitPush(const Operand& operand, |
388 NumberInfo info = NumberInfo::Unknown()); | 388 TypeInfo info = TypeInfo::Unknown()); |
389 void EmitPush(Heap::RootListIndex index, | 389 void EmitPush(Heap::RootListIndex index, |
390 NumberInfo info = NumberInfo::Unknown()); | 390 TypeInfo info = TypeInfo::Unknown()); |
391 void EmitPush(Immediate immediate, | 391 void EmitPush(Immediate immediate, |
392 NumberInfo info = NumberInfo::Unknown()); | 392 TypeInfo info = TypeInfo::Unknown()); |
393 void EmitPush(Smi* value); | 393 void EmitPush(Smi* value); |
394 // Uses kScratchRegister, emits appropriate relocation info. | 394 // Uses kScratchRegister, emits appropriate relocation info. |
395 void EmitPush(Handle<Object> value); | 395 void EmitPush(Handle<Object> value); |
396 | 396 |
397 // Push an element on the virtual frame. | 397 // Push an element on the virtual frame. |
398 inline void Push(Register reg, NumberInfo info = NumberInfo::Unknown()); | 398 inline void Push(Register reg, TypeInfo info = TypeInfo::Unknown()); |
399 inline void Push(Handle<Object> value); | 399 inline void Push(Handle<Object> value); |
400 inline void Push(Smi* value); | 400 inline void Push(Smi* value); |
401 | 401 |
402 // Pushing a result invalidates it (its contents become owned by the | 402 // Pushing a result invalidates it (its contents become owned by the |
403 // frame). | 403 // frame). |
404 void Push(Result* result) { | 404 void Push(Result* result) { |
405 if (result->is_register()) { | 405 if (result->is_register()) { |
406 Push(result->reg(), result->number_info()); | 406 Push(result->reg(), result->type_info()); |
407 } else { | 407 } else { |
408 ASSERT(result->is_constant()); | 408 ASSERT(result->is_constant()); |
409 Push(result->handle()); | 409 Push(result->handle()); |
410 } | 410 } |
411 result->Unuse(); | 411 result->Unuse(); |
412 } | 412 } |
413 | 413 |
414 // Nip removes zero or more elements from immediately below the top | 414 // Nip removes zero or more elements from immediately below the top |
415 // 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 |
416 // 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). |
417 inline void Nip(int num_dropped); | 417 inline void Nip(int num_dropped); |
418 | 418 |
419 inline void SetTypeForLocalAt(int index, NumberInfo info); | 419 inline void SetTypeForLocalAt(int index, TypeInfo info); |
420 inline void SetTypeForParamAt(int index, NumberInfo info); | 420 inline void SetTypeForParamAt(int index, TypeInfo info); |
421 | 421 |
422 private: | 422 private: |
423 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; | 423 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
424 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; | 424 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; |
425 static const int kContextOffset = StandardFrameConstants::kContextOffset; | 425 static const int kContextOffset = StandardFrameConstants::kContextOffset; |
426 | 426 |
427 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; | 427 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; |
428 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. | 428 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. |
429 | 429 |
430 ZoneList<FrameElement> elements_; | 430 ZoneList<FrameElement> elements_; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 | 564 |
565 // Classes that need raw access to the elements_ array. | 565 // Classes that need raw access to the elements_ array. |
566 friend class DeferredCode; | 566 friend class DeferredCode; |
567 friend class JumpTarget; | 567 friend class JumpTarget; |
568 }; | 568 }; |
569 | 569 |
570 | 570 |
571 } } // namespace v8::internal | 571 } } // namespace v8::internal |
572 | 572 |
573 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ | 573 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ |
OLD | NEW |