| 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" | |
| 11 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| 12 #include "vm/flow_graph.h" | 11 #include "vm/flow_graph.h" |
| 13 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
| 14 #include "vm/flow_graph_range_analysis.h" | 13 #include "vm/flow_graph_range_analysis.h" |
| 15 #include "vm/locations.h" | 14 #include "vm/locations.h" |
| 16 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 17 #include "vm/parser.h" | 16 #include "vm/parser.h" |
| 18 #include "vm/stack_frame.h" | 17 #include "vm/stack_frame.h" |
| 19 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
| 20 #include "vm/symbols.h" | 19 #include "vm/symbols.h" |
| 21 | 20 |
| 22 #define __ compiler->assembler()-> | 21 #define __ compiler->assembler()-> |
| 23 | 22 |
| 24 namespace dart { | 23 namespace dart { |
| 25 | 24 |
| 26 DECLARE_FLAG(bool, allow_absolute_addresses); | 25 DECLARE_FLAG(bool, allow_absolute_addresses); |
| 27 DECLARE_FLAG(bool, emit_edge_counters); | 26 DECLARE_FLAG(bool, emit_edge_counters); |
| 28 DECLARE_FLAG(int, optimization_counter_threshold); | 27 DECLARE_FLAG(int, optimization_counter_threshold); |
| 29 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 28 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 30 DECLARE_FLAG(bool, use_osr); | 29 DECLARE_FLAG(bool, use_osr); |
| 30 DECLARE_FLAG(bool, precompilation); |
| 31 | 31 |
| 32 // Generic summary for call instructions that have all arguments pushed | 32 // Generic summary for call instructions that have all arguments pushed |
| 33 // on the stack and return the result in a fixed register RAX. | 33 // on the stack and return the result in a fixed register RAX. |
| 34 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { | 34 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { |
| 35 LocationSummary* result = new(zone) LocationSummary( | 35 LocationSummary* result = new(zone) LocationSummary( |
| 36 zone, 0, 0, LocationSummary::kCall); | 36 zone, 0, 0, LocationSummary::kCall); |
| 37 result->set_out(0, Location::RegisterLocation(RAX)); | 37 result->set_out(0, Location::RegisterLocation(RAX)); |
| 38 return result; | 38 return result; |
| 39 } | 39 } |
| 40 | 40 |
| (...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2108 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2109 // Allocate the array. R10 = length, RBX = element type. | 2109 // Allocate the array. R10 = length, RBX = element type. |
| 2110 const Register kLengthReg = R10; | 2110 const Register kLengthReg = R10; |
| 2111 const Register kElemTypeReg = RBX; | 2111 const Register kElemTypeReg = RBX; |
| 2112 const Register kResultReg = RAX; | 2112 const Register kResultReg = RAX; |
| 2113 ASSERT(locs()->in(0).reg() == kElemTypeReg); | 2113 ASSERT(locs()->in(0).reg() == kElemTypeReg); |
| 2114 ASSERT(locs()->in(1).reg() == kLengthReg); | 2114 ASSERT(locs()->in(1).reg() == kLengthReg); |
| 2115 | 2115 |
| 2116 Label slow_path, done; | 2116 Label slow_path, done; |
| 2117 if (compiler->is_optimizing() && | 2117 if (compiler->is_optimizing() && |
| 2118 !Compiler::always_optimize() && | 2118 !FLAG_precompilation && |
| 2119 num_elements()->BindsToConstant() && | 2119 num_elements()->BindsToConstant() && |
| 2120 num_elements()->BoundConstant().IsSmi()) { | 2120 num_elements()->BoundConstant().IsSmi()) { |
| 2121 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); | 2121 const intptr_t length = Smi::Cast(num_elements()->BoundConstant()).Value(); |
| 2122 if ((length >= 0) && (length <= Array::kMaxElements)) { | 2122 if ((length >= 0) && (length <= Array::kMaxElements)) { |
| 2123 Label slow_path, done; | 2123 Label slow_path, done; |
| 2124 InlineArrayAllocation(compiler, length, &slow_path, &done); | 2124 InlineArrayAllocation(compiler, length, &slow_path, &done); |
| 2125 __ Bind(&slow_path); | 2125 __ Bind(&slow_path); |
| 2126 __ PushObject(Object::null_object()); // Make room for the result. | 2126 __ PushObject(Object::null_object()); // Make room for the result. |
| 2127 __ pushq(kLengthReg); | 2127 __ pushq(kLengthReg); |
| 2128 __ pushq(kElemTypeReg); | 2128 __ pushq(kElemTypeReg); |
| (...skipping 4323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6452 __ Drop(1); | 6452 __ Drop(1); |
| 6453 __ popq(result); | 6453 __ popq(result); |
| 6454 } | 6454 } |
| 6455 | 6455 |
| 6456 | 6456 |
| 6457 } // namespace dart | 6457 } // namespace dart |
| 6458 | 6458 |
| 6459 #undef __ | 6459 #undef __ |
| 6460 | 6460 |
| 6461 #endif // defined TARGET_ARCH_X64 | 6461 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |