Revision: 4700
Author: [email protected]
Date: Fri May 21 05:58:02 2010
Log: Revert change 3849. On ia32, LoadFromSlot again returns its result on
the top of the expression stack, not as a Result return value.
Review URL: http://codereview.chromium.org/2121014
http://code.google.com/p/v8/source/detail?r=4700
Modified:
/branches/bleeding_edge/src/ia32/codegen-ia32.cc
/branches/bleeding_edge/src/ia32/codegen-ia32.h
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Thu May 20 07:33:02
2010
+++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Fri May 21 05:58:02
2010
@@ -695,9 +695,7 @@
} else if (variable != NULL && variable->slot() != NULL) {
// For a variable that rewrites to a slot, we signal it is the
immediate
// subexpression of a typeof.
- Result result =
- LoadFromSlotCheckForArguments(variable->slot(), INSIDE_TYPEOF);
- frame()->Push(&result);
+ LoadFromSlotCheckForArguments(variable->slot(), INSIDE_TYPEOF);
} else {
// Anything else can be handled normally.
Load(expr);
@@ -746,7 +744,8 @@
// We have to skip storing into the arguments slot if it has already
// been written to. This can happen if the a function has a local
// variable named 'arguments'.
- Result probe = LoadFromSlot(arguments->slot(), NOT_INSIDE_TYPEOF);
+ LoadFromSlot(arguments->slot(), NOT_INSIDE_TYPEOF);
+ Result probe = frame_->Pop();
if (probe.is_constant()) {
// We have to skip updating the arguments object if it has
// been assigned a proper value.
@@ -3026,9 +3025,7 @@
// Load the receiver and the existing arguments object onto the
// expression stack. Avoid allocating the arguments object here.
Load(receiver);
- Result existing_args =
- LoadFromSlot(scope()->arguments()->var()->slot(), NOT_INSIDE_TYPEOF);
- frame()->Push(&existing_args);
+ LoadFromSlot(scope()->arguments()->var()->slot(), NOT_INSIDE_TYPEOF);
// Emit the source position information after having loaded the
// receiver and the arguments.
@@ -4719,19 +4716,19 @@
}
-Result CodeGenerator::LoadFromSlot(Slot* slot, TypeofState typeof_state) {
- Result result;
+void CodeGenerator::LoadFromSlot(Slot* slot, TypeofState typeof_state) {
if (slot->type() == Slot::LOOKUP) {
ASSERT(slot->var()->is_dynamic());
JumpTarget slow;
JumpTarget done;
+ Result value;
// Generate fast case for loading from slots that correspond to
// local/global variables or arguments unless they are shadowed by
// eval-introduced bindings.
EmitDynamicLoadFromSlotFastCase(slot,
typeof_state,
- &result,
+ &value,
&slow,
&done);
@@ -4743,14 +4740,14 @@
frame()->EmitPush(esi);
frame()->EmitPush(Immediate(slot->var()->name()));
if (typeof_state == INSIDE_TYPEOF) {
- result =
+ value =
frame()->CallRuntime(Runtime::kLoadContextSlotNoReferenceError,
2);
} else {
- result = frame()->CallRuntime(Runtime::kLoadContextSlot, 2);
+ value = frame()->CallRuntime(Runtime::kLoadContextSlot, 2);
}
- done.Bind(&result);
- return result;
+ done.Bind(&value);
+ frame_->Push(&value);
} else if (slot->var()->mode() == Variable::CONST) {
// Const slots may contain 'the hole' value (the constant hasn't been
@@ -4767,15 +4764,13 @@
__ j(not_equal, &exit);
__ mov(ecx, Factory::undefined_value());
__ bind(&exit);
- return Result(ecx);
+ frame()->EmitPush(ecx);
} else if (slot->type() == Slot::PARAMETER) {
frame()->PushParameterAt(slot->index());
- return frame()->Pop();
} else if (slot->type() == Slot::LOCAL) {
frame()->PushLocalAt(slot->index());
- return frame()->Pop();
} else {
// The other remaining slot types (LOOKUP and GLOBAL) cannot reach
@@ -4784,46 +4779,48 @@
// The use of SlotOperand below is safe for an unspilled frame
// because it will always be a context slot.
ASSERT(slot->type() == Slot::CONTEXT);
- result = allocator()->Allocate();
- ASSERT(result.is_valid());
- __ mov(result.reg(), SlotOperand(slot, result.reg()));
- return result;
+ Result temp = allocator()->Allocate();
+ ASSERT(temp.is_valid());
+ __ mov(temp.reg(), SlotOperand(slot, temp.reg()));
+ frame()->Push(&temp);
}
}
-Result CodeGenerator::LoadFromSlotCheckForArguments(Slot* slot,
+void CodeGenerator::LoadFromSlotCheckForArguments(Slot* slot,
TypeofState state) {
- Result result = LoadFromSlot(slot, state);
+ LoadFromSlot(slot, state);
// Bail out quickly if we're not using lazy arguments allocation.
- if (ArgumentsMode() != LAZY_ARGUMENTS_ALLOCATION) return result;
+ if (ArgumentsMode() != LAZY_ARGUMENTS_ALLOCATION) return;
// ... or if the slot isn't a non-parameter arguments slot.
- if (slot->type() == Slot::PARAMETER || !slot->is_arguments()) return
result;
+ if (slot->type() == Slot::PARAMETER || !slot->is_arguments()) return;
// If the loaded value is a constant, we know if the arguments
// object has been lazily loaded yet.
+ Result result = frame()->Pop();
if (result.is_constant()) {
if (result.handle()->IsTheHole()) {
- result.Unuse();
- return StoreArgumentsObject(false);
- } else {
- return result;
- }
- }
-
+ result = StoreArgumentsObject(false);
+ }
+ frame()->Push(&result);
+ return;
+ }
+ ASSERT(result.is_register());
// The loaded value is in a register. If it is the sentinel that
// indicates that we haven't loaded the arguments object yet, we
// need to do it now.
JumpTarget exit;
__ cmp(Operand(result.reg()), Immediate(Factory::the_hole_value()));
- exit.Branch(not_equal, &result);
-
- result.Unuse();
+ frame()->Push(&result);
+ exit.Branch(not_equal);
+
result = StoreArgumentsObject(false);
- exit.Bind(&result);
- return result;
+ frame()->SetElementAt(0, &result);
+ result.Unuse();
+ exit.Bind();
+ return;
}
@@ -5073,8 +5070,7 @@
UNREACHABLE();
}
} else {
- Result result = LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
- frame()->Push(&result);
+ LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
}
}
@@ -5395,8 +5391,7 @@
if (node->is_compound()) {
// For a compound assignment the right-hand side is a binary operation
// between the current property value and the actual right-hand side.
- Result result = LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
- frame()->Push(&result);
+ LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
Load(node->value());
// Perform the binary operation.
@@ -8857,10 +8852,8 @@
Comment cmnt(masm, "[ Load from Slot");
Slot* slot = expression_->AsVariableProxy()->AsVariable()->slot();
ASSERT(slot != NULL);
- Result result =
- cgen_->LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
+ cgen_->LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
if (!persist_after_get_) set_unloaded();
- cgen_->frame()->Push(&result);
break;
}
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.h Thu May 20 07:02:51 2010
+++ /branches/bleeding_edge/src/ia32/codegen-ia32.h Fri May 21 05:58:02 2010
@@ -459,8 +459,8 @@
void LoadWithSafeInt32ModeDisabled(Expression* expr);
// Read a value from a slot and leave it on top of the expression stack.
- Result LoadFromSlot(Slot* slot, TypeofState typeof_state);
- Result LoadFromSlotCheckForArguments(Slot* slot, TypeofState
typeof_state);
+ void LoadFromSlot(Slot* slot, TypeofState typeof_state);
+ void LoadFromSlotCheckForArguments(Slot* slot, TypeofState typeof_state);
Result LoadFromGlobalSlotCheckExtensions(Slot* slot,
TypeofState typeof_state,
JumpTarget* slow);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev