Index: src/ia32/lithium-ia32.cc |
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
index 35892131d16d941475cc4cfac94ee7fbfec5da62..83b413851c086e9333fff657ad40140b66c59378 100644 |
--- a/src/ia32/lithium-ia32.cc |
+++ b/src/ia32/lithium-ia32.cc |
@@ -926,6 +926,9 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) { |
instr = current->CompileToLithium(this); |
} |
+ argument_count_ += current->argument_delta(); |
+ ASSERT(argument_count_ >= 0); |
+ |
if (instr != NULL) { |
// Associate the hydrogen instruction first, since we may need it for |
// the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. |
@@ -1177,7 +1180,6 @@ LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { |
- ++argument_count_; |
LOperand* argument = UseAny(instr->argument()); |
return new(zone()) LPushArgument(argument); |
} |
@@ -1244,7 +1246,6 @@ LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
LInstruction* LChunkBuilder::DoCallConstantFunction( |
HCallConstantFunction* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, eax), instr); |
} |
@@ -1252,7 +1253,6 @@ LInstruction* LChunkBuilder::DoCallConstantFunction( |
LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
LOperand* context = UseFixed(instr->context(), esi); |
LOperand* function = UseFixed(instr->function(), edi); |
- argument_count_ -= instr->argument_count(); |
LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
} |
@@ -1362,7 +1362,6 @@ LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
ASSERT(instr->key()->representation().IsTagged()); |
LOperand* context = UseFixed(instr->context(), esi); |
LOperand* key = UseFixed(instr->key(), ecx); |
- argument_count_ -= instr->argument_count(); |
LCallKeyed* result = new(zone()) LCallKeyed(context, key); |
return MarkAsCall(DefineFixed(result, eax), instr); |
} |
@@ -1370,7 +1369,6 @@ LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
LOperand* context = UseFixed(instr->context(), esi); |
- argument_count_ -= instr->argument_count(); |
LCallNamed* result = new(zone()) LCallNamed(context); |
return MarkAsCall(DefineFixed(result, eax), instr); |
} |
@@ -1378,14 +1376,12 @@ LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
LOperand* context = UseFixed(instr->context(), esi); |
- argument_count_ -= instr->argument_count(); |
LCallGlobal* result = new(zone()) LCallGlobal(context); |
return MarkAsCall(DefineFixed(result, eax), instr); |
} |
LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, eax), instr); |
} |
@@ -1393,7 +1389,6 @@ LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
LOperand* context = UseFixed(instr->context(), esi); |
LOperand* constructor = UseFixed(instr->constructor(), edi); |
- argument_count_ -= instr->argument_count(); |
LCallNew* result = new(zone()) LCallNew(context, constructor); |
return MarkAsCall(DefineFixed(result, eax), instr); |
} |
@@ -1402,7 +1397,6 @@ LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
LOperand* context = UseFixed(instr->context(), esi); |
LOperand* constructor = UseFixed(instr->constructor(), edi); |
- argument_count_ -= instr->argument_count(); |
LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
return MarkAsCall(DefineFixed(result, eax), instr); |
} |
@@ -1411,14 +1405,12 @@ LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
LOperand* context = UseFixed(instr->context(), esi); |
LOperand* function = UseFixed(instr->function(), edi); |
- argument_count_ -= instr->argument_count(); |
LCallFunction* result = new(zone()) LCallFunction(context, function); |
return MarkAsCall(DefineFixed(result, eax), instr); |
} |
LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
- argument_count_ -= instr->argument_count(); |
LOperand* context = UseFixed(instr->context(), esi); |
return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), eax), instr); |
} |
@@ -2577,7 +2569,6 @@ LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
LOperand* context = UseFixed(instr->context(), esi); |
- argument_count_ -= instr->argument_count(); |
LCallStub* result = new(zone()) LCallStub(context); |
return MarkAsCall(DefineFixed(result, eax), instr); |
} |
@@ -2706,7 +2697,7 @@ LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
if (env->entry()->arguments_pushed()) { |
int argument_count = env->arguments_environment()->parameter_count(); |
pop = new(zone()) LDrop(argument_count); |
- argument_count_ -= argument_count; |
+ ASSERT(instr->argument_delta() == -argument_count); |
} |
HEnvironment* outer = current_block_->last_environment()-> |