Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: src/ia32/full-codegen-ia32.cc

Issue 8340023: Remove stack height tracking from ia32 non-optimizing code generator. Reverts change 8755. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/full-codegen-ia32.cc
===================================================================
--- src/ia32/full-codegen-ia32.cc (revision 9827)
+++ src/ia32/full-codegen-ia32.cc (working copy)
@@ -169,11 +169,6 @@
}
}
- set_stack_height(2 + scope()->num_stack_slots());
- if (FLAG_verify_stack_height) {
- verify_stack_height();
- }
-
bool function_in_register = true;
// Possibly allocate a local context.
@@ -372,15 +367,6 @@
}
-void FullCodeGenerator::verify_stack_height() {
- ASSERT(FLAG_verify_stack_height);
- __ sub(ebp, Immediate(kPointerSize * stack_height()));
- __ cmp(ebp, esp);
- __ Assert(equal, "Full codegen stack height not as expected.");
- __ add(ebp, Immediate(kPointerSize * stack_height()));
-}
-
-
void FullCodeGenerator::EffectContext::Plug(Variable* var) const {
ASSERT(var->IsStackAllocated() || var->IsContextSlot());
}
@@ -397,7 +383,6 @@
MemOperand operand = codegen()->VarOperand(var, result_register());
// Memory operands can be pushed directly.
__ push(operand);
- codegen()->increment_stack_height();
}
@@ -451,7 +436,6 @@
} else {
__ push(Immediate(lit));
}
- codegen()->increment_stack_height();
}
@@ -489,7 +473,6 @@
Register reg) const {
ASSERT(count > 0);
__ Drop(count);
- codegen()->decrement_stack_height(count);
}
@@ -499,7 +482,6 @@
ASSERT(count > 0);
__ Drop(count);
__ Move(result_register(), reg);
- codegen()->decrement_stack_height(count);
}
@@ -508,7 +490,6 @@
ASSERT(count > 0);
if (count > 1) __ Drop(count - 1);
__ mov(Operand(esp, 0), reg);
- codegen()->decrement_stack_height(count - 1);
}
@@ -520,7 +501,6 @@
__ Move(result_register(), reg);
codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
codegen()->DoTest(this);
- codegen()->decrement_stack_height(count);
}
@@ -554,7 +534,6 @@
__ bind(materialize_false);
__ push(Immediate(isolate()->factory()->false_value()));
__ bind(&done);
- codegen()->increment_stack_height();
}
@@ -582,7 +561,6 @@
? isolate()->factory()->true_value()
: isolate()->factory()->false_value();
__ push(Immediate(value));
- codegen()->increment_stack_height();
}
@@ -784,18 +762,14 @@
// Note: For variables we must not push an initial value (such as
// 'undefined') because we may have a (legal) redeclaration and we
// must not destroy the current value.
- increment_stack_height(3);
if (function != NULL) {
VisitForStackValue(function);
} else if (binding_needs_init) {
__ push(Immediate(isolate()->factory()->the_hole_value()));
- increment_stack_height();
} else {
__ push(Immediate(Smi::FromInt(0))); // Indicates no initial value.
- increment_stack_height();
}
__ CallRuntime(Runtime::kDeclareContextSlot, 4);
- decrement_stack_height(4);
break;
}
}
@@ -820,7 +794,6 @@
Breakable nested_statement(this, stmt);
SetStatementPosition(stmt);
- int switch_clause_stack_height = stack_height();
// Keep the switch value on the stack until a case matches.
VisitForStackValue(stmt->tag());
PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
@@ -885,7 +858,6 @@
__ jmp(default_clause->body_target());
}
- set_stack_height(switch_clause_stack_height);
// Compile all the case bodies.
for (int i = 0; i < clauses->length(); i++) {
Comment cmnt(masm_, "[ Case body");
@@ -927,7 +899,6 @@
__ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
__ bind(&done_convert);
__ push(eax);
- increment_stack_height();
// Check for proxies.
Label call_runtime;
@@ -1025,8 +996,6 @@
__ push(eax); // Fixed array length (as smi).
__ push(Immediate(Smi::FromInt(0))); // Initial index.
- // 1 ~ The object has already been pushed.
- increment_stack_height(ForIn::kElementCount - 1);
// Generate code for doing the condition check.
__ bind(&loop);
__ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index.
@@ -1088,7 +1057,6 @@
__ bind(loop_statement.break_label());
__ add(esp, Immediate(5 * kPointerSize));
- decrement_stack_height(ForIn::kElementCount);
// Exit and decrement the loop depth.
__ bind(&exit);
decrement_loop_depth();
@@ -1410,7 +1378,6 @@
if (!result_saved) {
__ push(eax); // Save result on the stack
result_saved = true;
- increment_stack_height();
}
switch (property->kind()) {
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
@@ -1435,7 +1402,6 @@
// Fall through.
case ObjectLiteral::Property::PROTOTYPE:
__ push(Operand(esp, 0)); // Duplicate receiver.
- increment_stack_height();
VisitForStackValue(key);
VisitForStackValue(value);
if (property->emit_store()) {
@@ -1444,20 +1410,16 @@
} else {
__ Drop(3);
}
- decrement_stack_height(3);
break;
case ObjectLiteral::Property::SETTER:
case ObjectLiteral::Property::GETTER:
__ push(Operand(esp, 0)); // Duplicate receiver.
- increment_stack_height();
VisitForStackValue(key);
__ push(Immediate(property->kind() == ObjectLiteral::Property::SETTER ?
Smi::FromInt(1) :
Smi::FromInt(0)));
- increment_stack_height();
VisitForStackValue(value);
__ CallRuntime(Runtime::kDefineAccessor, 4);
- decrement_stack_height(4);
break;
default: UNREACHABLE();
}
@@ -1532,7 +1494,6 @@
if (!result_saved) {
__ push(eax);
result_saved = true;
- increment_stack_height();
}
VisitForAccumulatorValue(subexpr);
@@ -1610,9 +1571,7 @@
// Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
// on the left-hand side.
if (!expr->target()->IsValidLeftHandSide()) {
- ASSERT(expr->target()->AsThrow() != NULL);
- VisitInCurrentContext(expr->target()); // Throw does not plug the context
- context()->Plug(eax);
+ VisitForEffect(expr->target());
return;
}
@@ -1637,7 +1596,6 @@
// We need the receiver both on the stack and in the accumulator.
VisitForAccumulatorValue(property->obj());
__ push(result_register());
- increment_stack_height();
} else {
VisitForStackValue(property->obj());
}
@@ -1648,7 +1606,6 @@
VisitForAccumulatorValue(property->key());
__ mov(edx, Operand(esp, 0));
__ push(eax);
- increment_stack_height();
} else {
VisitForStackValue(property->obj());
VisitForStackValue(property->key());
@@ -1680,7 +1637,6 @@
Token::Value op = expr->binary_op();
__ push(eax); // Left operand goes on the stack.
- increment_stack_height();
VisitForAccumulatorValue(expr->value());
OverwriteMode mode = expr->value()->ResultOverwriteAllowed()
@@ -1750,7 +1706,6 @@
// stack. Right operand is in eax.
Label smi_case, done, stub_call;
__ pop(edx);
- decrement_stack_height();
__ mov(ecx, eax);
__ or_(eax, edx);
JumpPatchSite patch_site(masm_);
@@ -1842,7 +1797,6 @@
Token::Value op,
OverwriteMode mode) {
__ pop(edx);
- decrement_stack_height();
BinaryOpStub stub(op, mode);
JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
__ call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
@@ -1855,9 +1809,7 @@
// Invalid left-hand sides are rewritten to have a 'throw
// ReferenceError' on the left-hand side.
if (!expr->IsValidLeftHandSide()) {
- ASSERT(expr->AsThrow() != NULL);
- VisitInCurrentContext(expr); // Throw does not plug the context
- context()->Plug(eax);
+ VisitForEffect(expr);
return;
}
@@ -1881,11 +1833,9 @@
}
case NAMED_PROPERTY: {
__ push(eax); // Preserve value.
- increment_stack_height();
VisitForAccumulatorValue(prop->obj());
__ mov(edx, eax);
__ pop(eax); // Restore value.
- decrement_stack_height();
__ mov(ecx, prop->key()->AsLiteral()->handle());
Handle<Code> ic = is_strict_mode()
? isolate()->builtins()->StoreIC_Initialize_Strict()
@@ -1895,14 +1845,11 @@
}
case KEYED_PROPERTY: {
__ push(eax); // Preserve value.
- increment_stack_height();
VisitForStackValue(prop->obj());
VisitForAccumulatorValue(prop->key());
__ mov(ecx, eax);
__ pop(edx);
- decrement_stack_height();
__ pop(eax); // Restore value.
- decrement_stack_height();
Handle<Code> ic = is_strict_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
: isolate()->builtins()->KeyedStoreIC_Initialize();
@@ -2029,7 +1976,6 @@
__ mov(edx, Operand(esp, 0));
} else {
__ pop(edx);
- decrement_stack_height();
}
Handle<Code> ic = is_strict_mode()
? isolate()->builtins()->StoreIC_Initialize_Strict()
@@ -2043,7 +1989,6 @@
__ CallRuntime(Runtime::kToFastProperties, 1);
__ pop(eax);
__ Drop(1);
- decrement_stack_height();
}
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
context()->Plug(eax);
@@ -2065,12 +2010,10 @@
}
__ pop(ecx);
- decrement_stack_height();
if (expr->ends_initialization_block()) {
__ mov(edx, Operand(esp, 0)); // Leave receiver on the stack for later.
} else {
__ pop(edx);
- decrement_stack_height();
}
// Record source code position before IC call.
SetSourcePosition(expr->position());
@@ -2086,7 +2029,6 @@
__ push(edx);
__ CallRuntime(Runtime::kToFastProperties, 1);
__ pop(eax);
- decrement_stack_height();
}
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
@@ -2106,7 +2048,6 @@
VisitForStackValue(expr->obj());
VisitForAccumulatorValue(expr->key());
__ pop(edx);
- decrement_stack_height();
EmitKeyedPropertyLoad(expr);
context()->Plug(eax);
}
@@ -2133,7 +2074,6 @@
RecordJSReturnSite(expr);
// Restore context register.
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- decrement_stack_height(arg_count + 1);
context()->Plug(eax);
}
@@ -2148,7 +2088,6 @@
__ pop(ecx);
__ push(eax);
__ push(ecx);
- increment_stack_height();
// Load the arguments.
ZoneList<Expression*>* args = expr->arguments();
@@ -2167,7 +2106,6 @@
RecordJSReturnSite(expr);
// Restore context register.
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- decrement_stack_height(arg_count + 1);
context()->DropAndPlug(1, eax); // Drop the key still on the stack.
}
@@ -2211,8 +2149,6 @@
RecordJSReturnSite(expr);
// Restore context register.
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
-
- decrement_stack_height(arg_count + 1);
context()->DropAndPlug(1, eax);
}
@@ -2263,7 +2199,7 @@
VisitForStackValue(callee);
// Reserved receiver slot.
__ push(Immediate(isolate()->factory()->undefined_value()));
- increment_stack_height();
+
// Push the arguments.
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));
@@ -2303,13 +2239,11 @@
RecordJSReturnSite(expr);
// Restore context register.
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- decrement_stack_height(arg_count + 1); // Function is left on the stack.
context()->DropAndPlug(1, eax);
} else if (proxy != NULL && proxy->var()->IsUnallocated()) {
// Push global object as receiver for the call IC.
__ push(GlobalObjectOperand());
- increment_stack_height();
EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
@@ -2328,7 +2262,6 @@
__ CallRuntime(Runtime::kLoadContextSlot, 2);
__ push(eax); // Function.
__ push(edx); // Receiver.
- increment_stack_height(2);
// If fast case code has been generated, emit code to push the function
// and receiver and have the slow path jump around this code.
@@ -2336,8 +2269,7 @@
Label call;
__ jmp(&call, Label::kNear);
__ bind(&done);
- // Push function. Stack height already incremented in slow case
- // above.
+ // Push function.
__ push(eax);
// The receiver is implicitly the global receiver. Indicate this by
// passing the hole to the call function stub.
@@ -2370,7 +2302,6 @@
// Load global receiver object.
__ mov(ebx, GlobalObjectOperand());
__ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
- increment_stack_height();
// Emit function call.
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
}
@@ -2411,8 +2342,6 @@
Handle<Code> construct_builtin =
isolate()->builtins()->JSConstructCall();
__ call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
-
- decrement_stack_height(arg_count + 1);
context()->Plug(eax);
}
@@ -2725,7 +2654,6 @@
&if_true, &if_false, &fall_through);
__ pop(ebx);
- decrement_stack_height();
__ cmp(eax, ebx);
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
Split(equal, if_true, if_false, fall_through);
@@ -2844,7 +2772,6 @@
VisitForStackValue(args->at(1));
VisitForStackValue(args->at(2));
__ CallRuntime(Runtime::kLog, 2);
- decrement_stack_height(2);
}
// Finally, we're expected to leave a value on the top of the stack.
__ mov(eax, isolate()->factory()->undefined_value());
@@ -2911,7 +2838,6 @@
VisitForStackValue(args->at(1));
VisitForStackValue(args->at(2));
__ CallStub(&stub);
- decrement_stack_height(3);
context()->Plug(eax);
}
@@ -2925,7 +2851,6 @@
VisitForStackValue(args->at(2));
VisitForStackValue(args->at(3));
__ CallStub(&stub);
- decrement_stack_height(4);
context()->Plug(eax);
}
@@ -2960,7 +2885,6 @@
} else {
__ CallRuntime(Runtime::kMath_pow, 2);
}
- decrement_stack_height(2);
context()->Plug(eax);
}
@@ -2971,7 +2895,6 @@
VisitForStackValue(args->at(0)); // Load the object.
VisitForAccumulatorValue(args->at(1)); // Load the value.
__ pop(ebx); // eax = value. ebx = object.
- decrement_stack_height();
Label done;
// If the object is a smi, return the value.
@@ -3002,7 +2925,6 @@
NumberToStringStub stub;
__ CallStub(&stub);
- decrement_stack_height();
context()->Plug(eax);
}
@@ -3037,7 +2959,6 @@
Register result = edx;
__ pop(object);
- decrement_stack_height();
Label need_conversion;
Label index_out_of_range;
@@ -3086,7 +3007,6 @@
Register result = eax;
__ pop(object);
- decrement_stack_height();
Label need_conversion;
Label index_out_of_range;
@@ -3131,7 +3051,6 @@
StringAddStub stub(NO_STRING_ADD_FLAGS);
__ CallStub(&stub);
- decrement_stack_height(2);
context()->Plug(eax);
}
@@ -3144,7 +3063,6 @@
StringCompareStub stub;
__ CallStub(&stub);
- decrement_stack_height(2);
context()->Plug(eax);
}
@@ -3156,7 +3074,6 @@
ASSERT(args->length() == 1);
VisitForStackValue(args->at(0));
__ CallStub(&stub);
- decrement_stack_height();
context()->Plug(eax);
}
@@ -3168,7 +3085,6 @@
ASSERT(args->length() == 1);
VisitForStackValue(args->at(0));
__ CallStub(&stub);
- decrement_stack_height();
context()->Plug(eax);
}
@@ -3180,7 +3096,6 @@
ASSERT(args->length() == 1);
VisitForStackValue(args->at(0));
__ CallStub(&stub);
- decrement_stack_height();
context()->Plug(eax);
}
@@ -3190,7 +3105,6 @@
ASSERT(args->length() == 1);
VisitForStackValue(args->at(0));
__ CallRuntime(Runtime::kMath_sqrt, 1);
- decrement_stack_height();
context()->Plug(eax);
}
@@ -3210,7 +3124,6 @@
__ InvokeFunction(edi, count, CALL_FUNCTION,
NullCallWrapper(), CALL_AS_METHOD);
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- decrement_stack_height(arg_count + 1);
context()->Plug(eax);
}
@@ -3223,7 +3136,6 @@
VisitForStackValue(args->at(1));
VisitForStackValue(args->at(2));
__ CallStub(&stub);
- decrement_stack_height(3);
context()->Plug(eax);
}
@@ -3316,7 +3228,6 @@
__ CallRuntime(Runtime::kSwapElements, 3);
__ bind(&done);
- decrement_stack_height(3);
context()->Plug(eax);
}
@@ -3402,7 +3313,6 @@
__ mov(eax, Immediate(isolate()->factory()->true_value()));
__ bind(&done);
- decrement_stack_height();
context()->Plug(eax);
}
@@ -3706,7 +3616,6 @@
__ add(esp, Immediate(3 * kPointerSize));
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- decrement_stack_height();
context()->Plug(eax);
}
@@ -3726,7 +3635,6 @@
// Prepare for calling JS runtime function.
__ mov(eax, GlobalObjectOperand());
__ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset));
- increment_stack_height();
}
// Push the arguments ("left-to-right").
@@ -3748,11 +3656,6 @@
// Call the C runtime function.
__ CallRuntime(expr->function(), arg_count);
}
- decrement_stack_height(arg_count);
- if (expr->is_jsruntime()) {
- decrement_stack_height();
- }
-
context()->Plug(eax);
}
@@ -3769,7 +3672,6 @@
VisitForStackValue(property->key());
__ push(Immediate(Smi::FromInt(strict_mode_flag())));
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
- decrement_stack_height(2);
context()->Plug(eax);
} else if (proxy != NULL) {
Variable* var = proxy->var();
@@ -3839,7 +3741,6 @@
VisitForTypeofValue(expr->expression());
}
__ CallRuntime(Runtime::kTypeof, 1);
- decrement_stack_height();
context()->Plug(eax);
break;
}
@@ -3893,10 +3794,7 @@
// Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
// as the left-hand side.
if (!expr->expression()->IsValidLeftHandSide()) {
- ASSERT(expr->expression()->AsThrow() != NULL);
- VisitInCurrentContext(expr->expression());
- // Visiting Throw does not plug the context.
- context()->Plug(eax);
+ VisitForEffect(expr->expression());
return;
}
@@ -3921,20 +3819,17 @@
// Reserve space for result of postfix operation.
if (expr->is_postfix() && !context()->IsEffect()) {
__ push(Immediate(Smi::FromInt(0)));
- increment_stack_height();
}
if (assign_type == NAMED_PROPERTY) {
// Put the object both on the stack and in the accumulator.
VisitForAccumulatorValue(prop->obj());
__ push(eax);
- increment_stack_height();
EmitNamedPropertyLoad(prop);
} else {
VisitForStackValue(prop->obj());
VisitForAccumulatorValue(prop->key());
__ mov(edx, Operand(esp, 0));
__ push(eax);
- increment_stack_height();
EmitKeyedPropertyLoad(prop);
}
}
@@ -3965,7 +3860,6 @@
switch (assign_type) {
case VARIABLE:
__ push(eax);
- increment_stack_height();
break;
case NAMED_PROPERTY:
__ mov(Operand(esp, kPointerSize), eax);
@@ -4039,7 +3933,6 @@
case NAMED_PROPERTY: {
__ mov(ecx, prop->key()->AsLiteral()->handle());
__ pop(edx);
- decrement_stack_height();
Handle<Code> ic = is_strict_mode()
? isolate()->builtins()->StoreIC_Initialize_Strict()
: isolate()->builtins()->StoreIC_Initialize();
@@ -4057,8 +3950,6 @@
case KEYED_PROPERTY: {
__ pop(ecx);
__ pop(edx);
- decrement_stack_height();
- decrement_stack_height();
Handle<Code> ic = is_strict_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
: isolate()->builtins()->KeyedStoreIC_Initialize();
@@ -4211,7 +4102,6 @@
case Token::IN:
VisitForStackValue(expr->right());
__ InvokeBuiltin(Builtins::IN, CALL_FUNCTION);
- decrement_stack_height(2);
PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
__ cmp(eax, isolate()->factory()->true_value());
Split(equal, if_true, if_false, fall_through);
@@ -4221,7 +4111,6 @@
VisitForStackValue(expr->right());
InstanceofStub stub(InstanceofStub::kNoFlags);
__ CallStub(&stub);
- decrement_stack_height(2);
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
__ test(eax, eax);
// The stub returns 0 for true.
@@ -4255,7 +4144,6 @@
UNREACHABLE();
}
__ pop(edx);
- decrement_stack_height();
bool inline_smi_code = ShouldInlineSmiCase(op);
JumpPatchSite patch_site(masm_);
« no previous file with comments | « src/full-codegen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698