OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // generator is being transformed. | 54 // generator is being transformed. |
55 class SpilledScope BASE_EMBEDDED { | 55 class SpilledScope BASE_EMBEDDED { |
56 public: | 56 public: |
57 SpilledScope() {} | 57 SpilledScope() {} |
58 }; | 58 }; |
59 | 59 |
60 // An illegal index into the virtual frame. | 60 // An illegal index into the virtual frame. |
61 static const int kIllegalIndex = -1; | 61 static const int kIllegalIndex = -1; |
62 | 62 |
63 // Construct an initial virtual frame on entry to a JS function. | 63 // Construct an initial virtual frame on entry to a JS function. |
64 VirtualFrame(); | 64 inline VirtualFrame(); |
65 | 65 |
66 // Construct a virtual frame as a clone of an existing one. | 66 // Construct a virtual frame as a clone of an existing one. |
67 explicit VirtualFrame(VirtualFrame* original); | 67 explicit inline VirtualFrame(VirtualFrame* original); |
68 | 68 |
69 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } | 69 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } |
70 MacroAssembler* masm() { return cgen()->masm(); } | 70 MacroAssembler* masm() { return cgen()->masm(); } |
71 | 71 |
72 // Create a duplicate of an existing valid frame element. | 72 // Create a duplicate of an existing valid frame element. |
73 FrameElement CopyElementAt(int index); | 73 FrameElement CopyElementAt(int index, |
| 74 NumberInfo::Type info = NumberInfo::kUnknown); |
74 | 75 |
75 // The number of elements on the virtual frame. | 76 // The number of elements on the virtual frame. |
76 int element_count() { return elements_.length(); } | 77 int element_count() { return elements_.length(); } |
77 | 78 |
78 // The height of the virtual expression stack. | 79 // The height of the virtual expression stack. |
79 int height() { | 80 int height() { |
80 return element_count() - expression_base_index(); | 81 return element_count() - expression_base_index(); |
81 } | 82 } |
82 | 83 |
83 int register_location(int num) { | 84 int register_location(int num) { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 void EmitMultiPopReversed(RegList regs); // lower first | 360 void EmitMultiPopReversed(RegList regs); // lower first |
360 | 361 |
361 // Push an element on top of the expression stack and emit a | 362 // Push an element on top of the expression stack and emit a |
362 // corresponding push instruction. | 363 // corresponding push instruction. |
363 void EmitPush(Register reg); | 364 void EmitPush(Register reg); |
364 // Same but for multiple registers. | 365 // Same but for multiple registers. |
365 void EmitMultiPush(RegList regs); // lower indexed registers are pushed first | 366 void EmitMultiPush(RegList regs); // lower indexed registers are pushed first |
366 void EmitMultiPushReversed(RegList regs); // higher first | 367 void EmitMultiPushReversed(RegList regs); // higher first |
367 | 368 |
368 // Push an element on the virtual frame. | 369 // Push an element on the virtual frame. |
369 void Push(Register reg); | 370 inline void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); |
370 void Push(Handle<Object> value); | 371 inline void Push(Handle<Object> value); |
371 void Push(Smi* value) { Push(Handle<Object>(value)); } | 372 inline void Push(Smi* value); |
372 | 373 |
373 // Pushing a result invalidates it (its contents become owned by the frame). | 374 // Pushing a result invalidates it (its contents become owned by the frame). |
374 void Push(Result* result) { | 375 void Push(Result* result) { |
375 if (result->is_register()) { | 376 if (result->is_register()) { |
376 Push(result->reg()); | 377 Push(result->reg()); |
377 } else { | 378 } else { |
378 ASSERT(result->is_constant()); | 379 ASSERT(result->is_constant()); |
379 Push(result->handle()); | 380 Push(result->handle()); |
380 } | 381 } |
381 result->Unuse(); | 382 result->Unuse(); |
382 } | 383 } |
383 | 384 |
384 // Nip removes zero or more elements from immediately below the top | 385 // Nip removes zero or more elements from immediately below the top |
385 // of the frame, leaving the previous top-of-frame value on top of | 386 // of the frame, leaving the previous top-of-frame value on top of |
386 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). | 387 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). |
387 void Nip(int num_dropped); | 388 inline void Nip(int num_dropped); |
388 | 389 |
389 // This pushes 4 arguments slots on the stack and saves asked 'a' registers | 390 // This pushes 4 arguments slots on the stack and saves asked 'a' registers |
390 // 'a' registers are arguments register a0 to a3. | 391 // 'a' registers are arguments register a0 to a3. |
391 void EmitArgumentSlots(RegList reglist); | 392 void EmitArgumentSlots(RegList reglist); |
392 | 393 |
393 private: | 394 private: |
394 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; | 395 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
395 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; | 396 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; |
396 static const int kContextOffset = StandardFrameConstants::kContextOffset; | 397 static const int kContextOffset = StandardFrameConstants::kContextOffset; |
397 | 398 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 void SyncRange(int begin, int end); | 477 void SyncRange(int begin, int end); |
477 | 478 |
478 // Sync a single unsynced element that lies beneath or at the stack pointer. | 479 // Sync a single unsynced element that lies beneath or at the stack pointer. |
479 void SyncElementBelowStackPointer(int index); | 480 void SyncElementBelowStackPointer(int index); |
480 | 481 |
481 // Sync a single unsynced element that lies just above the stack pointer. | 482 // Sync a single unsynced element that lies just above the stack pointer. |
482 void SyncElementByPushing(int index); | 483 void SyncElementByPushing(int index); |
483 | 484 |
484 // Push a copy of a frame slot (typically a local or parameter) on top of | 485 // Push a copy of a frame slot (typically a local or parameter) on top of |
485 // the frame. | 486 // the frame. |
486 void PushFrameSlotAt(int index); | 487 inline void PushFrameSlotAt(int index); |
487 | 488 |
488 // Push a the value of a frame slot (typically a local or parameter) on | 489 // Push a the value of a frame slot (typically a local or parameter) on |
489 // top of the frame and invalidate the slot. | 490 // top of the frame and invalidate the slot. |
490 void TakeFrameSlotAt(int index); | 491 void TakeFrameSlotAt(int index); |
491 | 492 |
492 // Store the value on top of the frame to a frame slot (typically a local | 493 // Store the value on top of the frame to a frame slot (typically a local |
493 // or parameter). | 494 // or parameter). |
494 void StoreToFrameSlotAt(int index); | 495 void StoreToFrameSlotAt(int index); |
495 | 496 |
496 // Spill all elements in registers. Spill the top spilled_args elements | 497 // Spill all elements in registers. Spill the top spilled_args elements |
(...skipping 30 matching lines...) Expand all Loading... |
527 int InvalidateFrameSlotAt(int index); | 528 int InvalidateFrameSlotAt(int index); |
528 | 529 |
529 // Call a code stub that has already been prepared for calling (via | 530 // Call a code stub that has already been prepared for calling (via |
530 // PrepareForCall). | 531 // PrepareForCall). |
531 void RawCallStub(CodeStub* stub); | 532 void RawCallStub(CodeStub* stub); |
532 | 533 |
533 // Calls a code object which has already been prepared for calling | 534 // Calls a code object which has already been prepared for calling |
534 // (via PrepareForCall). | 535 // (via PrepareForCall). |
535 void RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); | 536 void RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); |
536 | 537 |
537 bool Equals(VirtualFrame* other); | 538 inline bool Equals(VirtualFrame* other); |
538 | 539 |
539 // Classes that need raw access to the elements_ array. | 540 // Classes that need raw access to the elements_ array. |
540 friend class DeferredCode; | 541 friend class DeferredCode; |
541 friend class JumpTarget; | 542 friend class JumpTarget; |
542 }; | 543 }; |
543 | 544 |
544 | 545 |
545 } } // namespace v8::internal | 546 } } // namespace v8::internal |
546 | 547 |
547 #endif // V8_MIPS_VIRTUAL_FRAME_MIPS_H_ | 548 #endif // V8_MIPS_VIRTUAL_FRAME_MIPS_H_ |
548 | 549 |
OLD | NEW |