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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "lib/error.h" | 10 #include "lib/error.h" |
11 #include "vm/ast_printer.h" | 11 #include "vm/ast_printer.h" |
12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
13 #include "vm/il_printer.h" | 13 #include "vm/il_printer.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/stub_code.h" | 17 #include "vm/stub_code.h" |
18 #include "vm/symbols.h" | 18 #include "vm/symbols.h" |
19 | 19 |
20 namespace dart { | 20 namespace dart { |
21 | 21 |
22 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 22 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
23 DECLARE_FLAG(int, optimization_counter_threshold); | 23 DECLARE_FLAG(int, optimization_counter_threshold); |
24 DECLARE_FLAG(bool, print_ast); | 24 DECLARE_FLAG(bool, print_ast); |
25 DECLARE_FLAG(bool, print_scopes); | 25 DECLARE_FLAG(bool, print_scopes); |
26 DECLARE_FLAG(bool, use_sse41); | 26 DECLARE_FLAG(bool, eliminate_type_checks); |
27 | 27 |
28 | 28 |
29 FlowGraphCompiler::~FlowGraphCompiler() { | 29 FlowGraphCompiler::~FlowGraphCompiler() { |
30 // BlockInfos are zone-allocated, so their destructors are not called. | 30 // BlockInfos are zone-allocated, so their destructors are not called. |
31 // Verify the labels explicitly here. | 31 // Verify the labels explicitly here. |
32 for (int i = 0; i < block_info_.length(); ++i) { | 32 for (int i = 0; i < block_info_.length(); ++i) { |
33 ASSERT(!block_info_[i]->label.IsLinked()); | 33 ASSERT(!block_info_[i]->label.IsLinked()); |
34 ASSERT(!block_info_[i]->label.HasNear()); | 34 ASSERT(!block_info_[i]->label.HasNear()); |
35 } | 35 } |
36 } | 36 } |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 554 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); |
555 __ pushq(RCX); // Store instantiator. | 555 __ pushq(RCX); // Store instantiator. |
556 __ pushq(RDX); // Store instantiator type arguments. | 556 __ pushq(RDX); // Store instantiator type arguments. |
557 // A null object is always assignable and is returned as result. | 557 // A null object is always assignable and is returned as result. |
558 const Immediate& raw_null = | 558 const Immediate& raw_null = |
559 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 559 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
560 Label is_assignable, runtime_call; | 560 Label is_assignable, runtime_call; |
561 __ cmpq(RAX, raw_null); | 561 __ cmpq(RAX, raw_null); |
562 __ j(EQUAL, &is_assignable); | 562 __ j(EQUAL, &is_assignable); |
563 | 563 |
| 564 if (!FLAG_eliminate_type_checks) { |
| 565 // If type checks are not eliminated during the graph building then |
| 566 // a transition sentinel can be seen here. |
| 567 __ CompareObject(RAX, Object::transition_sentinel()); |
| 568 __ j(EQUAL, &is_assignable); |
| 569 } |
| 570 |
564 // Generate throw new TypeError() if the type is malformed. | 571 // Generate throw new TypeError() if the type is malformed. |
565 if (dst_type.IsMalformed()) { | 572 if (dst_type.IsMalformed()) { |
566 const Error& error = Error::Handle(dst_type.malformed_error()); | 573 const Error& error = Error::Handle(dst_type.malformed_error()); |
567 const String& error_message = String::ZoneHandle( | 574 const String& error_message = String::ZoneHandle( |
568 Symbols::New(error.ToErrorCString())); | 575 Symbols::New(error.ToErrorCString())); |
569 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 576 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
570 __ pushq(RAX); // Push the source object. | 577 __ pushq(RAX); // Push the source object. |
571 __ PushObject(dst_name); // Push the name of the destination. | 578 __ PushObject(dst_name); // Push the name of the destination. |
572 __ PushObject(error_message); | 579 __ PushObject(error_message); |
573 GenerateCallRuntime(token_pos, | 580 GenerateCallRuntime(token_pos, |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1707 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
1701 __ Exchange(mem1, mem2); | 1708 __ Exchange(mem1, mem2); |
1702 } | 1709 } |
1703 | 1710 |
1704 | 1711 |
1705 #undef __ | 1712 #undef __ |
1706 | 1713 |
1707 } // namespace dart | 1714 } // namespace dart |
1708 | 1715 |
1709 #endif // defined TARGET_ARCH_X64 | 1716 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |