| 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 915 |
| 916 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 916 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 917 ASSERT(locs()->temp(0).reg() == RAX); | 917 ASSERT(locs()->temp(0).reg() == RAX); |
| 918 ASSERT(locs()->temp(1).reg() == RBX); | 918 ASSERT(locs()->temp(1).reg() == RBX); |
| 919 ASSERT(locs()->temp(2).reg() == R10); | 919 ASSERT(locs()->temp(2).reg() == R10); |
| 920 Register result = locs()->out().reg(); | 920 Register result = locs()->out().reg(); |
| 921 | 921 |
| 922 // Push the result place holder initialized to NULL. | 922 // Push the result place holder initialized to NULL. |
| 923 __ PushObject(Object::ZoneHandle()); | 923 __ PushObject(Object::ZoneHandle()); |
| 924 // Pass a pointer to the first argument in RAX. | 924 // Pass a pointer to the first argument in RAX. |
| 925 intptr_t arg_count = argument_count(); | 925 if (!function().HasOptionalParameters()) { |
| 926 if (is_native_instance_closure()) { | 926 __ leaq(RAX, Address(RBP, (1 + function().NumParameters()) * kWordSize)); |
| 927 arg_count += 1; | |
| 928 } | |
| 929 if (!has_optional_parameters() && !is_native_instance_closure()) { | |
| 930 __ leaq(RAX, Address(RBP, (1 + arg_count) * kWordSize)); | |
| 931 } else { | 927 } else { |
| 932 __ leaq(RAX, | 928 __ leaq(RAX, |
| 933 Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); | 929 Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
| 934 } | 930 } |
| 935 __ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 931 __ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
| 936 __ movq(R10, Immediate(arg_count)); | 932 __ movq(R10, Immediate(NativeArguments::ComputeArgcTag(function()))); |
| 937 compiler->GenerateCall(token_pos(), | 933 compiler->GenerateCall(token_pos(), |
| 938 &StubCode::CallNativeCFunctionLabel(), | 934 &StubCode::CallNativeCFunctionLabel(), |
| 939 PcDescriptors::kOther, | 935 PcDescriptors::kOther, |
| 940 locs()); | 936 locs()); |
| 941 __ popq(result); | 937 __ popq(result); |
| 942 } | 938 } |
| 943 | 939 |
| 944 | 940 |
| 945 static bool CanBeImmediateIndex(Value* index) { | 941 static bool CanBeImmediateIndex(Value* index) { |
| 946 if (!index->definition()->IsConstant()) return false; | 942 if (!index->definition()->IsConstant()) return false; |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 | 2357 |
| 2362 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2358 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2363 UNIMPLEMENTED(); | 2359 UNIMPLEMENTED(); |
| 2364 } | 2360 } |
| 2365 | 2361 |
| 2366 } // namespace dart | 2362 } // namespace dart |
| 2367 | 2363 |
| 2368 #undef __ | 2364 #undef __ |
| 2369 | 2365 |
| 2370 #endif // defined TARGET_ARCH_X64 | 2366 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |