Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index 7001c18f34ed129a6a5dc0d96b6b42c472071a0e..9b9ac04222923d8947e4e6cc6e11bd8b4c636ef6 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.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. |
@@ -1102,7 +1105,6 @@ LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { |
- ++argument_count_; |
LOperand* argument = UseOrConstant(instr->argument()); |
return new(zone()) LPushArgument(argument); |
} |
@@ -1168,14 +1170,12 @@ LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
LInstruction* LChunkBuilder::DoCallConstantFunction( |
HCallConstantFunction* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr); |
} |
LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
LOperand* function = UseFixed(instr->function(), rdi); |
- argument_count_ -= instr->argument_count(); |
LInvokeFunction* result = new(zone()) LInvokeFunction(function); |
return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
} |
@@ -1277,33 +1277,28 @@ LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
ASSERT(instr->key()->representation().IsTagged()); |
LOperand* key = UseFixed(instr->key(), rcx); |
- argument_count_ -= instr->argument_count(); |
LCallKeyed* result = new(zone()) LCallKeyed(key); |
return MarkAsCall(DefineFixed(result, rax), instr); |
} |
LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallNamed, rax), instr); |
} |
LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, rax), instr); |
} |
LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr); |
} |
LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
LOperand* constructor = UseFixed(instr->constructor(), rdi); |
- argument_count_ -= instr->argument_count(); |
LCallNew* result = new(zone()) LCallNew(constructor); |
return MarkAsCall(DefineFixed(result, rax), instr); |
} |
@@ -1311,7 +1306,6 @@ LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
LOperand* constructor = UseFixed(instr->constructor(), rdi); |
- argument_count_ -= instr->argument_count(); |
LCallNewArray* result = new(zone()) LCallNewArray(constructor); |
return MarkAsCall(DefineFixed(result, rax), instr); |
} |
@@ -1319,14 +1313,12 @@ LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
LOperand* function = UseFixed(instr->function(), rdi); |
- argument_count_ -= instr->argument_count(); |
LCallFunction* result = new(zone()) LCallFunction(function); |
return MarkAsCall(DefineFixed(result, rax), instr); |
} |
LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, rax), instr); |
} |
@@ -2396,7 +2388,6 @@ LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
- argument_count_ -= instr->argument_count(); |
return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr); |
} |
@@ -2518,7 +2509,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()-> |