Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1089)

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 300763002: Don't require eliminating certain type checks in unoptimized compilation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
11 #include "vm/compiler.h" 11 #include "vm/compiler.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/deopt_instructions.h" 13 #include "vm/deopt_instructions.h"
14 #include "vm/il_printer.h" 14 #include "vm/il_printer.h"
15 #include "vm/locations.h" 15 #include "vm/locations.h"
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #include "vm/parser.h" 17 #include "vm/parser.h"
18 #include "vm/stack_frame.h" 18 #include "vm/stack_frame.h"
19 #include "vm/stub_code.h" 19 #include "vm/stub_code.h"
20 #include "vm/symbols.h" 20 #include "vm/symbols.h"
21 21
22 namespace dart { 22 namespace dart {
23 23
24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); 24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
25 DECLARE_FLAG(int, optimization_counter_threshold); 25 DECLARE_FLAG(int, optimization_counter_threshold);
26 DECLARE_FLAG(int, reoptimization_counter_threshold); 26 DECLARE_FLAG(int, reoptimization_counter_threshold);
27 DECLARE_FLAG(bool, enable_type_checks); 27 DECLARE_FLAG(bool, enable_type_checks);
28 DECLARE_FLAG(bool, eliminate_type_checks);
29 DECLARE_FLAG(bool, enable_simd_inline); 28 DECLARE_FLAG(bool, enable_simd_inline);
30 29
31 30
32 FlowGraphCompiler::~FlowGraphCompiler() { 31 FlowGraphCompiler::~FlowGraphCompiler() {
33 // BlockInfos are zone-allocated, so their destructors are not called. 32 // BlockInfos are zone-allocated, so their destructors are not called.
34 // Verify the labels explicitly here. 33 // Verify the labels explicitly here.
35 for (int i = 0; i < block_info_.length(); ++i) { 34 for (int i = 0; i < block_info_.length(); ++i) {
36 ASSERT(!block_info_[i]->jump_label()->IsLinked()); 35 ASSERT(!block_info_[i]->jump_label()->IsLinked());
37 ASSERT(!block_info_[i]->jump_label()->HasNear()); 36 ASSERT(!block_info_[i]->jump_label()->HasNear());
38 } 37 }
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 // Assignable check is skipped in FlowGraphBuilder, not here. 653 // Assignable check is skipped in FlowGraphBuilder, not here.
655 ASSERT(dst_type.IsMalformedOrMalbounded() || 654 ASSERT(dst_type.IsMalformedOrMalbounded() ||
656 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); 655 (!dst_type.IsDynamicType() && !dst_type.IsObjectType()));
657 __ pushq(RCX); // Store instantiator. 656 __ pushq(RCX); // Store instantiator.
658 __ pushq(RDX); // Store instantiator type arguments. 657 __ pushq(RDX); // Store instantiator type arguments.
659 // A null object is always assignable and is returned as result. 658 // A null object is always assignable and is returned as result.
660 Label is_assignable, runtime_call; 659 Label is_assignable, runtime_call;
661 __ CompareObject(RAX, Object::null_object(), PP); 660 __ CompareObject(RAX, Object::null_object(), PP);
662 __ j(EQUAL, &is_assignable); 661 __ j(EQUAL, &is_assignable);
663 662
664 if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) {
665 // If type checks are not eliminated during the graph building then
666 // a transition sentinel can be seen here.
667 __ CompareObject(RAX, Object::transition_sentinel(), PP);
668 __ j(EQUAL, &is_assignable);
669 }
670
671 // Generate throw new TypeError() if the type is malformed or malbounded. 663 // Generate throw new TypeError() if the type is malformed or malbounded.
672 if (dst_type.IsMalformedOrMalbounded()) { 664 if (dst_type.IsMalformedOrMalbounded()) {
673 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. 665 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result.
674 __ pushq(RAX); // Push the source object. 666 __ pushq(RAX); // Push the source object.
675 __ PushObject(dst_name, PP); // Push the name of the destination. 667 __ PushObject(dst_name, PP); // Push the name of the destination.
676 __ PushObject(dst_type, PP); // Push the type of the destination. 668 __ PushObject(dst_type, PP); // Push the type of the destination.
677 GenerateRuntimeCall(token_pos, 669 GenerateRuntimeCall(token_pos,
678 deopt_id, 670 deopt_id,
679 kBadTypeErrorRuntimeEntry, 671 kBadTypeErrorRuntimeEntry,
680 3, 672 3,
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 __ movups(reg, Address(RSP, 0)); 1775 __ movups(reg, Address(RSP, 0));
1784 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1776 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1785 } 1777 }
1786 1778
1787 1779
1788 #undef __ 1780 #undef __
1789 1781
1790 } // namespace dart 1782 } // namespace dart
1791 1783
1792 #endif // defined TARGET_ARCH_X64 1784 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698