| 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/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| 11 #include "vm/flow_graph.h" | 11 #include "vm/flow_graph.h" |
| 12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
| 13 #include "vm/flow_graph_range_analysis.h" | 13 #include "vm/flow_graph_range_analysis.h" |
| 14 #include "vm/locations.h" | 14 #include "vm/locations.h" |
| 15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 16 #include "vm/parser.h" | 16 #include "vm/parser.h" |
| 17 #include "vm/stack_frame.h" | 17 #include "vm/stack_frame.h" |
| 18 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
| 19 #include "vm/symbols.h" | 19 #include "vm/symbols.h" |
| 20 | 20 |
| 21 #define __ compiler->assembler()-> | 21 #define __ compiler->assembler()-> |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DECLARE_FLAG(bool, emit_edge_counters); | 25 DECLARE_FLAG(bool, emit_edge_counters); |
| 26 DECLARE_FLAG(bool, enable_asserts); | |
| 27 DECLARE_FLAG(int, optimization_counter_threshold); | 26 DECLARE_FLAG(int, optimization_counter_threshold); |
| 28 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 27 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 29 DECLARE_FLAG(bool, use_osr); | 28 DECLARE_FLAG(bool, use_osr); |
| 30 | 29 |
| 31 // Generic summary for call instructions that have all arguments pushed | 30 // Generic summary for call instructions that have all arguments pushed |
| 32 // on the stack and return the result in a fixed register RAX. | 31 // on the stack and return the result in a fixed register RAX. |
| 33 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { | 32 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { |
| 34 LocationSummary* result = new(zone) LocationSummary( | 33 LocationSummary* result = new(zone) LocationSummary( |
| 35 zone, 0, 0, LocationSummary::kCall); | 34 zone, 0, 0, LocationSummary::kCall); |
| 36 result->set_out(0, Location::RegisterLocation(RAX)); | 35 result->set_out(0, Location::RegisterLocation(RAX)); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 static void EmitAssertBoolean(Register reg, | 322 static void EmitAssertBoolean(Register reg, |
| 324 intptr_t token_pos, | 323 intptr_t token_pos, |
| 325 intptr_t deopt_id, | 324 intptr_t deopt_id, |
| 326 LocationSummary* locs, | 325 LocationSummary* locs, |
| 327 FlowGraphCompiler* compiler) { | 326 FlowGraphCompiler* compiler) { |
| 328 // Check that the type of the value is allowed in conditional context. | 327 // Check that the type of the value is allowed in conditional context. |
| 329 // Call the runtime if the object is not bool::true or bool::false. | 328 // Call the runtime if the object is not bool::true or bool::false. |
| 330 ASSERT(locs->always_calls()); | 329 ASSERT(locs->always_calls()); |
| 331 Label done; | 330 Label done; |
| 332 | 331 |
| 333 if (Isolate::Current()->TypeChecksEnabled()) { | 332 if (Isolate::Current()->flags().type_checks()) { |
| 334 __ CompareObject(reg, Bool::True(), PP); | 333 __ CompareObject(reg, Bool::True(), PP); |
| 335 __ j(EQUAL, &done, Assembler::kNearJump); | 334 __ j(EQUAL, &done, Assembler::kNearJump); |
| 336 __ CompareObject(reg, Bool::False(), PP); | 335 __ CompareObject(reg, Bool::False(), PP); |
| 337 __ j(EQUAL, &done, Assembler::kNearJump); | 336 __ j(EQUAL, &done, Assembler::kNearJump); |
| 338 } else { | 337 } else { |
| 339 ASSERT(FLAG_enable_asserts); | 338 ASSERT(Isolate::Current()->flags().asserts()); |
| 340 __ CompareObject(reg, Object::null_instance(), PP); | 339 __ CompareObject(reg, Object::null_instance(), PP); |
| 341 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 340 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 342 } | 341 } |
| 343 | 342 |
| 344 __ pushq(reg); // Push the source object. | 343 __ pushq(reg); // Push the source object. |
| 345 compiler->GenerateRuntimeCall(token_pos, | 344 compiler->GenerateRuntimeCall(token_pos, |
| 346 deopt_id, | 345 deopt_id, |
| 347 kNonBoolTypeErrorRuntimeEntry, | 346 kNonBoolTypeErrorRuntimeEntry, |
| 348 1, | 347 1, |
| 349 locs); | 348 locs); |
| (...skipping 6109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6459 __ Drop(1); | 6458 __ Drop(1); |
| 6460 __ popq(result); | 6459 __ popq(result); |
| 6461 } | 6460 } |
| 6462 | 6461 |
| 6463 | 6462 |
| 6464 } // namespace dart | 6463 } // namespace dart |
| 6465 | 6464 |
| 6466 #undef __ | 6465 #undef __ |
| 6467 | 6466 |
| 6468 #endif // defined TARGET_ARCH_X64 | 6467 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |