OLD | NEW |
1 | 1 |
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. | 6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
7 #if defined(TARGET_ARCH_ARM) | 7 #if defined(TARGET_ARCH_ARM) |
8 | 8 |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 | 10 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 346 } |
347 | 347 |
348 | 348 |
349 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, | 349 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, |
350 bool opt) const { | 350 bool opt) const { |
351 const intptr_t kNumInputs = 3; | 351 const intptr_t kNumInputs = 3; |
352 const intptr_t kNumTemps = 0; | 352 const intptr_t kNumTemps = 0; |
353 LocationSummary* summary = new (zone) | 353 LocationSummary* summary = new (zone) |
354 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 354 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
355 summary->set_in(0, Location::RegisterLocation(R0)); // Value. | 355 summary->set_in(0, Location::RegisterLocation(R0)); // Value. |
356 summary->set_in(1, Location::RegisterLocation(R1)); // Instant. type args. | 356 summary->set_in(1, Location::RegisterLocation(R2)); // Instant. type args. |
357 summary->set_in(2, Location::RegisterLocation(R2)); // Function type args. | 357 summary->set_in(2, Location::RegisterLocation(R1)); // Function type args. |
358 summary->set_out(0, Location::RegisterLocation(R0)); | 358 summary->set_out(0, Location::RegisterLocation(R0)); |
359 return summary; | 359 return summary; |
360 } | 360 } |
361 | 361 |
362 | 362 |
363 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, | 363 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, |
364 bool opt) const { | 364 bool opt) const { |
365 const intptr_t kNumInputs = 1; | 365 const intptr_t kNumInputs = 1; |
366 const intptr_t kNumTemps = 0; | 366 const intptr_t kNumTemps = 0; |
367 LocationSummary* locs = new (zone) | 367 LocationSummary* locs = new (zone) |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2363 } | 2363 } |
2364 | 2364 |
2365 | 2365 |
2366 LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, | 2366 LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, |
2367 bool opt) const { | 2367 bool opt) const { |
2368 const intptr_t kNumInputs = 3; | 2368 const intptr_t kNumInputs = 3; |
2369 const intptr_t kNumTemps = 0; | 2369 const intptr_t kNumTemps = 0; |
2370 LocationSummary* summary = new (zone) | 2370 LocationSummary* summary = new (zone) |
2371 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2371 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
2372 summary->set_in(0, Location::RegisterLocation(R0)); // Instance. | 2372 summary->set_in(0, Location::RegisterLocation(R0)); // Instance. |
2373 summary->set_in(1, Location::RegisterLocation(R1)); // Instant. type args. | 2373 summary->set_in(1, Location::RegisterLocation(R2)); // Instant. type args. |
2374 summary->set_in(2, Location::RegisterLocation(R2)); // Function type args. | 2374 summary->set_in(2, Location::RegisterLocation(R1)); // Function type args. |
2375 summary->set_out(0, Location::RegisterLocation(R0)); | 2375 summary->set_out(0, Location::RegisterLocation(R0)); |
2376 return summary; | 2376 return summary; |
2377 } | 2377 } |
2378 | 2378 |
2379 | 2379 |
2380 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2380 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2381 ASSERT(locs()->in(0).reg() == R0); // Value. | 2381 ASSERT(locs()->in(0).reg() == R0); // Value. |
2382 ASSERT(locs()->in(1).reg() == R1); // Instantiator type arguments. | 2382 ASSERT(locs()->in(1).reg() == R2); // Instantiator type arguments. |
2383 ASSERT(locs()->in(2).reg() == R2); // Function type arguments. | 2383 ASSERT(locs()->in(2).reg() == R1); // Function type arguments. |
2384 | 2384 |
2385 compiler->GenerateInstanceOf(token_pos(), deopt_id(), type(), locs()); | 2385 compiler->GenerateInstanceOf(token_pos(), deopt_id(), type(), locs()); |
2386 ASSERT(locs()->out(0).reg() == R0); | 2386 ASSERT(locs()->out(0).reg() == R0); |
2387 } | 2387 } |
2388 | 2388 |
2389 | 2389 |
2390 LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, | 2390 LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, |
2391 bool opt) const { | 2391 bool opt) const { |
2392 const intptr_t kNumInputs = 2; | 2392 const intptr_t kNumInputs = 2; |
2393 const intptr_t kNumTemps = 0; | 2393 const intptr_t kNumTemps = 0; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2622 __ Bind(&done); | 2622 __ Bind(&done); |
2623 } | 2623 } |
2624 | 2624 |
2625 | 2625 |
2626 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, | 2626 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, |
2627 bool opt) const { | 2627 bool opt) const { |
2628 const intptr_t kNumInputs = 2; | 2628 const intptr_t kNumInputs = 2; |
2629 const intptr_t kNumTemps = 0; | 2629 const intptr_t kNumTemps = 0; |
2630 LocationSummary* locs = new (zone) | 2630 LocationSummary* locs = new (zone) |
2631 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2631 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
2632 locs->set_in(0, Location::RegisterLocation(R0)); // Instant. type args. | 2632 locs->set_in(0, Location::RegisterLocation(R1)); // Instant. type args. |
2633 locs->set_in(1, Location::RegisterLocation(R1)); // Function type args. | 2633 locs->set_in(1, Location::RegisterLocation(R0)); // Function type args. |
2634 locs->set_out(0, Location::RegisterLocation(R0)); | 2634 locs->set_out(0, Location::RegisterLocation(R0)); |
2635 return locs; | 2635 return locs; |
2636 } | 2636 } |
2637 | 2637 |
2638 | 2638 |
2639 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2639 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2640 const Register instantiator_type_args_reg = locs()->in(0).reg(); | 2640 const Register instantiator_type_args_reg = locs()->in(0).reg(); |
2641 const Register function_type_args_reg = locs()->in(1).reg(); | 2641 const Register function_type_args_reg = locs()->in(1).reg(); |
2642 const Register result_reg = locs()->out(0).reg(); | 2642 const Register result_reg = locs()->out(0).reg(); |
2643 | 2643 |
2644 // 'instantiator_type_args_reg' is a TypeArguments object (or null). | 2644 // 'instantiator_type_args_reg' is a TypeArguments object (or null). |
2645 // 'function_type_args_reg' is a TypeArguments object (or null). | 2645 // 'function_type_args_reg' is a TypeArguments object (or null). |
2646 // A runtime call to instantiate the type is required. | 2646 // A runtime call to instantiate the type is required. |
2647 __ PushObject(Object::null_object()); // Make room for the result. | 2647 __ PushObject(Object::null_object()); // Make room for the result. |
2648 __ PushObject(type()); | 2648 __ PushObject(type()); |
2649 __ Push(instantiator_type_args_reg); // Push instantiator type arguments. | 2649 __ PushList((1 << instantiator_type_args_reg) | |
2650 __ Push(function_type_args_reg); // Push function type arguments. | 2650 (1 << function_type_args_reg)); |
2651 // TODO(regis): Renumber registers and use PushList. | |
2652 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), | 2651 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), |
2653 kInstantiateTypeRuntimeEntry, 3, locs()); | 2652 kInstantiateTypeRuntimeEntry, 3, locs()); |
2654 __ Drop(3); // Drop 2 type argument vectors and uninstantiated type. | 2653 __ Drop(3); // Drop 2 type argument vectors and uninstantiated type. |
2655 __ Pop(result_reg); // Pop instantiated type. | 2654 __ Pop(result_reg); // Pop instantiated type. |
2656 ASSERT(instantiator_type_args_reg == result_reg); | |
2657 } | 2655 } |
2658 | 2656 |
2659 | 2657 |
2660 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( | 2658 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( |
2661 Zone* zone, | 2659 Zone* zone, |
2662 bool opt) const { | 2660 bool opt) const { |
2663 const intptr_t kNumInputs = 2; | 2661 const intptr_t kNumInputs = 2; |
2664 const intptr_t kNumTemps = 0; | 2662 const intptr_t kNumTemps = 0; |
2665 LocationSummary* locs = new (zone) | 2663 LocationSummary* locs = new (zone) |
2666 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2664 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
2667 locs->set_in(0, Location::RegisterLocation(R0)); // Instant. type args. | 2665 locs->set_in(0, Location::RegisterLocation(R1)); // Instant. type args. |
2668 locs->set_in(1, Location::RegisterLocation(R1)); // Function type args. | 2666 locs->set_in(1, Location::RegisterLocation(R0)); // Function type args. |
2669 locs->set_out(0, Location::RegisterLocation(R0)); | 2667 locs->set_out(0, Location::RegisterLocation(R0)); |
2670 return locs; | 2668 return locs; |
2671 } | 2669 } |
2672 | 2670 |
2673 | 2671 |
2674 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 2672 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
2675 FlowGraphCompiler* compiler) { | 2673 FlowGraphCompiler* compiler) { |
2676 const Register instantiator_type_args_reg = locs()->in(0).reg(); | 2674 const Register instantiator_type_args_reg = locs()->in(0).reg(); |
2677 const Register function_type_args_reg = locs()->in(1).reg(); | 2675 const Register function_type_args_reg = locs()->in(1).reg(); |
2678 const Register result_reg = locs()->out(0).reg(); | 2676 const Register result_reg = locs()->out(0).reg(); |
2679 ASSERT(instantiator_type_args_reg == R0); | 2677 ASSERT(instantiator_type_args_reg == R1); |
2680 ASSERT(function_type_args_reg == R1); | 2678 ASSERT(function_type_args_reg == R0); |
2681 ASSERT(instantiator_type_args_reg == result_reg); | |
2682 | 2679 |
2683 // 'instantiator_type_args_reg' is a TypeArguments object (or null). | 2680 // 'instantiator_type_args_reg' is a TypeArguments object (or null). |
2684 // 'function_type_args_reg' is a TypeArguments object (or null). | 2681 // 'function_type_args_reg' is a TypeArguments object (or null). |
2685 ASSERT(!type_arguments().IsUninstantiatedIdentity() && | 2682 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
2686 !type_arguments().CanShareInstantiatorTypeArguments( | 2683 !type_arguments().CanShareInstantiatorTypeArguments( |
2687 instantiator_class())); | 2684 instantiator_class())); |
2688 // If both the instantiator and function type arguments are null and if the | 2685 // If both the instantiator and function type arguments are null and if the |
2689 // type argument vector instantiated from null becomes a vector of dynamic, | 2686 // type argument vector instantiated from null becomes a vector of dynamic, |
2690 // then use null as the type arguments. | 2687 // then use null as the type arguments. |
2691 Label type_arguments_instantiated; | 2688 Label type_arguments_instantiated; |
2692 const intptr_t len = type_arguments().Length(); | 2689 const intptr_t len = type_arguments().Length(); |
2693 if (type_arguments().IsRawWhenInstantiatedFromRaw(len)) { | 2690 if (type_arguments().IsRawWhenInstantiatedFromRaw(len)) { |
2694 __ LoadObject(IP, Object::null_object()); | 2691 __ LoadObject(IP, Object::null_object()); |
2695 __ cmp(instantiator_type_args_reg, Operand(IP)); | 2692 __ cmp(instantiator_type_args_reg, Operand(IP)); |
2696 __ cmp(function_type_args_reg, Operand(IP), EQ); | 2693 __ cmp(function_type_args_reg, Operand(IP), EQ); |
2697 __ b(&type_arguments_instantiated, EQ); | 2694 __ b(&type_arguments_instantiated, EQ); |
| 2695 ASSERT(function_type_args_reg == result_reg); |
2698 } | 2696 } |
2699 | 2697 |
2700 // Lookup cache before calling runtime. | 2698 // Lookup cache before calling runtime. |
2701 // TODO(regis): Consider moving this into a shared stub to reduce | 2699 // TODO(regis): Consider moving this into a shared stub to reduce |
2702 // generated code size. | 2700 // generated code size. |
2703 __ LoadObject(R3, type_arguments()); | 2701 __ LoadObject(R3, type_arguments()); |
2704 __ ldr(R3, FieldAddress(R3, TypeArguments::instantiations_offset())); | 2702 __ ldr(R3, FieldAddress(R3, TypeArguments::instantiations_offset())); |
2705 __ AddImmediate(R3, Array::data_offset() - kHeapObjectTag); | 2703 __ AddImmediate(R3, Array::data_offset() - kHeapObjectTag); |
2706 // The instantiations cache is initialized with Object::zero_array() and is | 2704 // The instantiations cache is initialized with Object::zero_array() and is |
2707 // therefore guaranteed to contain kNoInstantiator. No length check needed. | 2705 // therefore guaranteed to contain kNoInstantiator. No length check needed. |
(...skipping 12 matching lines...) Expand all Loading... |
2720 __ b(&slow_case); | 2718 __ b(&slow_case); |
2721 __ Bind(&found); | 2719 __ Bind(&found); |
2722 __ ldr(result_reg, Address(R3, 2 * kWordSize)); // Cached instantiated args. | 2720 __ ldr(result_reg, Address(R3, 2 * kWordSize)); // Cached instantiated args. |
2723 __ b(&type_arguments_instantiated); | 2721 __ b(&type_arguments_instantiated); |
2724 | 2722 |
2725 __ Bind(&slow_case); | 2723 __ Bind(&slow_case); |
2726 // Instantiate non-null type arguments. | 2724 // Instantiate non-null type arguments. |
2727 // A runtime call to instantiate the type arguments is required. | 2725 // A runtime call to instantiate the type arguments is required. |
2728 __ PushObject(Object::null_object()); // Make room for the result. | 2726 __ PushObject(Object::null_object()); // Make room for the result. |
2729 __ PushObject(type_arguments()); | 2727 __ PushObject(type_arguments()); |
2730 __ Push(instantiator_type_args_reg); // Push instantiator type arguments. | 2728 __ PushList((1 << instantiator_type_args_reg) | |
2731 __ Push(function_type_args_reg); // Push function type arguments. | 2729 (1 << function_type_args_reg)); |
2732 // TODO(regis): Renumber registers and use PushList. | |
2733 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), | 2730 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), |
2734 kInstantiateTypeArgumentsRuntimeEntry, 3, | 2731 kInstantiateTypeArgumentsRuntimeEntry, 3, |
2735 locs()); | 2732 locs()); |
2736 __ Drop(3); // Drop 2 type argument vectors and uninstantiated args. | 2733 __ Drop(3); // Drop 2 type argument vectors and uninstantiated args. |
2737 __ Pop(result_reg); // Pop instantiated type arguments. | 2734 __ Pop(result_reg); // Pop instantiated type arguments. |
2738 __ Bind(&type_arguments_instantiated); | 2735 __ Bind(&type_arguments_instantiated); |
2739 } | 2736 } |
2740 | 2737 |
2741 | 2738 |
2742 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( | 2739 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( |
(...skipping 4541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7284 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), | 7281 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), |
7285 kGrowRegExpStackRuntimeEntry, 1, locs()); | 7282 kGrowRegExpStackRuntimeEntry, 1, locs()); |
7286 __ Drop(1); | 7283 __ Drop(1); |
7287 __ Pop(result); | 7284 __ Pop(result); |
7288 } | 7285 } |
7289 | 7286 |
7290 | 7287 |
7291 } // namespace dart | 7288 } // namespace dart |
7292 | 7289 |
7293 #endif // defined TARGET_ARCH_ARM | 7290 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |