| 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_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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 722 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 723 ASSERT(locs()->temp(0).reg() == RAX); | 723 ASSERT(locs()->temp(0).reg() == RAX); |
| 724 ASSERT(locs()->temp(1).reg() == RBX); | 724 ASSERT(locs()->temp(1).reg() == RBX); |
| 725 ASSERT(locs()->temp(2).reg() == R10); | 725 ASSERT(locs()->temp(2).reg() == R10); |
| 726 Register result = locs()->out(0).reg(); | 726 Register result = locs()->out(0).reg(); |
| 727 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 727 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
| 728 const bool is_leaf_call = | 728 const bool is_leaf_call = |
| 729 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 729 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
| 730 | 730 |
| 731 // Push the result place holder initialized to NULL. | 731 // Push the result place holder initialized to NULL. |
| 732 __ PushObject(Object::ZoneHandle(), PP); | 732 __ PushObject(Object::null_object(), PP); |
| 733 // Pass a pointer to the first argument in RAX. | 733 // Pass a pointer to the first argument in RAX. |
| 734 if (!function().HasOptionalParameters()) { | 734 if (!function().HasOptionalParameters()) { |
| 735 __ leaq(RAX, Address(RBP, (kParamEndSlotFromFp + | 735 __ leaq(RAX, Address(RBP, (kParamEndSlotFromFp + |
| 736 function().NumParameters()) * kWordSize)); | 736 function().NumParameters()) * kWordSize)); |
| 737 } else { | 737 } else { |
| 738 __ leaq(RAX, | 738 __ leaq(RAX, |
| 739 Address(RBP, kFirstLocalSlotFromFp * kWordSize)); | 739 Address(RBP, kFirstLocalSlotFromFp * kWordSize)); |
| 740 } | 740 } |
| 741 __ LoadImmediate( | 741 __ LoadImmediate( |
| 742 RBX, Immediate(reinterpret_cast<uword>(native_c_function())), PP); | 742 RBX, Immediate(reinterpret_cast<uword>(native_c_function())), PP); |
| (...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 ASSERT(locs()->in(1).reg() == kLengthReg); | 1994 ASSERT(locs()->in(1).reg() == kLengthReg); |
| 1995 | 1995 |
| 1996 Label slow_path, done; | 1996 Label slow_path, done; |
| 1997 if (num_elements()->BindsToConstant() && | 1997 if (num_elements()->BindsToConstant() && |
| 1998 num_elements()->BoundConstant().IsSmi()) { | 1998 num_elements()->BoundConstant().IsSmi()) { |
| 1999 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); | 1999 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); |
| 2000 if ((length >= 0) && (length <= Array::kMaxElements)) { | 2000 if ((length >= 0) && (length <= Array::kMaxElements)) { |
| 2001 Label slow_path, done; | 2001 Label slow_path, done; |
| 2002 InlineArrayAllocation(compiler, length, &slow_path, &done); | 2002 InlineArrayAllocation(compiler, length, &slow_path, &done); |
| 2003 __ Bind(&slow_path); | 2003 __ Bind(&slow_path); |
| 2004 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 2004 __ PushObject(Object::null_object(), PP); // Make room for the result. |
| 2005 __ pushq(kLengthReg); | 2005 __ pushq(kLengthReg); |
| 2006 __ pushq(kElemTypeReg); | 2006 __ pushq(kElemTypeReg); |
| 2007 compiler->GenerateRuntimeCall(token_pos(), | 2007 compiler->GenerateRuntimeCall(token_pos(), |
| 2008 deopt_id(), | 2008 deopt_id(), |
| 2009 kAllocateArrayRuntimeEntry, | 2009 kAllocateArrayRuntimeEntry, |
| 2010 2, | 2010 2, |
| 2011 locs()); | 2011 locs()); |
| 2012 __ Drop(2); | 2012 __ Drop(2); |
| 2013 __ popq(kResultReg); | 2013 __ popq(kResultReg); |
| 2014 __ Bind(&done); | 2014 __ Bind(&done); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2279 return locs; | 2279 return locs; |
| 2280 } | 2280 } |
| 2281 | 2281 |
| 2282 | 2282 |
| 2283 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2283 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2284 Register instantiator_reg = locs()->in(0).reg(); | 2284 Register instantiator_reg = locs()->in(0).reg(); |
| 2285 Register result_reg = locs()->out(0).reg(); | 2285 Register result_reg = locs()->out(0).reg(); |
| 2286 | 2286 |
| 2287 // 'instantiator_reg' is the instantiator TypeArguments object (or null). | 2287 // 'instantiator_reg' is the instantiator TypeArguments object (or null). |
| 2288 // A runtime call to instantiate the type is required. | 2288 // A runtime call to instantiate the type is required. |
| 2289 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 2289 __ PushObject(Object::null_object(), PP); // Make room for the result. |
| 2290 __ PushObject(type(), PP); | 2290 __ PushObject(type(), PP); |
| 2291 __ pushq(instantiator_reg); // Push instantiator type arguments. | 2291 __ pushq(instantiator_reg); // Push instantiator type arguments. |
| 2292 compiler->GenerateRuntimeCall(token_pos(), | 2292 compiler->GenerateRuntimeCall(token_pos(), |
| 2293 deopt_id(), | 2293 deopt_id(), |
| 2294 kInstantiateTypeRuntimeEntry, | 2294 kInstantiateTypeRuntimeEntry, |
| 2295 2, | 2295 2, |
| 2296 locs()); | 2296 locs()); |
| 2297 __ Drop(2); // Drop instantiator and uninstantiated type. | 2297 __ Drop(2); // Drop instantiator and uninstantiated type. |
| 2298 __ popq(result_reg); // Pop instantiated type. | 2298 __ popq(result_reg); // Pop instantiated type. |
| 2299 ASSERT(instantiator_reg == result_reg); | 2299 ASSERT(instantiator_reg == result_reg); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 __ cmpq(RDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator))); | 2350 __ cmpq(RDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator))); |
| 2351 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); | 2351 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
| 2352 __ jmp(&slow_case, Assembler::kNearJump); | 2352 __ jmp(&slow_case, Assembler::kNearJump); |
| 2353 __ Bind(&found); | 2353 __ Bind(&found); |
| 2354 __ movq(RAX, Address(RDI, 1 * kWordSize)); // Cached instantiated args. | 2354 __ movq(RAX, Address(RDI, 1 * kWordSize)); // Cached instantiated args. |
| 2355 __ jmp(&type_arguments_instantiated, Assembler::kNearJump); | 2355 __ jmp(&type_arguments_instantiated, Assembler::kNearJump); |
| 2356 | 2356 |
| 2357 __ Bind(&slow_case); | 2357 __ Bind(&slow_case); |
| 2358 // Instantiate non-null type arguments. | 2358 // Instantiate non-null type arguments. |
| 2359 // A runtime call to instantiate the type arguments is required. | 2359 // A runtime call to instantiate the type arguments is required. |
| 2360 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 2360 __ PushObject(Object::null_object(), PP); // Make room for the result. |
| 2361 __ PushObject(type_arguments(), PP); | 2361 __ PushObject(type_arguments(), PP); |
| 2362 __ pushq(instantiator_reg); // Push instantiator type arguments. | 2362 __ pushq(instantiator_reg); // Push instantiator type arguments. |
| 2363 compiler->GenerateRuntimeCall(token_pos(), | 2363 compiler->GenerateRuntimeCall(token_pos(), |
| 2364 deopt_id(), | 2364 deopt_id(), |
| 2365 kInstantiateTypeArgumentsRuntimeEntry, | 2365 kInstantiateTypeArgumentsRuntimeEntry, |
| 2366 2, | 2366 2, |
| 2367 locs()); | 2367 locs()); |
| 2368 __ Drop(2); // Drop instantiator and uninstantiated type arguments. | 2368 __ Drop(2); // Drop instantiator and uninstantiated type arguments. |
| 2369 __ popq(result_reg); // Pop instantiated type arguments. | 2369 __ popq(result_reg); // Pop instantiated type arguments. |
| 2370 __ Bind(&type_arguments_instantiated); | 2370 __ Bind(&type_arguments_instantiated); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 locs->set_in(0, Location::RegisterLocation(RAX)); | 2406 locs->set_in(0, Location::RegisterLocation(RAX)); |
| 2407 locs->set_out(0, Location::RegisterLocation(RAX)); | 2407 locs->set_out(0, Location::RegisterLocation(RAX)); |
| 2408 return locs; | 2408 return locs; |
| 2409 } | 2409 } |
| 2410 | 2410 |
| 2411 | 2411 |
| 2412 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2412 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2413 Register context_value = locs()->in(0).reg(); | 2413 Register context_value = locs()->in(0).reg(); |
| 2414 Register result = locs()->out(0).reg(); | 2414 Register result = locs()->out(0).reg(); |
| 2415 | 2415 |
| 2416 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 2416 __ PushObject(Object::null_object(), PP); // Make room for the result. |
| 2417 __ pushq(context_value); | 2417 __ pushq(context_value); |
| 2418 compiler->GenerateRuntimeCall(token_pos(), | 2418 compiler->GenerateRuntimeCall(token_pos(), |
| 2419 deopt_id(), | 2419 deopt_id(), |
| 2420 kCloneContextRuntimeEntry, | 2420 kCloneContextRuntimeEntry, |
| 2421 1, | 2421 1, |
| 2422 locs()); | 2422 locs()); |
| 2423 __ popq(result); // Remove argument. | 2423 __ popq(result); // Remove argument. |
| 2424 __ popq(result); // Get result (cloned context). | 2424 __ popq(result); // Get result (cloned context). |
| 2425 } | 2425 } |
| 2426 | 2426 |
| (...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5841 __ movq(R10, Immediate(kInvalidObjectPointer)); | 5841 __ movq(R10, Immediate(kInvalidObjectPointer)); |
| 5842 __ movq(RBX, Immediate(kInvalidObjectPointer)); | 5842 __ movq(RBX, Immediate(kInvalidObjectPointer)); |
| 5843 #endif | 5843 #endif |
| 5844 } | 5844 } |
| 5845 | 5845 |
| 5846 } // namespace dart | 5846 } // namespace dart |
| 5847 | 5847 |
| 5848 #undef __ | 5848 #undef __ |
| 5849 | 5849 |
| 5850 #endif // defined TARGET_ARCH_X64 | 5850 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |