| 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/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/stack_frame.h" | 18 #include "vm/stack_frame.h" |
| 18 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
| 19 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
| (...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2111 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2111 // Allocate the array. R10 = length, RBX = element type. | 2112 // Allocate the array. R10 = length, RBX = element type. |
| 2112 const Register kLengthReg = R10; | 2113 const Register kLengthReg = R10; |
| 2113 const Register kElemTypeReg = RBX; | 2114 const Register kElemTypeReg = RBX; |
| 2114 const Register kResultReg = RAX; | 2115 const Register kResultReg = RAX; |
| 2115 ASSERT(locs()->in(0).reg() == kElemTypeReg); | 2116 ASSERT(locs()->in(0).reg() == kElemTypeReg); |
| 2116 ASSERT(locs()->in(1).reg() == kLengthReg); | 2117 ASSERT(locs()->in(1).reg() == kLengthReg); |
| 2117 | 2118 |
| 2118 Label slow_path, done; | 2119 Label slow_path, done; |
| 2119 if (compiler->is_optimizing() && | 2120 if (compiler->is_optimizing() && |
| 2121 !Compiler::always_optimize() && |
| 2120 num_elements()->BindsToConstant() && | 2122 num_elements()->BindsToConstant() && |
| 2121 num_elements()->BoundConstant().IsSmi()) { | 2123 num_elements()->BoundConstant().IsSmi()) { |
| 2122 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); | 2124 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); |
| 2123 if ((length >= 0) && (length <= Array::kMaxElements)) { | 2125 if ((length >= 0) && (length <= Array::kMaxElements)) { |
| 2124 Label slow_path, done; | 2126 Label slow_path, done; |
| 2125 InlineArrayAllocation(compiler, length, &slow_path, &done); | 2127 InlineArrayAllocation(compiler, length, &slow_path, &done); |
| 2126 __ Bind(&slow_path); | 2128 __ Bind(&slow_path); |
| 2127 __ PushObject(Object::null_object()); // Make room for the result. | 2129 __ PushObject(Object::null_object()); // Make room for the result. |
| 2128 __ pushq(kLengthReg); | 2130 __ pushq(kLengthReg); |
| 2129 __ pushq(kElemTypeReg); | 2131 __ pushq(kElemTypeReg); |
| (...skipping 4323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6453 __ Drop(1); | 6455 __ Drop(1); |
| 6454 __ popq(result); | 6456 __ popq(result); |
| 6455 } | 6457 } |
| 6456 | 6458 |
| 6457 | 6459 |
| 6458 } // namespace dart | 6460 } // namespace dart |
| 6459 | 6461 |
| 6460 #undef __ | 6462 #undef __ |
| 6461 | 6463 |
| 6462 #endif // defined TARGET_ARCH_X64 | 6464 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |