| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 795 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 796 ASSERT(locs()->temp(0).reg() == EAX); | 796 ASSERT(locs()->temp(0).reg() == EAX); |
| 797 ASSERT(locs()->temp(1).reg() == ECX); | 797 ASSERT(locs()->temp(1).reg() == ECX); |
| 798 ASSERT(locs()->temp(2).reg() == EDX); | 798 ASSERT(locs()->temp(2).reg() == EDX); |
| 799 Register result = locs()->out(0).reg(); | 799 Register result = locs()->out(0).reg(); |
| 800 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 800 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
| 801 const bool is_leaf_call = | 801 const bool is_leaf_call = |
| 802 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 802 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
| 803 | 803 |
| 804 // Push the result place holder initialized to NULL. | 804 // Push the result place holder initialized to NULL. |
| 805 __ PushObject(Object::ZoneHandle()); | 805 __ PushObject(Object::null_object()); |
| 806 // Pass a pointer to the first argument in EAX. | 806 // Pass a pointer to the first argument in EAX. |
| 807 if (!function().HasOptionalParameters()) { | 807 if (!function().HasOptionalParameters()) { |
| 808 __ leal(EAX, Address(EBP, (kParamEndSlotFromFp + | 808 __ leal(EAX, Address(EBP, (kParamEndSlotFromFp + |
| 809 function().NumParameters()) * kWordSize)); | 809 function().NumParameters()) * kWordSize)); |
| 810 } else { | 810 } else { |
| 811 __ leal(EAX, Address(EBP, kFirstLocalSlotFromFp * kWordSize)); | 811 __ leal(EAX, Address(EBP, kFirstLocalSlotFromFp * kWordSize)); |
| 812 } | 812 } |
| 813 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 813 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
| 814 __ movl(EDX, Immediate(argc_tag)); | 814 __ movl(EDX, Immediate(argc_tag)); |
| 815 const ExternalLabel* stub_entry = (is_bootstrap_native() || is_leaf_call) ? | 815 const ExternalLabel* stub_entry = (is_bootstrap_native() || is_leaf_call) ? |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 ASSERT(locs()->in(1).reg() == kLengthReg); | 2160 ASSERT(locs()->in(1).reg() == kLengthReg); |
| 2161 | 2161 |
| 2162 Label slow_path, done; | 2162 Label slow_path, done; |
| 2163 if (num_elements()->BindsToConstant() && | 2163 if (num_elements()->BindsToConstant() && |
| 2164 num_elements()->BoundConstant().IsSmi()) { | 2164 num_elements()->BoundConstant().IsSmi()) { |
| 2165 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); | 2165 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); |
| 2166 if ((length >= 0) && (length <= Array::kMaxElements)) { | 2166 if ((length >= 0) && (length <= Array::kMaxElements)) { |
| 2167 Label slow_path, done; | 2167 Label slow_path, done; |
| 2168 InlineArrayAllocation(compiler, length, &slow_path, &done); | 2168 InlineArrayAllocation(compiler, length, &slow_path, &done); |
| 2169 __ Bind(&slow_path); | 2169 __ Bind(&slow_path); |
| 2170 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2170 __ PushObject(Object::null_object()); // Make room for the result. |
| 2171 __ pushl(kLengthReg); | 2171 __ pushl(kLengthReg); |
| 2172 __ pushl(kElemTypeReg); | 2172 __ pushl(kElemTypeReg); |
| 2173 compiler->GenerateRuntimeCall(token_pos(), | 2173 compiler->GenerateRuntimeCall(token_pos(), |
| 2174 deopt_id(), | 2174 deopt_id(), |
| 2175 kAllocateArrayRuntimeEntry, | 2175 kAllocateArrayRuntimeEntry, |
| 2176 2, | 2176 2, |
| 2177 locs()); | 2177 locs()); |
| 2178 __ Drop(2); | 2178 __ Drop(2); |
| 2179 __ popl(kResultReg); | 2179 __ popl(kResultReg); |
| 2180 __ Bind(&done); | 2180 __ Bind(&done); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 return locs; | 2448 return locs; |
| 2449 } | 2449 } |
| 2450 | 2450 |
| 2451 | 2451 |
| 2452 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2452 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2453 Register instantiator_reg = locs()->in(0).reg(); | 2453 Register instantiator_reg = locs()->in(0).reg(); |
| 2454 Register result_reg = locs()->out(0).reg(); | 2454 Register result_reg = locs()->out(0).reg(); |
| 2455 | 2455 |
| 2456 // 'instantiator_reg' is the instantiator TypeArguments object (or null). | 2456 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
| 2457 // A runtime call to instantiate the type is required. | 2457 // A runtime call to instantiate the type is required. |
| 2458 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2458 __ PushObject(Object::null_object()); // Make room for the result. |
| 2459 __ PushObject(type()); | 2459 __ PushObject(type()); |
| 2460 __ pushl(instantiator_reg); // Push instantiator type arguments. | 2460 __ pushl(instantiator_reg); // Push instantiator type arguments. |
| 2461 compiler->GenerateRuntimeCall(token_pos(), | 2461 compiler->GenerateRuntimeCall(token_pos(), |
| 2462 deopt_id(), | 2462 deopt_id(), |
| 2463 kInstantiateTypeRuntimeEntry, | 2463 kInstantiateTypeRuntimeEntry, |
| 2464 2, | 2464 2, |
| 2465 locs()); | 2465 locs()); |
| 2466 __ Drop(2); // Drop instantiator and uninstantiated type. | 2466 __ Drop(2); // Drop instantiator and uninstantiated type. |
| 2467 __ popl(result_reg); // Pop instantiated type. | 2467 __ popl(result_reg); // Pop instantiated type. |
| 2468 ASSERT(instantiator_reg == result_reg); | 2468 ASSERT(instantiator_reg == result_reg); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2520 __ cmpl(EDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator))); | 2520 __ cmpl(EDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator))); |
| 2521 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); | 2521 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
| 2522 __ jmp(&slow_case, Assembler::kNearJump); | 2522 __ jmp(&slow_case, Assembler::kNearJump); |
| 2523 __ Bind(&found); | 2523 __ Bind(&found); |
| 2524 __ movl(EAX, Address(EDI, 1 * kWordSize)); // Cached instantiated args. | 2524 __ movl(EAX, Address(EDI, 1 * kWordSize)); // Cached instantiated args. |
| 2525 __ jmp(&type_arguments_instantiated, Assembler::kNearJump); | 2525 __ jmp(&type_arguments_instantiated, Assembler::kNearJump); |
| 2526 | 2526 |
| 2527 __ Bind(&slow_case); | 2527 __ Bind(&slow_case); |
| 2528 // Instantiate non-null type arguments. | 2528 // Instantiate non-null type arguments. |
| 2529 // A runtime call to instantiate the type arguments is required. | 2529 // A runtime call to instantiate the type arguments is required. |
| 2530 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2530 __ PushObject(Object::null_object()); // Make room for the result. |
| 2531 __ PushObject(type_arguments()); | 2531 __ PushObject(type_arguments()); |
| 2532 __ pushl(instantiator_reg); // Push instantiator type arguments. | 2532 __ pushl(instantiator_reg); // Push instantiator type arguments. |
| 2533 compiler->GenerateRuntimeCall(token_pos(), | 2533 compiler->GenerateRuntimeCall(token_pos(), |
| 2534 deopt_id(), | 2534 deopt_id(), |
| 2535 kInstantiateTypeArgumentsRuntimeEntry, | 2535 kInstantiateTypeArgumentsRuntimeEntry, |
| 2536 2, | 2536 2, |
| 2537 locs()); | 2537 locs()); |
| 2538 __ Drop(2); // Drop instantiator and uninstantiated type arguments. | 2538 __ Drop(2); // Drop instantiator and uninstantiated type arguments. |
| 2539 __ popl(result_reg); // Pop instantiated type arguments. | 2539 __ popl(result_reg); // Pop instantiated type arguments. |
| 2540 __ Bind(&type_arguments_instantiated); | 2540 __ Bind(&type_arguments_instantiated); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 locs->set_in(0, Location::RegisterLocation(EAX)); | 2685 locs->set_in(0, Location::RegisterLocation(EAX)); |
| 2686 locs->set_out(0, Location::RegisterLocation(EAX)); | 2686 locs->set_out(0, Location::RegisterLocation(EAX)); |
| 2687 return locs; | 2687 return locs; |
| 2688 } | 2688 } |
| 2689 | 2689 |
| 2690 | 2690 |
| 2691 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2691 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2692 Register context_value = locs()->in(0).reg(); | 2692 Register context_value = locs()->in(0).reg(); |
| 2693 Register result = locs()->out(0).reg(); | 2693 Register result = locs()->out(0).reg(); |
| 2694 | 2694 |
| 2695 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2695 __ PushObject(Object::null_object()); // Make room for the result. |
| 2696 __ pushl(context_value); | 2696 __ pushl(context_value); |
| 2697 compiler->GenerateRuntimeCall(token_pos(), | 2697 compiler->GenerateRuntimeCall(token_pos(), |
| 2698 deopt_id(), | 2698 deopt_id(), |
| 2699 kCloneContextRuntimeEntry, | 2699 kCloneContextRuntimeEntry, |
| 2700 1, | 2700 1, |
| 2701 locs()); | 2701 locs()); |
| 2702 __ popl(result); // Remove argument. | 2702 __ popl(result); // Remove argument. |
| 2703 __ popl(result); // Get result (cloned context). | 2703 __ popl(result); // Get result (cloned context). |
| 2704 } | 2704 } |
| 2705 | 2705 |
| (...skipping 3629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6335 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6335 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 6336 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6336 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 6337 #endif | 6337 #endif |
| 6338 } | 6338 } |
| 6339 | 6339 |
| 6340 } // namespace dart | 6340 } // namespace dart |
| 6341 | 6341 |
| 6342 #undef __ | 6342 #undef __ |
| 6343 | 6343 |
| 6344 #endif // defined TARGET_ARCH_IA32 | 6344 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |