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

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

Issue 2411823003: VM support for running Kernel binaries. (Closed)
Patch Set: Address initial review comments Created 4 years, 2 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
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_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/cha.h" 10 #include "vm/cha.h"
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 total_code_size, 1128 total_code_size,
1129 targets.Length() * sizeof(uword)); 1129 targets.Length() * sizeof(uword));
1130 } 1130 }
1131 1131
1132 1132
1133 // Returns 'true' if regular code generation should be skipped. 1133 // Returns 'true' if regular code generation should be skipped.
1134 bool FlowGraphCompiler::TryIntrinsify() { 1134 bool FlowGraphCompiler::TryIntrinsify() {
1135 // Intrinsification skips arguments checks, therefore disable if in checked 1135 // Intrinsification skips arguments checks, therefore disable if in checked
1136 // mode. 1136 // mode.
1137 if (FLAG_intrinsify && !isolate()->type_checks()) { 1137 if (FLAG_intrinsify && !isolate()->type_checks()) {
1138 const Class& owner = Class::Handle(parsed_function().function().Owner());
1139 String& name = String::Handle(parsed_function().function().name());
1140
1138 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) { 1141 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) {
1139 // An implicit getter must have a specific AST structure. 1142 name = Field::NameFromGetter(name);
1140 const SequenceNode& sequence_node = *parsed_function().node_sequence(); 1143 const Field& field = Field::Handle(owner.LookupFieldAllowPrivate(name));
1141 ASSERT(sequence_node.length() == 1); 1144 ASSERT(!field.IsNull());
1142 ASSERT(sequence_node.NodeAt(0)->IsReturnNode()); 1145
1143 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode();
1144 ASSERT(return_node.value()->IsLoadInstanceFieldNode());
1145 const LoadInstanceFieldNode& load_node =
1146 *return_node.value()->AsLoadInstanceFieldNode();
1147 // Only intrinsify getter if the field cannot contain a mutable double. 1146 // Only intrinsify getter if the field cannot contain a mutable double.
1148 // Reading from a mutable double box requires allocating a fresh double. 1147 // Reading from a mutable double box requires allocating a fresh double.
1149 if (FLAG_precompiled_mode || 1148 if (field.is_instance() &&
1150 !IsPotentialUnboxedField(load_node.field())) { 1149 (FLAG_precompiled_mode || !IsPotentialUnboxedField(field))) {
1151 GenerateInlinedGetter(load_node.field().Offset()); 1150 GenerateInlinedGetter(field.Offset());
1152 return !FLAG_use_field_guards; 1151 return !FLAG_use_field_guards;
1153 } 1152 }
1154 return false; 1153 return false;
1155 } 1154 }
1156 if (parsed_function().function().kind() == RawFunction::kImplicitSetter) { 1155 if (parsed_function().function().kind() == RawFunction::kImplicitSetter) {
1157 // An implicit setter must have a specific AST structure. 1156 name = Field::NameFromSetter(name);
1158 // Sequence node has one store node and one return NULL node. 1157 const Field& field = Field::Handle(owner.LookupFieldAllowPrivate(name));
1159 const SequenceNode& sequence_node = *parsed_function().node_sequence(); 1158 ASSERT(!field.IsNull());
1160 ASSERT(sequence_node.length() == 2); 1159
1161 ASSERT(sequence_node.NodeAt(0)->IsStoreInstanceFieldNode()); 1160 if (field.is_instance() &&
1162 ASSERT(sequence_node.NodeAt(1)->IsReturnNode()); 1161 (FLAG_precompiled_mode || field.guarded_cid() == kDynamicCid)) {
1163 const StoreInstanceFieldNode& store_node = 1162 GenerateInlinedSetter(field.Offset());
1164 *sequence_node.NodeAt(0)->AsStoreInstanceFieldNode();
1165 if (FLAG_precompiled_mode ||
1166 (store_node.field().guarded_cid() == kDynamicCid)) {
1167 GenerateInlinedSetter(store_node.field().Offset());
1168 return !FLAG_use_field_guards; 1163 return !FLAG_use_field_guards;
1169 } 1164 }
1165 return false;
1170 } 1166 }
1171 } 1167 }
1172 1168
1173 EnterIntrinsicMode(); 1169 EnterIntrinsicMode();
1174 1170
1175 bool complete = Intrinsifier::Intrinsify(parsed_function(), this); 1171 bool complete = Intrinsifier::Intrinsify(parsed_function(), this);
1176 1172
1177 ExitIntrinsicMode(); 1173 ExitIntrinsicMode();
1178 1174
1179 // "Deoptimization" from intrinsic continues here. All deoptimization 1175 // "Deoptimization" from intrinsic continues here. All deoptimization
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 1987
1992 1988
1993 void FlowGraphCompiler::FrameStateClear() { 1989 void FlowGraphCompiler::FrameStateClear() {
1994 ASSERT(!is_optimizing()); 1990 ASSERT(!is_optimizing());
1995 frame_state_.TruncateTo(0); 1991 frame_state_.TruncateTo(0);
1996 } 1992 }
1997 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) 1993 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC)
1998 1994
1999 1995
2000 } // namespace dart 1996 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698