| 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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 | 1050 |
| 1051 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1051 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1052 ASSERT(locs()->temp(0).reg() == EAX); | 1052 ASSERT(locs()->temp(0).reg() == EAX); |
| 1053 ASSERT(locs()->temp(1).reg() == ECX); | 1053 ASSERT(locs()->temp(1).reg() == ECX); |
| 1054 ASSERT(locs()->temp(2).reg() == EDX); | 1054 ASSERT(locs()->temp(2).reg() == EDX); |
| 1055 Register result = locs()->out().reg(); | 1055 Register result = locs()->out().reg(); |
| 1056 | 1056 |
| 1057 // Push the result place holder initialized to NULL. | 1057 // Push the result place holder initialized to NULL. |
| 1058 __ PushObject(Object::ZoneHandle()); | 1058 __ PushObject(Object::ZoneHandle()); |
| 1059 // Pass a pointer to the first argument in EAX. | 1059 // Pass a pointer to the first argument in EAX. |
| 1060 intptr_t arg_count = argument_count(); | 1060 if (!function().HasOptionalParameters()) { |
| 1061 if (is_native_instance_closure()) { | 1061 __ leal(EAX, Address(EBP, (1 + function().NumParameters()) * kWordSize)); |
| 1062 arg_count += 1; | |
| 1063 } | |
| 1064 if (!has_optional_parameters() && !is_native_instance_closure()) { | |
| 1065 __ leal(EAX, Address(EBP, (1 + arg_count) * kWordSize)); | |
| 1066 } else { | 1062 } else { |
| 1067 __ leal(EAX, | 1063 __ leal(EAX, |
| 1068 Address(EBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); | 1064 Address(EBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
| 1069 } | 1065 } |
| 1070 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 1066 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
| 1071 __ movl(EDX, Immediate(arg_count)); | 1067 __ movl(EDX, Immediate(NativeArguments::ComputeArgcTag(function()))); |
| 1072 compiler->GenerateCall(token_pos(), | 1068 compiler->GenerateCall(token_pos(), |
| 1073 &StubCode::CallNativeCFunctionLabel(), | 1069 &StubCode::CallNativeCFunctionLabel(), |
| 1074 PcDescriptors::kOther, | 1070 PcDescriptors::kOther, |
| 1075 locs()); | 1071 locs()); |
| 1076 __ popl(result); | 1072 __ popl(result); |
| 1077 } | 1073 } |
| 1078 | 1074 |
| 1079 | 1075 |
| 1080 static bool CanBeImmediateIndex(Value* index) { | 1076 static bool CanBeImmediateIndex(Value* index) { |
| 1081 if (!index->definition()->IsConstant()) return false; | 1077 if (!index->definition()->IsConstant()) return false; |
| (...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2727 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. | 2723 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. |
| 2728 __ pxor(value, XMM0); | 2724 __ pxor(value, XMM0); |
| 2729 } | 2725 } |
| 2730 | 2726 |
| 2731 | 2727 |
| 2732 } // namespace dart | 2728 } // namespace dart |
| 2733 | 2729 |
| 2734 #undef __ | 2730 #undef __ |
| 2735 | 2731 |
| 2736 #endif // defined TARGET_ARCH_X64 | 2732 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |