Chromium Code Reviews

Unified Diff: src/compiler/linkage.cc

Issue 1410633006: [turbofan] Implement the call protocol properly for direct calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/compiler/linkage.cc
diff --git a/src/compiler/linkage.cc b/src/compiler/linkage.cc
index 957e4730b802504b65ee7d36dd40d3e9391f7d7f..6bad3c2508843f7ff1254fba1acc33aefafc9620 100644
--- a/src/compiler/linkage.cc
+++ b/src/compiler/linkage.cc
@@ -383,7 +383,9 @@ CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
CallDescriptor::Flags flags) {
const size_t return_count = 1;
const size_t context_count = 1;
- const size_t parameter_count = js_parameter_count + context_count;
+ const size_t num_args_count = 1;
+ const size_t parameter_count =
+ js_parameter_count + num_args_count + context_count;
LocationSignature::Builder locations(zone, return_count, parameter_count);
MachineSignature::Builder types(zone, return_count, parameter_count);
@@ -398,6 +400,10 @@ CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
locations.AddParam(LinkageLocation::ForCallerFrameSlot(spill_slot_index));
types.AddParam(kMachAnyTagged);
}
+ // Add JavaScript call argument count.
Michael Starzinger 2015/11/04 13:43:14 nit: empty newline before this block?
Benedikt Meurer 2015/11/04 13:51:09 Done.
+ locations.AddParam(regloc(kJavaScriptCallArgCountRegister));
+ types.AddParam(kMachInt32);
+
// Add context.
locations.AddParam(regloc(kContextRegister));
types.AddParam(kMachAnyTagged);
@@ -544,8 +550,9 @@ LinkageLocation Linkage::GetOsrValueLocation(int index) const {
if (index == kOsrContextSpillSlotIndex) {
// Context. Use the parameter location of the context spill slot.
- // Parameter (arity + 1) is special for the context of the function frame.
- int context_index = 1 + 1 + parameter_count; // target + receiver + params
+ // Parameter (arity + 2) is special for the context of the function frame.
+ int context_index =
+ 1 + 1 + 1 + parameter_count; // target + receiver + params + #args
return incoming_->GetInputLocation(context_index);
} else if (index >= first_stack_slot) {
// Local variable stored in this (callee) stack.

Powered by Google App Engine