Index: src/mips/virtual-frame-mips.h |
=================================================================== |
--- src/mips/virtual-frame-mips.h (revision 4229) |
+++ src/mips/virtual-frame-mips.h (working copy) |
@@ -39,18 +39,18 @@ |
// ------------------------------------------------------------------------- |
// Virtual frames |
// |
-// The virtual frame is an abstraction of the physical stack frame. It |
+// The virtual frame is an abstraction of the physical stack frame. It |
// encapsulates the parameters, frame-allocated locals, and the expression |
-// stack. It supports push/pop operations on the expression stack, as well |
+// stack. It supports push/pop operations on the expression stack, as well |
// as random access to the expression stack elements, locals, and |
// parameters. |
class VirtualFrame : public ZoneObject { |
public: |
// A utility class to introduce a scope where the virtual frame is |
- // expected to remain spilled. The constructor spills the code |
+ // expected to remain spilled. The constructor spills the code |
// generator's current frame, but no attempt is made to require it |
- // to stay spilled. It is intended as documentation while the code |
+ // to stay spilled. It is intended as documentation while the code |
// generator is being transformed. |
class SpilledScope BASE_EMBEDDED { |
public: |
@@ -105,12 +105,12 @@ |
} |
// Add extra in-memory elements to the top of the frame to match an actual |
- // frame (eg, the frame after an exception handler is pushed). No code is |
+ // frame (eg, the frame after an exception handler is pushed). No code is |
// emitted. |
void Adjust(int count); |
// Forget elements from the top of the frame to match an actual frame (eg, |
- // the frame after a runtime call). No code is emitted. |
+ // the frame after a runtime call). No code is emitted. |
void Forget(int count) { |
ASSERT(count >= 0); |
ASSERT(stack_pointer_ == element_count() - 1); |
@@ -121,7 +121,7 @@ |
} |
// Forget count elements from the top of the frame and adjust the stack |
- // pointer downward. This is used, for example, before merging frames at |
+ // pointer downward. This is used, for example, before merging frames at |
// break, continue, and return targets. |
void ForgetElements(int count); |
@@ -133,24 +133,24 @@ |
if (is_used(reg)) SpillElementAt(register_location(reg)); |
} |
- // Spill all occurrences of an arbitrary register if possible. Return the |
+ // Spill all occurrences of an arbitrary register if possible. Return the |
// register spilled or no_reg if it was not possible to free any register |
// (ie, they all have frame-external references). |
Register SpillAnyRegister(); |
// Prepare this virtual frame for merging to an expected frame by |
// performing some state changes that do not require generating |
- // code. It is guaranteed that no code will be generated. |
+ // code. It is guaranteed that no code will be generated. |
void PrepareMergeTo(VirtualFrame* expected); |
// Make this virtual frame have a state identical to an expected virtual |
- // frame. As a side effect, code may be emitted to make this frame match |
+ // frame. As a side effect, code may be emitted to make this frame match |
// the expected one. |
void MergeTo(VirtualFrame* expected); |
- // Detach a frame from its code generator, perhaps temporarily. This |
+ // Detach a frame from its code generator, perhaps temporarily. This |
// tells the register allocator that it is free to use frame-internal |
- // registers. Used when the code generator's frame is switched from this |
+ // registers. Used when the code generator's frame is switched from this |
// one to NULL by an unconditional jump. |
void DetachFromCodeGenerator() { |
RegisterAllocator* cgen_allocator = cgen()->allocator(); |
@@ -159,7 +159,7 @@ |
} |
} |
- // (Re)attach a frame to its code generator. This informs the register |
+ // (Re)attach a frame to its code generator. This informs the register |
// allocator that the frame-internal register references are active again. |
// Used when a code generator's frame is switched from NULL to this one by |
// binding a label. |
@@ -170,17 +170,17 @@ |
} |
} |
- // Emit code for the physical JS entry and exit frame sequences. After |
+ // Emit code for the physical JS entry and exit frame sequences. After |
// calling Enter, the virtual frame is ready for use; and after calling |
- // Exit it should not be used. Note that Enter does not allocate space in |
+ // Exit it should not be used. Note that Enter does not allocate space in |
// the physical frame for storing frame-allocated locals. |
void Enter(); |
void Exit(); |
// Prepare for returning from the frame by spilling locals and |
- // dropping all non-locals elements in the virtual frame. This |
+ // dropping all non-locals elements in the virtual frame. This |
// avoids generating unnecessary merge code when jumping to the |
- // shared return site. Emits code for spills. |
+ // shared return site. Emits code for spills. |
void PrepareForReturn(); |
// Allocate and initialize the frame-allocated locals. |
@@ -194,11 +194,11 @@ |
return MemOperand(sp, index * kPointerSize); |
} |
- // Random-access store to a frame-top relative frame element. The result |
+ // Random-access store to a frame-top relative frame element. The result |
// becomes owned by the frame and is invalidated. |
void SetElementAt(int index, Result* value); |
- // Set a frame element to a constant. The index is frame-top relative. |
+ // Set a frame element to a constant. The index is frame-top relative. |
void SetElementAt(int index, Handle<Object> value) { |
Result temp(value); |
SetElementAt(index, &temp); |
@@ -221,13 +221,13 @@ |
} |
// Push the value of a local frame slot on top of the frame and invalidate |
- // the local slot. The slot should be written to before trying to read |
+ // the local slot. The slot should be written to before trying to read |
// from it again. |
void TakeLocalAt(int index) { |
TakeFrameSlotAt(local0_index() + index); |
} |
- // Store the top value on the virtual frame into a local frame slot. The |
+ // Store the top value on the virtual frame into a local frame slot. The |
// value is left in place on top of the frame. |
void StoreToLocalAt(int index) { |
StoreToFrameSlotAt(local0_index() + index); |
@@ -267,7 +267,7 @@ |
} |
// Push the value of a paramter frame slot on top of the frame and |
- // invalidate the parameter slot. The slot should be written to before |
+ // invalidate the parameter slot. The slot should be written to before |
// trying to read from it again. |
void TakeParameterAt(int index) { |
TakeFrameSlotAt(param0_index() + index); |
@@ -292,12 +292,8 @@ |
RawCallStub(stub); |
} |
- // Call stub that expects its argument in r0. The argument is given |
- // as a result which must be the register r0. |
void CallStub(CodeStub* stub, Result* arg); |
- // Call stub that expects its arguments in r1 and r0. The arguments |
- // are given as results which must be the appropriate registers. |
void CallStub(CodeStub* stub, Result* arg0, Result* arg1); |
// Call runtime given the number of arguments expected on (and |
@@ -317,7 +313,7 @@ |
int arg_count); |
// Call into an IC stub given the number of arguments it removes |
- // from the stack. Register arguments are passed as results and |
+ // from the stack. Register arguments are passed as results and |
// consumed by the call. |
void CallCodeObject(Handle<Code> ic, |
RelocInfo::Mode rmode, |
@@ -333,8 +329,8 @@ |
int dropped_args, |
bool set_auto_args_slots = false); |
- // Drop a number of elements from the top of the expression stack. May |
- // emit code to affect the physical frame. Does not clobber any registers |
+ // Drop a number of elements from the top of the expression stack. May |
+ // emit code to affect the physical frame. Does not clobber any registers |
// excepting possibly the stack pointer. |
void Drop(int count); |
// Similar to VirtualFrame::Drop but we don't modify the actual stack. |
@@ -348,7 +344,7 @@ |
// Duplicate the top element of the frame. |
void Dup() { PushFrameSlotAt(element_count() - 1); } |
- // Pop an element from the top of the expression stack. Returns a |
+ // Pop an element from the top of the expression stack. Returns a |
// Result, which may be a constant or a register. |
Result Pop(); |
@@ -356,15 +352,15 @@ |
// emit a corresponding pop instruction. |
void EmitPop(Register reg); |
// Same but for multiple registers |
- void EmitMultiPop(RegList regs); // higher indexed registers popped first |
- void EmitMultiPopReversed(RegList regs); // lower first |
+ void EmitMultiPop(RegList regs); |
+ void EmitMultiPopReversed(RegList regs); |
// Push an element on top of the expression stack and emit a |
// corresponding push instruction. |
void EmitPush(Register reg); |
// Same but for multiple registers. |
- void EmitMultiPush(RegList regs); // lower indexed registers are pushed first |
- void EmitMultiPushReversed(RegList regs); // higher first |
+ void EmitMultiPush(RegList regs); |
+ void EmitMultiPushReversed(RegList regs); |
// Push an element on the virtual frame. |
inline void Push(Register reg, NumberInfo info = NumberInfo::Unknown()); |
@@ -384,7 +380,7 @@ |
// Nip removes zero or more elements from immediately below the top |
// of the frame, leaving the previous top-of-frame value on top of |
- // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). |
+ // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). |
inline void Nip(int num_dropped); |
// This pushes 4 arguments slots on the stack and saves asked 'a' registers |
@@ -392,6 +388,7 @@ |
void EmitArgumentSlots(RegList reglist); |
inline void SetTypeForLocalAt(int index, NumberInfo info); |
+ inline void SetTypeForParamAt(int index, NumberInfo info); |
private: |
static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
@@ -416,23 +413,23 @@ |
int local_count() { return cgen()->scope()->num_stack_slots(); } |
// The index of the element that is at the processor's frame pointer |
- // (the fp register). The parameters, receiver, function, and context |
+ // (the fp register). The parameters, receiver, function, and context |
// are below the frame pointer. |
int frame_pointer() { return parameter_count() + 3; } |
- // The index of the first parameter. The receiver lies below the first |
+ // The index of the first parameter. The receiver lies below the first |
// parameter. |
int param0_index() { return 1; } |
- // The index of the context slot in the frame. It is immediately |
+ // The index of the context slot in the frame. It is immediately |
// below the frame pointer. |
int context_index() { return frame_pointer() - 1; } |
- // The index of the function slot in the frame. It is below the frame |
+ // The index of the function slot in the frame. It is below the frame |
// pointer and context slot. |
int function_index() { return frame_pointer() - 2; } |
- // The index of the first local. Between the frame pointer and the |
+ // The index of the first local. Between the frame pointer and the |
// locals lies the return address. |
int local0_index() { return frame_pointer() + 2; } |
@@ -447,7 +444,7 @@ |
return (frame_pointer() - index) * kPointerSize; |
} |
- // Record an occurrence of a register in the virtual frame. This has the |
+ // Record an occurrence of a register in the virtual frame. This has the |
// effect of incrementing the register's external reference count and |
// of updating the index of the register's location in the frame. |
void Use(Register reg, int index) { |
@@ -456,7 +453,7 @@ |
cgen()->allocator()->Use(reg); |
} |
- // Record that a register reference has been dropped from the frame. This |
+ // Record that a register reference has been dropped from the frame. This |
// decrements the register's external reference count and invalidates the |
// index of the register's location in the frame. |
void Unuse(Register reg) { |
@@ -470,7 +467,7 @@ |
// constant. |
void SpillElementAt(int index); |
- // Sync the element at a particular index. If it is a register or |
+ // Sync the element at a particular index. If it is a register or |
// constant that disagrees with the value on the stack, write it to memory. |
// Keep the element type as register or constant, and clear the dirty bit. |
void SyncElementAt(int index); |
@@ -497,7 +494,7 @@ |
void StoreToFrameSlotAt(int index); |
// Spill all elements in registers. Spill the top spilled_args elements |
- // on the frame. Sync all other frame elements. |
+ // on the frame. Sync all other frame elements. |
// Then drop dropped_args elements from the virtual frame, to match |
// the effect of an upcoming call that will drop them from the stack. |
void PrepareForCall(int spilled_args, int dropped_args); |
@@ -518,14 +515,14 @@ |
// Make the memory-to-register and constant-to-register moves |
// needed to make this frame equal the expected frame. |
// Called after all register-to-memory and register-to-register |
- // moves have been made. After this function returns, the frames |
+ // moves have been made. After this function returns, the frames |
// should be equal. |
void MergeMoveMemoryToRegisters(VirtualFrame* expected); |
// Invalidates a frame slot (puts an invalid frame element in it). |
// Copies on the frame are correctly handled, and if this slot was |
// the backing store of copies, the index of the new backing store |
- // is returned. Otherwise, returns kIllegalIndex. |
+ // is returned. Otherwise, returns kIllegalIndex. |
// Register counts are correctly updated. |
int InvalidateFrameSlotAt(int index); |