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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 482 |
483 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 483 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
484 ASSERT(locs()->temp(0).reg() == RAX); | 484 ASSERT(locs()->temp(0).reg() == RAX); |
485 ASSERT(locs()->temp(1).reg() == RBX); | 485 ASSERT(locs()->temp(1).reg() == RBX); |
486 ASSERT(locs()->temp(2).reg() == R10); | 486 ASSERT(locs()->temp(2).reg() == R10); |
487 Register result = locs()->out().reg(); | 487 Register result = locs()->out().reg(); |
488 | 488 |
489 // Push the result place holder initialized to NULL. | 489 // Push the result place holder initialized to NULL. |
490 __ PushObject(Object::ZoneHandle()); | 490 __ PushObject(Object::ZoneHandle()); |
491 // Pass a pointer to the first argument in RAX. | 491 // Pass a pointer to the first argument in RAX. |
492 if (!has_optional_parameters()) { | 492 intptr_t arg_count = argument_count(); |
493 __ leaq(RAX, Address(RBP, (1 + argument_count()) * kWordSize)); | 493 if (is_implicit_native_closure()) { |
| 494 arg_count += 1; |
| 495 } |
| 496 if (!has_optional_parameters() && !is_implicit_native_closure()) { |
| 497 __ leaq(RAX, Address(RBP, (1 + arg_count) * kWordSize)); |
494 } else { | 498 } else { |
495 __ leaq(RAX, | 499 __ leaq(RAX, |
496 Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); | 500 Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
497 } | 501 } |
498 __ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 502 __ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
499 __ movq(R10, Immediate(argument_count())); | 503 __ movq(R10, Immediate(arg_count)); |
500 compiler->GenerateCall(token_index(), | 504 compiler->GenerateCall(token_index(), |
501 try_index(), | 505 try_index(), |
502 &StubCode::CallNativeCFunctionLabel(), | 506 &StubCode::CallNativeCFunctionLabel(), |
503 PcDescriptors::kOther); | 507 PcDescriptors::kOther); |
504 __ popq(result); | 508 __ popq(result); |
505 } | 509 } |
506 | 510 |
507 | 511 |
508 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { | 512 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { |
509 const intptr_t kNumInputs = 2; | 513 const intptr_t kNumInputs = 2; |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 instance_call()->argument_names()); | 1650 instance_call()->argument_names()); |
1647 } | 1651 } |
1648 __ Bind(&done); | 1652 __ Bind(&done); |
1649 } | 1653 } |
1650 | 1654 |
1651 } // namespace dart | 1655 } // namespace dart |
1652 | 1656 |
1653 #undef __ | 1657 #undef __ |
1654 | 1658 |
1655 #endif // defined TARGET_ARCH_X64 | 1659 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |