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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| 11 #include "vm/compiler.h" |
11 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
12 #include "vm/flow_graph.h" | 13 #include "vm/flow_graph.h" |
13 #include "vm/flow_graph_compiler.h" | 14 #include "vm/flow_graph_compiler.h" |
14 #include "vm/flow_graph_range_analysis.h" | 15 #include "vm/flow_graph_range_analysis.h" |
15 #include "vm/locations.h" | 16 #include "vm/locations.h" |
16 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
17 #include "vm/parser.h" | 18 #include "vm/parser.h" |
18 #include "vm/simulator.h" | 19 #include "vm/simulator.h" |
19 #include "vm/stack_frame.h" | 20 #include "vm/stack_frame.h" |
20 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 | 2373 |
2373 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2374 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2374 const Register kLengthReg = R2; | 2375 const Register kLengthReg = R2; |
2375 const Register kElemTypeReg = R1; | 2376 const Register kElemTypeReg = R1; |
2376 const Register kResultReg = R0; | 2377 const Register kResultReg = R0; |
2377 | 2378 |
2378 ASSERT(locs()->in(kElementTypePos).reg() == kElemTypeReg); | 2379 ASSERT(locs()->in(kElementTypePos).reg() == kElemTypeReg); |
2379 ASSERT(locs()->in(kLengthPos).reg() == kLengthReg); | 2380 ASSERT(locs()->in(kLengthPos).reg() == kLengthReg); |
2380 | 2381 |
2381 if (compiler->is_optimizing() && | 2382 if (compiler->is_optimizing() && |
| 2383 !Compiler::always_optimize() && |
2382 num_elements()->BindsToConstant() && | 2384 num_elements()->BindsToConstant() && |
2383 num_elements()->BoundConstant().IsSmi()) { | 2385 num_elements()->BoundConstant().IsSmi()) { |
2384 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); | 2386 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); |
2385 if ((length >= 0) && (length <= Array::kMaxElements)) { | 2387 if ((length >= 0) && (length <= Array::kMaxElements)) { |
2386 Label slow_path, done; | 2388 Label slow_path, done; |
2387 InlineArrayAllocation(compiler, length, &slow_path, &done); | 2389 InlineArrayAllocation(compiler, length, &slow_path, &done); |
2388 __ Bind(&slow_path); | 2390 __ Bind(&slow_path); |
2389 __ PushObject(Object::null_object()); // Make room for the result. | 2391 __ PushObject(Object::null_object()); // Make room for the result. |
2390 __ Push(kLengthReg); // length. | 2392 __ Push(kLengthReg); // length. |
2391 __ Push(kElemTypeReg); | 2393 __ Push(kElemTypeReg); |
(...skipping 4469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6861 1, | 6863 1, |
6862 locs()); | 6864 locs()); |
6863 __ Drop(1); | 6865 __ Drop(1); |
6864 __ Pop(result); | 6866 __ Pop(result); |
6865 } | 6867 } |
6866 | 6868 |
6867 | 6869 |
6868 } // namespace dart | 6870 } // namespace dart |
6869 | 6871 |
6870 #endif // defined TARGET_ARCH_ARM | 6872 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |