Index: src/arm/lithium-arm.cc |
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc |
index 6c193fe013fdc46c9d73abc02c8b264a2468e07c..b83ee2129bb2d5523dd14d054832204954c70ccf 100644 |
--- a/src/arm/lithium-arm.cc |
+++ b/src/arm/lithium-arm.cc |
@@ -877,6 +877,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. |
@@ -1107,7 +1110,6 @@ LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { |
- ++argument_count_; |
LOperand* argument = Use(instr->argument()); |
return new(zone()) LPushArgument(argument); |
} |
@@ -1174,7 +1176,6 @@ LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
LInstruction* LChunkBuilder::DoCallConstantFunction( |
HCallConstantFunction* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, r0), instr); |
} |
@@ -1182,7 +1183,6 @@ LInstruction* LChunkBuilder::DoCallConstantFunction( |
LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
LOperand* context = UseFixed(instr->context(), cp); |
LOperand* function = UseFixed(instr->function(), r1); |
- argument_count_ -= instr->argument_count(); |
LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
} |
@@ -1291,7 +1291,6 @@ LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
ASSERT(instr->key()->representation().IsTagged()); |
LOperand* context = UseFixed(instr->context(), cp); |
- argument_count_ -= instr->argument_count(); |
LOperand* key = UseFixed(instr->key(), r2); |
return MarkAsCall( |
DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr); |
@@ -1300,20 +1299,17 @@ LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
LOperand* context = UseFixed(instr->context(), cp); |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), r0), instr); |
} |
LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
LOperand* context = UseFixed(instr->context(), cp); |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), r0), instr); |
} |
LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, r0), instr); |
} |
@@ -1321,7 +1317,6 @@ LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
LOperand* context = UseFixed(instr->context(), cp); |
LOperand* constructor = UseFixed(instr->constructor(), r1); |
- argument_count_ -= instr->argument_count(); |
LCallNew* result = new(zone()) LCallNew(context, constructor); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
@@ -1330,7 +1325,6 @@ LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
LOperand* context = UseFixed(instr->context(), cp); |
LOperand* constructor = UseFixed(instr->constructor(), r1); |
- argument_count_ -= instr->argument_count(); |
LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
@@ -1339,14 +1333,12 @@ LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
LOperand* context = UseFixed(instr->context(), cp); |
LOperand* function = UseFixed(instr->function(), r1); |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall( |
DefineFixed(new(zone()) LCallFunction(context, function), r0), instr); |
} |
LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
- argument_count_ -= instr->argument_count(); |
LOperand* context = UseFixed(instr->context(), cp); |
return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), r0), instr); |
} |
@@ -2517,7 +2509,6 @@ LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
LOperand* context = UseFixed(instr->context(), cp); |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), r0), instr); |
} |
@@ -2642,7 +2633,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()-> |