| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 SpilledScope() {} | 55 SpilledScope() {} |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // An illegal index into the virtual frame. | 58 // An illegal index into the virtual frame. |
| 59 static const int kIllegalIndex = -1; | 59 static const int kIllegalIndex = -1; |
| 60 | 60 |
| 61 // Construct an initial virtual frame on entry to a JS function. | 61 // Construct an initial virtual frame on entry to a JS function. |
| 62 VirtualFrame(); | 62 VirtualFrame(); |
| 63 | 63 |
| 64 // Construct a virtual frame as a clone of an existing one. | 64 // Construct a virtual frame as a clone of an existing one. |
| 65 explicit VirtualFrame(VirtualFrame* original); | 65 explicit inline VirtualFrame(VirtualFrame* original); |
| 66 | 66 |
| 67 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } | 67 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } |
| 68 MacroAssembler* masm() { return cgen()->masm(); } | 68 MacroAssembler* masm() { return cgen()->masm(); } |
| 69 | 69 |
| 70 // Create a duplicate of an existing valid frame element. | 70 // Create a duplicate of an existing valid frame element. |
| 71 FrameElement CopyElementAt(int index, | 71 FrameElement CopyElementAt(int index, |
| 72 NumberInfo::Type info = NumberInfo::kUnknown); | 72 NumberInfo::Type info = NumberInfo::kUnknown); |
| 73 | 73 |
| 74 // The number of elements on the virtual frame. | 74 // The number of elements on the virtual frame. |
| 75 int element_count() { return elements_.length(); } | 75 int element_count() { return elements_.length(); } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // Push an element on top of the expression stack and emit a | 337 // Push an element on top of the expression stack and emit a |
| 338 // corresponding push instruction. | 338 // corresponding push instruction. |
| 339 void EmitPush(Register reg); | 339 void EmitPush(Register reg); |
| 340 | 340 |
| 341 // Push multiple registers on the stack and the virtual frame | 341 // Push multiple registers on the stack and the virtual frame |
| 342 // Register are selected by setting bit in src_regs and | 342 // Register are selected by setting bit in src_regs and |
| 343 // are pushed in decreasing order: r15 .. r0. | 343 // are pushed in decreasing order: r15 .. r0. |
| 344 void EmitPushMultiple(int count, int src_regs); | 344 void EmitPushMultiple(int count, int src_regs); |
| 345 | 345 |
| 346 // Push an element on the virtual frame. | 346 // Push an element on the virtual frame. |
| 347 void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); | 347 inline void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); |
| 348 void Push(Handle<Object> value); | 348 inline void Push(Handle<Object> value); |
| 349 void Push(Smi* value) { Push(Handle<Object>(value)); } | 349 inline void Push(Smi* value); |
| 350 | 350 |
| 351 // Pushing a result invalidates it (its contents become owned by the frame). | 351 // Pushing a result invalidates it (its contents become owned by the frame). |
| 352 void Push(Result* result) { | 352 void Push(Result* result) { |
| 353 if (result->is_register()) { | 353 if (result->is_register()) { |
| 354 Push(result->reg()); | 354 Push(result->reg()); |
| 355 } else { | 355 } else { |
| 356 ASSERT(result->is_constant()); | 356 ASSERT(result->is_constant()); |
| 357 Push(result->handle()); | 357 Push(result->handle()); |
| 358 } | 358 } |
| 359 result->Unuse(); | 359 result->Unuse(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 // Nip removes zero or more elements from immediately below the top | 362 // Nip removes zero or more elements from immediately below the top |
| 363 // of the frame, leaving the previous top-of-frame value on top of | 363 // of the frame, leaving the previous top-of-frame value on top of |
| 364 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). | 364 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). |
| 365 void Nip(int num_dropped); | 365 inline void Nip(int num_dropped); |
| 366 | 366 |
| 367 private: | 367 private: |
| 368 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; | 368 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
| 369 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; | 369 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; |
| 370 static const int kContextOffset = StandardFrameConstants::kContextOffset; | 370 static const int kContextOffset = StandardFrameConstants::kContextOffset; |
| 371 | 371 |
| 372 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; | 372 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; |
| 373 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. | 373 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. |
| 374 | 374 |
| 375 ZoneList<FrameElement> elements_; | 375 ZoneList<FrameElement> elements_; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 void SyncRange(int begin, int end); | 450 void SyncRange(int begin, int end); |
| 451 | 451 |
| 452 // Sync a single unsynced element that lies beneath or at the stack pointer. | 452 // Sync a single unsynced element that lies beneath or at the stack pointer. |
| 453 void SyncElementBelowStackPointer(int index); | 453 void SyncElementBelowStackPointer(int index); |
| 454 | 454 |
| 455 // Sync a single unsynced element that lies just above the stack pointer. | 455 // Sync a single unsynced element that lies just above the stack pointer. |
| 456 void SyncElementByPushing(int index); | 456 void SyncElementByPushing(int index); |
| 457 | 457 |
| 458 // Push a copy of a frame slot (typically a local or parameter) on top of | 458 // Push a copy of a frame slot (typically a local or parameter) on top of |
| 459 // the frame. | 459 // the frame. |
| 460 void PushFrameSlotAt(int index); | 460 inline void PushFrameSlotAt(int index); |
| 461 | 461 |
| 462 // Push a the value of a frame slot (typically a local or parameter) on | 462 // Push a the value of a frame slot (typically a local or parameter) on |
| 463 // top of the frame and invalidate the slot. | 463 // top of the frame and invalidate the slot. |
| 464 void TakeFrameSlotAt(int index); | 464 void TakeFrameSlotAt(int index); |
| 465 | 465 |
| 466 // Store the value on top of the frame to a frame slot (typically a local | 466 // Store the value on top of the frame to a frame slot (typically a local |
| 467 // or parameter). | 467 // or parameter). |
| 468 void StoreToFrameSlotAt(int index); | 468 void StoreToFrameSlotAt(int index); |
| 469 | 469 |
| 470 // Spill all elements in registers. Spill the top spilled_args elements | 470 // Spill all elements in registers. Spill the top spilled_args elements |
| (...skipping 22 matching lines...) Expand all Loading... |
| 493 // should be equal. | 493 // should be equal. |
| 494 void MergeMoveMemoryToRegisters(VirtualFrame* expected); | 494 void MergeMoveMemoryToRegisters(VirtualFrame* expected); |
| 495 | 495 |
| 496 // Invalidates a frame slot (puts an invalid frame element in it). | 496 // Invalidates a frame slot (puts an invalid frame element in it). |
| 497 // Copies on the frame are correctly handled, and if this slot was | 497 // Copies on the frame are correctly handled, and if this slot was |
| 498 // the backing store of copies, the index of the new backing store | 498 // the backing store of copies, the index of the new backing store |
| 499 // is returned. Otherwise, returns kIllegalIndex. | 499 // is returned. Otherwise, returns kIllegalIndex. |
| 500 // Register counts are correctly updated. | 500 // Register counts are correctly updated. |
| 501 int InvalidateFrameSlotAt(int index); | 501 int InvalidateFrameSlotAt(int index); |
| 502 | 502 |
| 503 bool Equals(VirtualFrame* other); | 503 inline bool Equals(VirtualFrame* other); |
| 504 | 504 |
| 505 // Classes that need raw access to the elements_ array. | 505 // Classes that need raw access to the elements_ array. |
| 506 friend class DeferredCode; | 506 friend class DeferredCode; |
| 507 friend class JumpTarget; | 507 friend class JumpTarget; |
| 508 }; | 508 }; |
| 509 | 509 |
| 510 | 510 |
| 511 } } // namespace v8::internal | 511 } } // namespace v8::internal |
| 512 | 512 |
| 513 #endif // V8_ARM_VIRTUAL_FRAME_ARM_H_ | 513 #endif // V8_ARM_VIRTUAL_FRAME_ARM_H_ |
| OLD | NEW |