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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 571 |
572 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 572 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
573 ASSERT(locs()->temp(0).reg() == RAX); | 573 ASSERT(locs()->temp(0).reg() == RAX); |
574 ASSERT(locs()->temp(1).reg() == RBX); | 574 ASSERT(locs()->temp(1).reg() == RBX); |
575 ASSERT(locs()->temp(2).reg() == R10); | 575 ASSERT(locs()->temp(2).reg() == R10); |
576 Register result = locs()->out().reg(); | 576 Register result = locs()->out().reg(); |
577 | 577 |
578 // Push the result place holder initialized to NULL. | 578 // Push the result place holder initialized to NULL. |
579 __ PushObject(Object::ZoneHandle()); | 579 __ PushObject(Object::ZoneHandle()); |
580 // Pass a pointer to the first argument in RAX. | 580 // Pass a pointer to the first argument in RAX. |
581 if (!has_optional_parameters()) { | 581 intptr_t arg_count = argument_count(); |
582 __ leaq(RAX, Address(RBP, (1 + argument_count()) * kWordSize)); | 582 if (is_native_instance_closure()) { |
| 583 arg_count += 1; |
| 584 } |
| 585 if (!has_optional_parameters() && !is_native_instance_closure()) { |
| 586 __ leaq(RAX, Address(RBP, (1 + arg_count) * kWordSize)); |
583 } else { | 587 } else { |
584 __ leaq(RAX, | 588 __ leaq(RAX, |
585 Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); | 589 Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
586 } | 590 } |
587 __ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 591 __ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
588 __ movq(R10, Immediate(argument_count())); | 592 __ movq(R10, Immediate(arg_count)); |
589 compiler->GenerateCall(token_index(), | 593 compiler->GenerateCall(token_index(), |
590 try_index(), | 594 try_index(), |
591 &StubCode::CallNativeCFunctionLabel(), | 595 &StubCode::CallNativeCFunctionLabel(), |
592 PcDescriptors::kOther); | 596 PcDescriptors::kOther); |
593 __ popq(result); | 597 __ popq(result); |
594 } | 598 } |
595 | 599 |
596 | 600 |
597 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { | 601 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { |
598 const intptr_t kNumInputs = 2; | 602 const intptr_t kNumInputs = 2; |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 instance_call()->argument_names()); | 1732 instance_call()->argument_names()); |
1729 } | 1733 } |
1730 __ Bind(&done); | 1734 __ Bind(&done); |
1731 } | 1735 } |
1732 | 1736 |
1733 } // namespace dart | 1737 } // namespace dart |
1734 | 1738 |
1735 #undef __ | 1739 #undef __ |
1736 | 1740 |
1737 #endif // defined TARGET_ARCH_X64 | 1741 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |