| Index: src/ia32/full-codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/full-codegen-ia32.cc (revision 8778)
|
| +++ src/ia32/full-codegen-ia32.cc (working copy)
|
| @@ -166,6 +166,11 @@
|
| }
|
| }
|
|
|
| + 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.
|
| @@ -359,6 +364,15 @@
|
| }
|
|
|
|
|
| +void FullCodeGenerator::verify_stack_height() {
|
| + ASSERT(FLAG_verify_stack_height);
|
| + __ sub(Operand(ebp), Immediate(kPointerSize * stack_height()));
|
| + __ cmp(ebp, Operand(esp));
|
| + __ Assert(equal, "Full codegen stack height not as expected.");
|
| + __ add(Operand(ebp), Immediate(kPointerSize * stack_height()));
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::EffectContext::Plug(Slot* slot) const {
|
| }
|
|
|
| @@ -373,6 +387,7 @@
|
| MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register());
|
| // Memory operands can be pushed directly.
|
| __ push(slot_operand);
|
| + codegen()->increment_stack_height();
|
| }
|
|
|
|
|
| @@ -426,6 +441,7 @@
|
| } else {
|
| __ push(Immediate(lit));
|
| }
|
| + codegen()->increment_stack_height();
|
| }
|
|
|
|
|
| @@ -463,6 +479,7 @@
|
| Register reg) const {
|
| ASSERT(count > 0);
|
| __ Drop(count);
|
| + codegen()->decrement_stack_height(count);
|
| }
|
|
|
|
|
| @@ -472,6 +489,7 @@
|
| ASSERT(count > 0);
|
| __ Drop(count);
|
| __ Move(result_register(), reg);
|
| + codegen()->decrement_stack_height(count);
|
| }
|
|
|
|
|
| @@ -480,6 +498,7 @@
|
| ASSERT(count > 0);
|
| if (count > 1) __ Drop(count - 1);
|
| __ mov(Operand(esp, 0), reg);
|
| + codegen()->decrement_stack_height(count - 1);
|
| }
|
|
|
|
|
| @@ -491,6 +510,7 @@
|
| __ Move(result_register(), reg);
|
| codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
|
| codegen()->DoTest(this);
|
| + codegen()->decrement_stack_height(count);
|
| }
|
|
|
|
|
| @@ -524,6 +544,7 @@
|
| __ bind(materialize_false);
|
| __ push(Immediate(isolate()->factory()->false_value()));
|
| __ bind(&done);
|
| + codegen()->increment_stack_height();
|
| }
|
|
|
|
|
| @@ -551,6 +572,7 @@
|
| ? isolate()->factory()->true_value()
|
| : isolate()->factory()->false_value();
|
| __ push(Immediate(value));
|
| + codegen()->increment_stack_height();
|
| }
|
|
|
|
|
| @@ -573,7 +595,7 @@
|
| Label* fall_through) {
|
| ToBooleanStub stub(result_register());
|
| __ push(result_register());
|
| - __ CallStub(&stub);
|
| + __ CallStub(&stub, condition->test_id());
|
| __ test(result_register(), Operand(result_register()));
|
| // The stub returns nonzero for true.
|
| Split(not_zero, if_true, if_false, fall_through);
|
| @@ -731,14 +753,18 @@
|
| // 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 (mode == Variable::CONST) {
|
| __ push(Immediate(isolate()->factory()->the_hole_value()));
|
| + increment_stack_height();
|
| } else if (function != NULL) {
|
| VisitForStackValue(function);
|
| } else {
|
| __ push(Immediate(Smi::FromInt(0))); // No initial value!
|
| + increment_stack_height();
|
| }
|
| __ CallRuntime(Runtime::kDeclareContextSlot, 4);
|
| + decrement_stack_height(4);
|
| break;
|
| }
|
| }
|
| @@ -753,12 +779,14 @@
|
| // IDs for bailouts from optimized code.
|
| ASSERT(prop->obj()->AsVariableProxy() != NULL);
|
| { AccumulatorValueContext for_object(this);
|
| - EmitVariableLoad(prop->obj()->AsVariableProxy()->var());
|
| + EmitVariableLoad(prop->obj()->AsVariableProxy());
|
| }
|
|
|
| __ push(eax);
|
| + increment_stack_height();
|
| VisitForAccumulatorValue(function);
|
| __ pop(edx);
|
| + decrement_stack_height();
|
|
|
| ASSERT(prop->key()->AsLiteral() != NULL &&
|
| prop->key()->AsLiteral()->handle()->IsSmi());
|
| @@ -794,6 +822,7 @@
|
| 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);
|
| @@ -858,6 +887,7 @@
|
| __ 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");
|
| @@ -899,6 +929,7 @@
|
| __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
|
| __ bind(&done_convert);
|
| __ push(eax);
|
| + increment_stack_height();
|
|
|
| // Check cache validity in generated code. This is a fast case for
|
| // the JSObject::IsSimpleEnum cache validity checks. If we cannot
|
| @@ -982,6 +1013,7 @@
|
| __ push(eax); // Fixed array length (as smi).
|
| __ push(Immediate(Smi::FromInt(0))); // Initial index.
|
|
|
| + increment_stack_height(4);
|
| // Generate code for doing the condition check.
|
| __ bind(&loop);
|
| __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index.
|
| @@ -1037,6 +1069,7 @@
|
| __ bind(loop_statement.break_target());
|
| __ add(Operand(esp), Immediate(5 * kPointerSize));
|
|
|
| + decrement_stack_height(5);
|
| // Exit and decrement the loop depth.
|
| __ bind(&exit);
|
| decrement_loop_depth();
|
| @@ -1073,7 +1106,7 @@
|
|
|
| void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
|
| Comment cmnt(masm_, "[ VariableProxy");
|
| - EmitVariableLoad(expr->var());
|
| + EmitVariableLoad(expr);
|
| }
|
|
|
|
|
| @@ -1223,7 +1256,11 @@
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitVariableLoad(Variable* var) {
|
| +void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
|
| + // Record position before possible IC call.
|
| + SetSourcePosition(proxy->position());
|
| + Variable* var = proxy->var();
|
| +
|
| // Three cases: non-this global variables, lookup slots, and all other
|
| // types of slots.
|
| Slot* slot = var->AsSlot();
|
| @@ -1368,6 +1405,7 @@
|
| if (!result_saved) {
|
| __ push(eax); // Save result on the stack
|
| result_saved = true;
|
| + increment_stack_height();
|
| }
|
| switch (property->kind()) {
|
| case ObjectLiteral::Property::MATERIALIZED_LITERAL:
|
| @@ -1392,6 +1430,7 @@
|
| // Fall through.
|
| case ObjectLiteral::Property::PROTOTYPE:
|
| __ push(Operand(esp, 0)); // Duplicate receiver.
|
| + increment_stack_height();
|
| VisitForStackValue(key);
|
| VisitForStackValue(value);
|
| if (property->emit_store()) {
|
| @@ -1400,16 +1439,20 @@
|
| } 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();
|
| }
|
| @@ -1472,6 +1515,7 @@
|
| if (!result_saved) {
|
| __ push(eax);
|
| result_saved = true;
|
| + increment_stack_height();
|
| }
|
| VisitForAccumulatorValue(subexpr);
|
|
|
| @@ -1500,7 +1544,9 @@
|
| // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
|
| // on the left-hand side.
|
| if (!expr->target()->IsValidLeftHandSide()) {
|
| - VisitForEffect(expr->target());
|
| + ASSERT(expr->target()->AsThrow() != NULL);
|
| + VisitInCurrentContext(expr->target()); // Throw does not plug the context
|
| + context()->Plug(eax);
|
| return;
|
| }
|
|
|
| @@ -1525,6 +1571,7 @@
|
| // 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());
|
| }
|
| @@ -1535,6 +1582,7 @@
|
| VisitForAccumulatorValue(property->key());
|
| __ mov(edx, Operand(esp, 0));
|
| __ push(eax);
|
| + increment_stack_height();
|
| } else {
|
| VisitForStackValue(property->obj());
|
| VisitForStackValue(property->key());
|
| @@ -1546,10 +1594,11 @@
|
| // For compound assignments we need another deoptimization point after the
|
| // variable/property load.
|
| if (expr->is_compound()) {
|
| - { AccumulatorValueContext context(this);
|
| + AccumulatorValueContext result_context(this);
|
| + { AccumulatorValueContext left_operand_context(this);
|
| switch (assign_type) {
|
| case VARIABLE:
|
| - EmitVariableLoad(expr->target()->AsVariableProxy()->var());
|
| + EmitVariableLoad(expr->target()->AsVariableProxy());
|
| PrepareForBailout(expr->target(), TOS_REG);
|
| break;
|
| case NAMED_PROPERTY:
|
| @@ -1565,13 +1614,13 @@
|
|
|
| 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()
|
| ? OVERWRITE_RIGHT
|
| : NO_OVERWRITE;
|
| SetSourcePosition(expr->position() + 1);
|
| - AccumulatorValueContext context(this);
|
| if (ShouldInlineSmiCase(op)) {
|
| EmitInlineSmiBinaryOp(expr->binary_operation(),
|
| op,
|
| @@ -1635,6 +1684,7 @@
|
| // stack. Right operand is in eax.
|
| Label smi_case, done, stub_call;
|
| __ pop(edx);
|
| + decrement_stack_height();
|
| __ mov(ecx, eax);
|
| __ or_(eax, Operand(edx));
|
| JumpPatchSite patch_site(masm_);
|
| @@ -1726,6 +1776,7 @@
|
| 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());
|
| @@ -1738,7 +1789,9 @@
|
| // Invalid left-hand sides are rewritten to have a 'throw
|
| // ReferenceError' on the left-hand side.
|
| if (!expr->IsValidLeftHandSide()) {
|
| - VisitForEffect(expr);
|
| + ASSERT(expr->AsThrow() != NULL);
|
| + VisitInCurrentContext(expr); // Throw does not plug the context
|
| + context()->Plug(eax);
|
| return;
|
| }
|
|
|
| @@ -1762,9 +1815,11 @@
|
| }
|
| 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()
|
| @@ -1774,11 +1829,12 @@
|
| }
|
| case KEYED_PROPERTY: {
|
| __ push(eax); // Preserve value.
|
| + increment_stack_height();
|
| if (prop->is_synthetic()) {
|
| ASSERT(prop->obj()->AsVariableProxy() != NULL);
|
| ASSERT(prop->key()->AsLiteral() != NULL);
|
| { AccumulatorValueContext for_object(this);
|
| - EmitVariableLoad(prop->obj()->AsVariableProxy()->var());
|
| + EmitVariableLoad(prop->obj()->AsVariableProxy());
|
| }
|
| __ mov(edx, eax);
|
| __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle()));
|
| @@ -1787,8 +1843,10 @@
|
| 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();
|
| @@ -1906,6 +1964,7 @@
|
| __ mov(edx, Operand(esp, 0));
|
| } else {
|
| __ pop(edx);
|
| + decrement_stack_height();
|
| }
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->StoreIC_Initialize_Strict()
|
| @@ -1919,6 +1978,7 @@
|
| __ CallRuntime(Runtime::kToFastProperties, 1);
|
| __ pop(eax);
|
| __ Drop(1);
|
| + decrement_stack_height();
|
| }
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| context()->Plug(eax);
|
| @@ -1940,10 +2000,12 @@
|
| }
|
|
|
| __ 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());
|
| @@ -1959,6 +2021,7 @@
|
| __ push(edx);
|
| __ CallRuntime(Runtime::kToFastProperties, 1);
|
| __ pop(eax);
|
| + decrement_stack_height();
|
| }
|
|
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| @@ -1978,6 +2041,7 @@
|
| VisitForStackValue(expr->obj());
|
| VisitForAccumulatorValue(expr->key());
|
| __ pop(edx);
|
| + decrement_stack_height();
|
| EmitKeyedPropertyLoad(expr);
|
| context()->Plug(eax);
|
| }
|
| @@ -2005,6 +2069,7 @@
|
| RecordJSReturnSite(expr);
|
| // Restore context register.
|
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| + decrement_stack_height(arg_count + 1);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -2019,6 +2084,7 @@
|
| __ pop(ecx);
|
| __ push(eax);
|
| __ push(ecx);
|
| + increment_stack_height();
|
|
|
| // Load the arguments.
|
| ZoneList<Expression*>* args = expr->arguments();
|
| @@ -2038,6 +2104,7 @@
|
| 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.
|
| }
|
|
|
| @@ -2059,6 +2126,8 @@
|
| RecordJSReturnSite(expr);
|
| // Restore context register.
|
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| +
|
| + decrement_stack_height(arg_count + 1);
|
| context()->DropAndPlug(1, eax);
|
| }
|
|
|
| @@ -2106,7 +2175,7 @@
|
| VisitForStackValue(fun);
|
| // 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));
|
| @@ -2150,10 +2219,12 @@
|
| 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 (var != NULL && !var->is_this() && var->is_global()) {
|
| // Push global object as receiver for the call IC.
|
| __ push(GlobalObjectOperand());
|
| + increment_stack_height();
|
| EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT);
|
| } else if (var != NULL && var->AsSlot() != NULL &&
|
| var->AsSlot()->type() == Slot::LOOKUP) {
|
| @@ -2176,7 +2247,9 @@
|
| __ push(Immediate(var->name()));
|
| __ CallRuntime(Runtime::kLoadContextSlot, 2);
|
| __ push(eax); // Function.
|
| + increment_stack_height();
|
| __ push(edx); // Receiver.
|
| + increment_stack_height();
|
|
|
| // If fast case code has been generated, emit code to push the
|
| // function and receiver and have the slow path jump around this
|
| @@ -2185,7 +2258,7 @@
|
| Label call;
|
| __ jmp(&call);
|
| __ bind(&done);
|
| - // Push function.
|
| + // Push function. Stack height already incremented in slow case above.
|
| __ push(eax);
|
| // The receiver is implicitly the global receiver. Indicate this
|
| // by passing the hole to the call function stub.
|
| @@ -2231,9 +2304,11 @@
|
| __ call(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| // Push result (function).
|
| __ push(eax);
|
| + increment_stack_height();
|
| // Push Global receiver.
|
| __ mov(ecx, GlobalObjectOperand());
|
| __ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset));
|
| + increment_stack_height();
|
| EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
|
| } else {
|
| { PreservePositionScope scope(masm()->positions_recorder());
|
| @@ -2249,6 +2324,7 @@
|
| // Load global receiver object.
|
| __ mov(ebx, GlobalObjectOperand());
|
| __ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
|
| + increment_stack_height();
|
| // Emit function call.
|
| EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
|
| }
|
| @@ -2289,6 +2365,8 @@
|
| Handle<Code> construct_builtin =
|
| isolate()->builtins()->JSConstructCall();
|
| __ call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
|
| +
|
| + decrement_stack_height(arg_count + 1);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -2601,6 +2679,7 @@
|
| &if_true, &if_false, &fall_through);
|
|
|
| __ pop(ebx);
|
| + decrement_stack_height();
|
| __ cmp(eax, Operand(ebx));
|
| PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| Split(equal, if_true, if_false, fall_through);
|
| @@ -2711,13 +2790,12 @@
|
| // with '%2s' (see Logger::LogRuntime for all the formats).
|
| // 2 (array): Arguments to the format string.
|
| ASSERT_EQ(args->length(), 3);
|
| -#ifdef ENABLE_LOGGING_AND_PROFILING
|
| if (CodeGenerator::ShouldGenerateLog(args->at(0))) {
|
| VisitForStackValue(args->at(1));
|
| VisitForStackValue(args->at(2));
|
| __ CallRuntime(Runtime::kLog, 2);
|
| + decrement_stack_height(2);
|
| }
|
| -#endif
|
| // Finally, we're expected to leave a value on the top of the stack.
|
| __ mov(eax, isolate()->factory()->undefined_value());
|
| context()->Plug(eax);
|
| @@ -2782,6 +2860,7 @@
|
| VisitForStackValue(args->at(1));
|
| VisitForStackValue(args->at(2));
|
| __ CallStub(&stub);
|
| + decrement_stack_height(3);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -2795,6 +2874,7 @@
|
| VisitForStackValue(args->at(2));
|
| VisitForStackValue(args->at(3));
|
| __ CallStub(&stub);
|
| + decrement_stack_height(4);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -2829,6 +2909,7 @@
|
| } else {
|
| __ CallRuntime(Runtime::kMath_pow, 2);
|
| }
|
| + decrement_stack_height(2);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -2839,6 +2920,7 @@
|
| 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.
|
| @@ -2869,6 +2951,7 @@
|
|
|
| NumberToStringStub stub;
|
| __ CallStub(&stub);
|
| + decrement_stack_height();
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -2903,6 +2986,7 @@
|
| Register result = edx;
|
|
|
| __ pop(object);
|
| + decrement_stack_height();
|
|
|
| Label need_conversion;
|
| Label index_out_of_range;
|
| @@ -2951,6 +3035,7 @@
|
| Register result = eax;
|
|
|
| __ pop(object);
|
| + decrement_stack_height();
|
|
|
| Label need_conversion;
|
| Label index_out_of_range;
|
| @@ -2995,6 +3080,7 @@
|
|
|
| StringAddStub stub(NO_STRING_ADD_FLAGS);
|
| __ CallStub(&stub);
|
| + decrement_stack_height(2);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3007,6 +3093,7 @@
|
|
|
| StringCompareStub stub;
|
| __ CallStub(&stub);
|
| + decrement_stack_height(2);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3018,6 +3105,7 @@
|
| ASSERT(args->length() == 1);
|
| VisitForStackValue(args->at(0));
|
| __ CallStub(&stub);
|
| + decrement_stack_height();
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3029,6 +3117,7 @@
|
| ASSERT(args->length() == 1);
|
| VisitForStackValue(args->at(0));
|
| __ CallStub(&stub);
|
| + decrement_stack_height();
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3040,6 +3129,7 @@
|
| ASSERT(args->length() == 1);
|
| VisitForStackValue(args->at(0));
|
| __ CallStub(&stub);
|
| + decrement_stack_height();
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3049,6 +3139,7 @@
|
| ASSERT(args->length() == 1);
|
| VisitForStackValue(args->at(0));
|
| __ CallRuntime(Runtime::kMath_sqrt, 1);
|
| + decrement_stack_height();
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3068,6 +3159,7 @@
|
| __ InvokeFunction(edi, count, CALL_FUNCTION,
|
| NullCallWrapper(), CALL_AS_METHOD);
|
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| + decrement_stack_height(arg_count + 1);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3080,6 +3172,7 @@
|
| VisitForStackValue(args->at(1));
|
| VisitForStackValue(args->at(2));
|
| __ CallStub(&stub);
|
| + decrement_stack_height(3);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3166,6 +3259,7 @@
|
| __ CallRuntime(Runtime::kSwapElements, 3);
|
|
|
| __ bind(&done);
|
| + decrement_stack_height(3);
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3251,6 +3345,7 @@
|
| __ mov(eax, Immediate(isolate()->factory()->true_value()));
|
| __ bind(&done);
|
|
|
| + decrement_stack_height();
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3554,6 +3649,7 @@
|
| __ add(Operand(esp), Immediate(3 * kPointerSize));
|
|
|
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| + decrement_stack_height();
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -3606,6 +3702,7 @@
|
| // Prepare for calling JS runtime function.
|
| __ mov(eax, GlobalObjectOperand());
|
| __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset));
|
| + increment_stack_height();
|
| }
|
|
|
| // Push the arguments ("left-to-right").
|
| @@ -3628,6 +3725,11 @@
|
| // 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);
|
| }
|
|
|
| @@ -3649,6 +3751,7 @@
|
| VisitForStackValue(prop->key());
|
| __ push(Immediate(Smi::FromInt(strict_mode_flag())));
|
| __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
| + decrement_stack_height(2);
|
| context()->Plug(eax);
|
| }
|
| } else if (var != NULL) {
|
| @@ -3718,6 +3821,7 @@
|
| VisitForTypeofValue(expr->expression());
|
| }
|
| __ CallRuntime(Runtime::kTypeof, 1);
|
| + decrement_stack_height();
|
| context()->Plug(eax);
|
| break;
|
| }
|
| @@ -3772,7 +3876,10 @@
|
| // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
|
| // as the left-hand side.
|
| if (!expr->expression()->IsValidLeftHandSide()) {
|
| - VisitForEffect(expr->expression());
|
| + ASSERT(expr->expression()->AsThrow() != NULL);
|
| + VisitInCurrentContext(expr->expression());
|
| + // Visiting Throw does not plug the context.
|
| + context()->Plug(eax);
|
| return;
|
| }
|
|
|
| @@ -3792,22 +3899,25 @@
|
| if (assign_type == VARIABLE) {
|
| ASSERT(expr->expression()->AsVariableProxy()->var() != NULL);
|
| AccumulatorValueContext context(this);
|
| - EmitVariableLoad(expr->expression()->AsVariableProxy()->var());
|
| + EmitVariableLoad(expr->expression()->AsVariableProxy());
|
| } else {
|
| // 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);
|
| }
|
| }
|
| @@ -3838,6 +3948,7 @@
|
| switch (assign_type) {
|
| case VARIABLE:
|
| __ push(eax);
|
| + increment_stack_height();
|
| break;
|
| case NAMED_PROPERTY:
|
| __ mov(Operand(esp, kPointerSize), eax);
|
| @@ -3911,6 +4022,7 @@
|
| 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();
|
| @@ -3928,6 +4040,8 @@
|
| 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();
|
| @@ -4085,6 +4199,7 @@
|
| 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);
|
| @@ -4094,6 +4209,7 @@
|
| VisitForStackValue(expr->right());
|
| InstanceofStub stub(InstanceofStub::kNoFlags);
|
| __ CallStub(&stub);
|
| + decrement_stack_height(2);
|
| PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| __ test(eax, Operand(eax));
|
| // The stub returns 0 for true.
|
| @@ -4138,6 +4254,7 @@
|
| default:
|
| UNREACHABLE();
|
| }
|
| + decrement_stack_height();
|
|
|
| bool inline_smi_code = ShouldInlineSmiCase(op);
|
| JumpPatchSite patch_site(masm_);
|
|
|