OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 473 |
474 | 474 |
475 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 475 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
476 ASSERT(locs()->temp(0).reg() == EAX); | 476 ASSERT(locs()->temp(0).reg() == EAX); |
477 ASSERT(locs()->temp(1).reg() == ECX); | 477 ASSERT(locs()->temp(1).reg() == ECX); |
478 ASSERT(locs()->temp(2).reg() == EDX); | 478 ASSERT(locs()->temp(2).reg() == EDX); |
479 Register result = locs()->out().reg(); | 479 Register result = locs()->out().reg(); |
480 // Push the result place holder initialized to NULL. | 480 // Push the result place holder initialized to NULL. |
481 __ PushObject(Object::ZoneHandle()); | 481 __ PushObject(Object::ZoneHandle()); |
482 // Pass a pointer to the first argument in EAX. | 482 // Pass a pointer to the first argument in EAX. |
483 if (!has_optional_parameters()) { | 483 intptr_t arg_count = argument_count(); |
484 __ leal(EAX, Address(EBP, (1 + argument_count()) * kWordSize)); | 484 if (is_implicit_native_closure()) { |
| 485 arg_count += 1; |
| 486 } |
| 487 if (!has_optional_parameters() && !is_implicit_native_closure()) { |
| 488 __ leal(EAX, Address(EBP, (1 + arg_count) * kWordSize)); |
485 } else { | 489 } else { |
486 __ leal(EAX, | 490 __ leal(EAX, |
487 Address(EBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); | 491 Address(EBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
488 } | 492 } |
489 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 493 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
490 __ movl(EDX, Immediate(argument_count())); | 494 __ movl(EDX, Immediate(arg_count)); |
491 compiler->GenerateCall(token_index(), | 495 compiler->GenerateCall(token_index(), |
492 try_index(), | 496 try_index(), |
493 &StubCode::CallNativeCFunctionLabel(), | 497 &StubCode::CallNativeCFunctionLabel(), |
494 PcDescriptors::kOther); | 498 PcDescriptors::kOther); |
495 __ popl(result); | 499 __ popl(result); |
496 } | 500 } |
497 | 501 |
498 | 502 |
499 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { | 503 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { |
500 const intptr_t kNumInputs = 2; | 504 const intptr_t kNumInputs = 2; |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 } | 1636 } |
1633 __ Bind(&done); | 1637 __ Bind(&done); |
1634 } | 1638 } |
1635 | 1639 |
1636 | 1640 |
1637 } // namespace dart | 1641 } // namespace dart |
1638 | 1642 |
1639 #undef __ | 1643 #undef __ |
1640 | 1644 |
1641 #endif // defined TARGET_ARCH_X64 | 1645 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |