| 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(bool, enable_type_checks); | |
| 28 DECLARE_FLAG(int, optimization_counter_threshold); | 26 DECLARE_FLAG(int, optimization_counter_threshold); |
| 29 DECLARE_FLAG(bool, propagate_ic_data); | 27 DECLARE_FLAG(bool, propagate_ic_data); |
| 30 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 28 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 31 DECLARE_FLAG(bool, use_osr); | 29 DECLARE_FLAG(bool, use_osr); |
| 32 | 30 |
| 33 // Generic summary for call instructions that have all arguments pushed | 31 // Generic summary for call instructions that have all arguments pushed |
| 34 // on the stack and return the result in a fixed register RAX. | 32 // on the stack and return the result in a fixed register RAX. |
| 35 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { | 33 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { |
| 36 LocationSummary* result = new(isolate) LocationSummary( | 34 LocationSummary* result = new(isolate) LocationSummary( |
| 37 Isolate::Current(), 0, 0, LocationSummary::kCall); | 35 Isolate::Current(), 0, 0, LocationSummary::kCall); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 322 |
| 325 static void EmitAssertBoolean(Register reg, | 323 static void EmitAssertBoolean(Register reg, |
| 326 intptr_t token_pos, | 324 intptr_t token_pos, |
| 327 intptr_t deopt_id, | 325 intptr_t deopt_id, |
| 328 LocationSummary* locs, | 326 LocationSummary* locs, |
| 329 FlowGraphCompiler* compiler) { | 327 FlowGraphCompiler* compiler) { |
| 330 // Check that the type of the value is allowed in conditional context. | 328 // Check that the type of the value is allowed in conditional context. |
| 331 // Call the runtime if the object is not bool::true or bool::false. | 329 // Call the runtime if the object is not bool::true or bool::false. |
| 332 ASSERT(locs->always_calls()); | 330 ASSERT(locs->always_calls()); |
| 333 Label done; | 331 Label done; |
| 334 | 332 __ CompareObject(reg, Bool::True(), PP); |
| 335 if (FLAG_enable_type_checks) { | 333 __ j(EQUAL, &done, Assembler::kNearJump); |
| 336 __ CompareObject(reg, Bool::True(), PP); | 334 __ CompareObject(reg, Bool::False(), PP); |
| 337 __ j(EQUAL, &done, Assembler::kNearJump); | 335 __ j(EQUAL, &done, Assembler::kNearJump); |
| 338 __ CompareObject(reg, Bool::False(), PP); | |
| 339 __ j(EQUAL, &done, Assembler::kNearJump); | |
| 340 } else { | |
| 341 ASSERT(FLAG_enable_asserts); | |
| 342 __ CompareObject(reg, Object::null_instance(), PP); | |
| 343 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | |
| 344 } | |
| 345 | 336 |
| 346 __ pushq(reg); // Push the source object. | 337 __ pushq(reg); // Push the source object. |
| 347 compiler->GenerateRuntimeCall(token_pos, | 338 compiler->GenerateRuntimeCall(token_pos, |
| 348 deopt_id, | 339 deopt_id, |
| 349 kNonBoolTypeErrorRuntimeEntry, | 340 kNonBoolTypeErrorRuntimeEntry, |
| 350 1, | 341 1, |
| 351 locs); | 342 locs); |
| 352 // We should never return here. | 343 // We should never return here. |
| 353 __ int3(); | 344 __ int3(); |
| 354 __ Bind(&done); | 345 __ Bind(&done); |
| (...skipping 6044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6399 __ movq(R10, Immediate(kInvalidObjectPointer)); | 6390 __ movq(R10, Immediate(kInvalidObjectPointer)); |
| 6400 __ movq(RBX, Immediate(kInvalidObjectPointer)); | 6391 __ movq(RBX, Immediate(kInvalidObjectPointer)); |
| 6401 #endif | 6392 #endif |
| 6402 } | 6393 } |
| 6403 | 6394 |
| 6404 } // namespace dart | 6395 } // namespace dart |
| 6405 | 6396 |
| 6406 #undef __ | 6397 #undef __ |
| 6407 | 6398 |
| 6408 #endif // defined TARGET_ARCH_X64 | 6399 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |