| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
| 11 #include "vm/flow_graph.h" | 12 #include "vm/flow_graph.h" |
| 12 #include "vm/flow_graph_compiler.h" | 13 #include "vm/flow_graph_compiler.h" |
| 13 #include "vm/flow_graph_range_analysis.h" | 14 #include "vm/flow_graph_range_analysis.h" |
| 14 #include "vm/locations.h" | 15 #include "vm/locations.h" |
| 15 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
| 16 #include "vm/parser.h" | 17 #include "vm/parser.h" |
| 17 #include "vm/simulator.h" | 18 #include "vm/simulator.h" |
| 18 #include "vm/stack_frame.h" | 19 #include "vm/stack_frame.h" |
| 19 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
| (...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 | 2096 |
| 2096 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2097 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2097 const Register kLengthReg = R2; | 2098 const Register kLengthReg = R2; |
| 2098 const Register kElemTypeReg = R1; | 2099 const Register kElemTypeReg = R1; |
| 2099 const Register kResultReg = R0; | 2100 const Register kResultReg = R0; |
| 2100 | 2101 |
| 2101 ASSERT(locs()->in(kElementTypePos).reg() == kElemTypeReg); | 2102 ASSERT(locs()->in(kElementTypePos).reg() == kElemTypeReg); |
| 2102 ASSERT(locs()->in(kLengthPos).reg() == kLengthReg); | 2103 ASSERT(locs()->in(kLengthPos).reg() == kLengthReg); |
| 2103 | 2104 |
| 2104 if (compiler->is_optimizing() && | 2105 if (compiler->is_optimizing() && |
| 2106 !Compiler::always_optimize() && |
| 2105 num_elements()->BindsToConstant() && | 2107 num_elements()->BindsToConstant() && |
| 2106 num_elements()->BoundConstant().IsSmi()) { | 2108 num_elements()->BoundConstant().IsSmi()) { |
| 2107 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); | 2109 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); |
| 2108 if ((length >= 0) && (length <= Array::kMaxElements)) { | 2110 if ((length >= 0) && (length <= Array::kMaxElements)) { |
| 2109 Label slow_path, done; | 2111 Label slow_path, done; |
| 2110 InlineArrayAllocation(compiler, length, &slow_path, &done); | 2112 InlineArrayAllocation(compiler, length, &slow_path, &done); |
| 2111 __ Bind(&slow_path); | 2113 __ Bind(&slow_path); |
| 2112 __ PushObject(Object::null_object()); // Make room for the result. | 2114 __ PushObject(Object::null_object()); // Make room for the result. |
| 2113 __ Push(kLengthReg); // length. | 2115 __ Push(kLengthReg); // length. |
| 2114 __ Push(kElemTypeReg); | 2116 __ Push(kElemTypeReg); |
| (...skipping 3508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5623 1, | 5625 1, |
| 5624 locs()); | 5626 locs()); |
| 5625 __ Drop(1); | 5627 __ Drop(1); |
| 5626 __ Pop(result); | 5628 __ Pop(result); |
| 5627 } | 5629 } |
| 5628 | 5630 |
| 5629 | 5631 |
| 5630 } // namespace dart | 5632 } // namespace dart |
| 5631 | 5633 |
| 5632 #endif // defined TARGET_ARCH_ARM64 | 5634 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |