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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } | 69 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } |
70 }; | 70 }; |
71 | 71 |
72 // An illegal index into the virtual frame. | 72 // An illegal index into the virtual frame. |
73 static const int kIllegalIndex = -1; | 73 static const int kIllegalIndex = -1; |
74 | 74 |
75 // Construct an initial virtual frame on entry to a JS function. | 75 // Construct an initial virtual frame on entry to a JS function. |
76 VirtualFrame(); | 76 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 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::Type info = NumberInfo::kUninitialized); | 86 NumberInfo::Type info = NumberInfo::kUninitialized); |
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(); } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 NumberInfo::Type info = NumberInfo::kUnknown); | 388 NumberInfo::Type info = NumberInfo::kUnknown); |
389 void EmitPush(Heap::RootListIndex index, | 389 void EmitPush(Heap::RootListIndex index, |
390 NumberInfo::Type info = NumberInfo::kUnknown); | 390 NumberInfo::Type info = NumberInfo::kUnknown); |
391 void EmitPush(Immediate immediate, | 391 void EmitPush(Immediate immediate, |
392 NumberInfo::Type info = NumberInfo::kUnknown); | 392 NumberInfo::Type info = NumberInfo::kUnknown); |
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 void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); | 398 inline void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); |
399 void Push(Handle<Object> value); | 399 inline void Push(Handle<Object> value); |
400 void Push(Smi* value) { Push(Handle<Object>(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->number_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 void Nip(int num_dropped); | 417 inline void Nip(int num_dropped); |
418 | 418 |
419 private: | 419 private: |
420 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; | 420 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
421 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; | 421 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; |
422 static const int kContextOffset = StandardFrameConstants::kContextOffset; | 422 static const int kContextOffset = StandardFrameConstants::kContextOffset; |
423 | 423 |
424 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; | 424 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; |
425 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. | 425 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. |
426 | 426 |
427 ZoneList<FrameElement> elements_; | 427 ZoneList<FrameElement> elements_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 void SyncElementAt(int index); | 499 void SyncElementAt(int index); |
500 | 500 |
501 // Sync a single unsynced element that lies beneath or at the stack pointer. | 501 // Sync a single unsynced element that lies beneath or at the stack pointer. |
502 void SyncElementBelowStackPointer(int index); | 502 void SyncElementBelowStackPointer(int index); |
503 | 503 |
504 // Sync a single unsynced element that lies just above the stack pointer. | 504 // Sync a single unsynced element that lies just above the stack pointer. |
505 void SyncElementByPushing(int index); | 505 void SyncElementByPushing(int index); |
506 | 506 |
507 // Push a copy of a frame slot (typically a local or parameter) on top of | 507 // Push a copy of a frame slot (typically a local or parameter) on top of |
508 // the frame. | 508 // the frame. |
509 void PushFrameSlotAt(int index); | 509 inline void PushFrameSlotAt(int index); |
510 | 510 |
511 // Push a the value of a frame slot (typically a local or parameter) on | 511 // Push a the value of a frame slot (typically a local or parameter) on |
512 // top of the frame and invalidate the slot. | 512 // top of the frame and invalidate the slot. |
513 void TakeFrameSlotAt(int index); | 513 void TakeFrameSlotAt(int index); |
514 | 514 |
515 // Store the value on top of the frame to a frame slot (typically a local | 515 // Store the value on top of the frame to a frame slot (typically a local |
516 // or parameter). | 516 // or parameter). |
517 void StoreToFrameSlotAt(int index); | 517 void StoreToFrameSlotAt(int index); |
518 | 518 |
519 // Spill all elements in registers. Spill the top spilled_args elements | 519 // Spill all elements in registers. Spill the top spilled_args elements |
(...skipping 30 matching lines...) Expand all Loading... |
550 int InvalidateFrameSlotAt(int index); | 550 int InvalidateFrameSlotAt(int index); |
551 | 551 |
552 // Call a code stub that has already been prepared for calling (via | 552 // Call a code stub that has already been prepared for calling (via |
553 // PrepareForCall). | 553 // PrepareForCall). |
554 Result RawCallStub(CodeStub* stub); | 554 Result RawCallStub(CodeStub* stub); |
555 | 555 |
556 // Calls a code object which has already been prepared for calling | 556 // Calls a code object which has already been prepared for calling |
557 // (via PrepareForCall). | 557 // (via PrepareForCall). |
558 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); | 558 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); |
559 | 559 |
560 bool Equals(VirtualFrame* other); | 560 inline bool Equals(VirtualFrame* other); |
561 | 561 |
562 // Classes that need raw access to the elements_ array. | 562 // Classes that need raw access to the elements_ array. |
563 friend class DeferredCode; | 563 friend class DeferredCode; |
564 friend class JumpTarget; | 564 friend class JumpTarget; |
565 }; | 565 }; |
566 | 566 |
567 | 567 |
568 } } // namespace v8::internal | 568 } } // namespace v8::internal |
569 | 569 |
570 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ | 570 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ |
OLD | NEW |