| 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 | 82 |
| 83 MacroAssembler* masm() { return cgen()->masm(); } | 83 MacroAssembler* masm() { return cgen()->masm(); } |
| 84 | 84 |
| 85 // Create a duplicate of an existing valid frame element. | 85 // Create a duplicate of an existing valid frame element. |
| 86 FrameElement CopyElementAt(int index, | 86 FrameElement CopyElementAt(int index, |
| 87 NumberInfo::Type info = NumberInfo::kUninitialized); | 87 NumberInfo::Type info = NumberInfo::kUninitialized); |
| 88 | 88 |
| 89 // The number of elements on the virtual frame. | 89 // The number of elements on the virtual frame. |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // 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 |
| 389 // corresponding push instruction. | 389 // corresponding push instruction. |
| 390 void EmitPush(Register reg, | 390 void EmitPush(Register reg, |
| 391 NumberInfo::Type info = NumberInfo::kUnknown); | 391 NumberInfo::Type info = NumberInfo::kUnknown); |
| 392 void EmitPush(Operand operand, | 392 void EmitPush(Operand operand, |
| 393 NumberInfo::Type info = NumberInfo::kUnknown); | 393 NumberInfo::Type info = NumberInfo::kUnknown); |
| 394 void EmitPush(Immediate immediate, | 394 void EmitPush(Immediate immediate, |
| 395 NumberInfo::Type info = NumberInfo::kUnknown); | 395 NumberInfo::Type info = NumberInfo::kUnknown); |
| 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) { | 400 inline void Push(Smi* value); |
| 401 Push(Handle<Object> (value)); | |
| 402 } | |
| 403 | 401 |
| 404 // Pushing a result invalidates it (its contents become owned by the | 402 // Pushing a result invalidates it (its contents become owned by the |
| 405 // frame). | 403 // frame). |
| 406 void Push(Result* result) { | 404 void Push(Result* result) { |
| 407 // This assert will trigger if you try to push the same value twice. | 405 // This assert will trigger if you try to push the same value twice. |
| 408 ASSERT(result->is_valid()); | 406 ASSERT(result->is_valid()); |
| 409 if (result->is_register()) { | 407 if (result->is_register()) { |
| 410 Push(result->reg(), result->number_info()); | 408 Push(result->reg(), result->number_info()); |
| 411 } else { | 409 } else { |
| 412 ASSERT(result->is_constant()); | 410 ASSERT(result->is_constant()); |
| 413 Push(result->handle()); | 411 Push(result->handle()); |
| 414 } | 412 } |
| 415 result->Unuse(); | 413 result->Unuse(); |
| 416 } | 414 } |
| 417 | 415 |
| 418 // Pushing an expression expects that the expression is trivial (according | 416 // Pushing an expression expects that the expression is trivial (according |
| 419 // to Expression::IsTrivial). | 417 // to Expression::IsTrivial). |
| 420 void Push(Expression* expr); | 418 void Push(Expression* expr); |
| 421 | 419 |
| 422 // Nip removes zero or more elements from immediately below the top | 420 // Nip removes zero or more elements from immediately below the top |
| 423 // of the frame, leaving the previous top-of-frame value on top of | 421 // of the frame, leaving the previous top-of-frame value on top of |
| 424 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). | 422 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). |
| 425 void Nip(int num_dropped); | 423 inline void Nip(int num_dropped); |
| 426 | 424 |
| 427 private: | 425 private: |
| 428 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; | 426 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
| 429 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; | 427 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; |
| 430 static const int kContextOffset = StandardFrameConstants::kContextOffset; | 428 static const int kContextOffset = StandardFrameConstants::kContextOffset; |
| 431 | 429 |
| 432 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; | 430 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; |
| 433 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. | 431 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. |
| 434 | 432 |
| 435 ZoneList<FrameElement> elements_; | 433 ZoneList<FrameElement> elements_; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 void SyncElementAt(int index); | 521 void SyncElementAt(int index); |
| 524 | 522 |
| 525 // Sync a single unsynced element that lies beneath or at the stack pointer. | 523 // Sync a single unsynced element that lies beneath or at the stack pointer. |
| 526 void SyncElementBelowStackPointer(int index); | 524 void SyncElementBelowStackPointer(int index); |
| 527 | 525 |
| 528 // Sync a single unsynced element that lies just above the stack pointer. | 526 // Sync a single unsynced element that lies just above the stack pointer. |
| 529 void SyncElementByPushing(int index); | 527 void SyncElementByPushing(int index); |
| 530 | 528 |
| 531 // Push a copy of a frame slot (typically a local or parameter) on top of | 529 // Push a copy of a frame slot (typically a local or parameter) on top of |
| 532 // the frame. | 530 // the frame. |
| 533 void PushFrameSlotAt(int index); | 531 inline void PushFrameSlotAt(int index); |
| 534 | 532 |
| 535 // Push a the value of a frame slot (typically a local or parameter) on | 533 // Push a the value of a frame slot (typically a local or parameter) on |
| 536 // top of the frame and invalidate the slot. | 534 // top of the frame and invalidate the slot. |
| 537 void TakeFrameSlotAt(int index); | 535 void TakeFrameSlotAt(int index); |
| 538 | 536 |
| 539 // Store the value on top of the frame to a frame slot (typically a local | 537 // Store the value on top of the frame to a frame slot (typically a local |
| 540 // or parameter). | 538 // or parameter). |
| 541 void StoreToFrameSlotAt(int index); | 539 void StoreToFrameSlotAt(int index); |
| 542 | 540 |
| 543 // Spill all elements in registers. Spill the top spilled_args elements | 541 // Spill all elements in registers. Spill the top spilled_args elements |
| (...skipping 30 matching lines...) Expand all Loading... |
| 574 int InvalidateFrameSlotAt(int index); | 572 int InvalidateFrameSlotAt(int index); |
| 575 | 573 |
| 576 // Call a code stub that has already been prepared for calling (via | 574 // Call a code stub that has already been prepared for calling (via |
| 577 // PrepareForCall). | 575 // PrepareForCall). |
| 578 Result RawCallStub(CodeStub* stub); | 576 Result RawCallStub(CodeStub* stub); |
| 579 | 577 |
| 580 // Calls a code object which has already been prepared for calling | 578 // Calls a code object which has already been prepared for calling |
| 581 // (via PrepareForCall). | 579 // (via PrepareForCall). |
| 582 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); | 580 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); |
| 583 | 581 |
| 584 bool Equals(VirtualFrame* other); | 582 inline bool Equals(VirtualFrame* other); |
| 585 | 583 |
| 586 // Classes that need raw access to the elements_ array. | 584 // Classes that need raw access to the elements_ array. |
| 587 friend class DeferredCode; | 585 friend class DeferredCode; |
| 588 friend class JumpTarget; | 586 friend class JumpTarget; |
| 589 }; | 587 }; |
| 590 | 588 |
| 591 } } // namespace v8::internal | 589 } } // namespace v8::internal |
| 592 | 590 |
| 593 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_ | 591 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_ |
| OLD | NEW |