Index: runtime/vm/flow_graph_compiler_ia32.cc |
=================================================================== |
--- runtime/vm/flow_graph_compiler_ia32.cc (revision 15471) |
+++ runtime/vm/flow_graph_compiler_ia32.cc (working copy) |
@@ -777,41 +777,32 @@ |
// stack. |
__ addl(ESP, Immediate(StackSize() * kWordSize)); |
} |
- // The calls immediately below have empty stackmaps because we have just |
+ // The call below has an empty stackmap because we have just |
// dropped the spill slots. |
BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); |
- if (function.IsClosureFunction()) { |
- // TODO(regis): Call NoSuchMethod with "call" as name of original function. |
- // We do not use GenerateCallRuntime because of the non-standard (empty) |
- // stackmap used here. |
- __ CallRuntime(kClosureArgumentMismatchRuntimeEntry); |
- AddCurrentDescriptor(PcDescriptors::kOther, |
- Isolate::kNoDeoptId, |
- 0); // No token position. |
- } else { |
- // Invoke noSuchMethod function. |
- const int kNumArgsChecked = 1; |
- ICData& ic_data = ICData::ZoneHandle(); |
- ic_data = ICData::New(function, |
- String::Handle(function.name()), |
- Isolate::kNoDeoptId, |
- kNumArgsChecked); |
- __ LoadObject(ECX, ic_data); |
- // EBP - 4 : PC marker, allows easy identification of RawInstruction obj. |
- // EBP : points to previous frame pointer. |
- // EBP + 4 : points to return address. |
- // EBP + 8 : address of last argument (arg n-1). |
- // ESP + 8 + 4*(n-1) : address of first argument (arg 0). |
- // ECX : ic-data. |
- // EDX : arguments descriptor array. |
- __ call(&StubCode::CallNoSuchMethodFunctionLabel()); |
- } |
+ |
+ // Invoke noSuchMethod function passing the original name of the function. |
+ // If the function is a closure function, use "call" as the original name. |
+ const String& name = String::Handle( |
+ function.IsClosureFunction() ? Symbols::Call() : function.name()); |
+ const int kNumArgsChecked = 1; |
+ const ICData& ic_data = ICData::ZoneHandle( |
+ ICData::New(function, name, Isolate::kNoDeoptId, kNumArgsChecked)); |
+ __ LoadObject(ECX, ic_data); |
+ // EBP - 4 : PC marker, allows easy identification of RawInstruction obj. |
+ // EBP : points to previous frame pointer. |
+ // EBP + 4 : points to return address. |
+ // EBP + 8 : address of last argument (arg n-1). |
+ // ESP + 8 + 4*(n-1) : address of first argument (arg 0). |
+ // ECX : ic-data. |
+ // EDX : arguments descriptor array. |
+ __ call(&StubCode::CallNoSuchMethodFunctionLabel()); |
if (is_optimizing()) { |
stackmap_table_builder_->AddEntry(assembler()->CodeSize(), |
empty_stack_bitmap, |
0); // No registers. |
} |
- |
+ // The noSuchMethod call may return. |
__ LeaveFrame(); |
__ ret(); |
@@ -912,11 +903,38 @@ |
__ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params))); |
__ j(EQUAL, &argc_in_range, Assembler::kNearJump); |
if (function.IsClosureFunction()) { |
- // TODO(regis): Call NoSuchMethod with "call" as name of original |
- // function. |
- GenerateCallRuntime(function.token_pos(), |
- kClosureArgumentMismatchRuntimeEntry, |
- prologue_locs); |
+ if (StackSize() != 0) { |
+ // We need to unwind the space we reserved for locals and copied |
+ // parameters. The NoSuchMethodFunction stub does not expect to see |
+ // that area on the stack. |
+ __ addl(ESP, Immediate(StackSize() * kWordSize)); |
+ } |
+ // The call below has an empty stackmap because we have just |
+ // dropped the spill slots. |
+ BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); |
+ |
+ // Invoke noSuchMethod function passing "call" as the function name. |
+ const String& name = String::Handle(Symbols::Call()); |
+ const int kNumArgsChecked = 1; |
+ const ICData& ic_data = ICData::ZoneHandle( |
+ ICData::New(function, name, Isolate::kNoDeoptId, kNumArgsChecked)); |
+ __ LoadObject(ECX, ic_data); |
+ // EBP - 4 : PC marker, for easy identification of RawInstruction obj. |
+ // EBP : points to previous frame pointer. |
+ // EBP + 4 : points to return address. |
+ // EBP + 8 : address of last argument (arg n-1). |
+ // ESP + 8 + 4*(n-1) : address of first argument (arg 0). |
+ // ECX : ic-data. |
+ // EDX : arguments descriptor array. |
+ __ call(&StubCode::CallNoSuchMethodFunctionLabel()); |
+ if (is_optimizing()) { |
+ stackmap_table_builder_->AddEntry(assembler()->CodeSize(), |
+ empty_stack_bitmap, |
+ 0); // No registers. |
+ } |
+ // The noSuchMethod call may return. |
+ __ LeaveFrame(); |
+ __ ret(); |
} else { |
__ Stop("Wrong number of arguments"); |
} |