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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 561 |
562 | 562 |
563 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 563 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
564 ASSERT(locs()->temp(0).reg() == EAX); | 564 ASSERT(locs()->temp(0).reg() == EAX); |
565 ASSERT(locs()->temp(1).reg() == ECX); | 565 ASSERT(locs()->temp(1).reg() == ECX); |
566 ASSERT(locs()->temp(2).reg() == EDX); | 566 ASSERT(locs()->temp(2).reg() == EDX); |
567 Register result = locs()->out().reg(); | 567 Register result = locs()->out().reg(); |
568 // Push the result place holder initialized to NULL. | 568 // Push the result place holder initialized to NULL. |
569 __ PushObject(Object::ZoneHandle()); | 569 __ PushObject(Object::ZoneHandle()); |
570 // Pass a pointer to the first argument in EAX. | 570 // Pass a pointer to the first argument in EAX. |
571 if (!has_optional_parameters()) { | 571 intptr_t arg_count = argument_count(); |
572 __ leal(EAX, Address(EBP, (1 + argument_count()) * kWordSize)); | 572 if (is_native_instance_closure()) { |
| 573 arg_count += 1; |
| 574 } |
| 575 if (!has_optional_parameters() && !is_native_instance_closure()) { |
| 576 __ leal(EAX, Address(EBP, (1 + arg_count) * kWordSize)); |
573 } else { | 577 } else { |
574 __ leal(EAX, | 578 __ leal(EAX, |
575 Address(EBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); | 579 Address(EBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
576 } | 580 } |
577 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 581 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
578 __ movl(EDX, Immediate(argument_count())); | 582 __ movl(EDX, Immediate(arg_count)); |
579 compiler->GenerateCall(token_index(), | 583 compiler->GenerateCall(token_index(), |
580 try_index(), | 584 try_index(), |
581 &StubCode::CallNativeCFunctionLabel(), | 585 &StubCode::CallNativeCFunctionLabel(), |
582 PcDescriptors::kOther); | 586 PcDescriptors::kOther); |
583 __ popl(result); | 587 __ popl(result); |
584 } | 588 } |
585 | 589 |
586 | 590 |
587 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { | 591 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { |
588 const intptr_t kNumInputs = 2; | 592 const intptr_t kNumInputs = 2; |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 } | 1717 } |
1714 __ Bind(&done); | 1718 __ Bind(&done); |
1715 } | 1719 } |
1716 | 1720 |
1717 | 1721 |
1718 } // namespace dart | 1722 } // namespace dart |
1719 | 1723 |
1720 #undef __ | 1724 #undef __ |
1721 | 1725 |
1722 #endif // defined TARGET_ARCH_X64 | 1726 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |