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

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

Issue 132163005: Version 1.1.0-dev.5.7 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 years, 11 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/disassembler_x64.cc ('k') | runtime/vm/flow_graph_compiler.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 Append(for_effect); 960 Append(for_effect);
961 if (!is_open()) { 961 if (!is_open()) {
962 owner()->DeallocateTemps(owner()->temp_count()); 962 owner()->DeallocateTemps(owner()->temp_count());
963 return; 963 return;
964 } 964 }
965 } 965 }
966 966
967 // Call to stub that checks whether the debugger is in single 967 // Call to stub that checks whether the debugger is in single
968 // step mode. This call must happen before the contexts are 968 // step mode. This call must happen before the contexts are
969 // unchained so that captured variables can be inspected. 969 // unchained so that captured variables can be inspected.
970 AddInstruction(new DebugStepCheckInstr(node->token_pos())); 970 // No debugger check is done in native functions.
971 const Function& function = owner()->parsed_function()->function();
972 if (!function.is_native()) {
973 AddInstruction(new DebugStepCheckInstr(node->token_pos(),
974 PcDescriptors::kReturn));
975 }
971 976
972 Value* return_value = for_value.value(); 977 Value* return_value = for_value.value();
973 if (FLAG_enable_type_checks) { 978 if (FLAG_enable_type_checks) {
974 const Function& function = owner()->parsed_function()->function();
975 const bool is_implicit_dynamic_getter = 979 const bool is_implicit_dynamic_getter =
976 (!function.is_static() && 980 (!function.is_static() &&
977 ((function.kind() == RawFunction::kImplicitGetter) || 981 ((function.kind() == RawFunction::kImplicitGetter) ||
978 (function.kind() == RawFunction::kImplicitStaticFinalGetter))); 982 (function.kind() == RawFunction::kImplicitStaticFinalGetter)));
979 // Implicit getters do not need a type check at return, unless they compute 983 // Implicit getters do not need a type check at return, unless they compute
980 // the initial value of a static field. 984 // the initial value of a static field.
981 // The body of a constructor cannot modify the type of the 985 // The body of a constructor cannot modify the type of the
982 // constructed instance, which is passed in as an implicit parameter. 986 // constructed instance, which is passed in as an implicit parameter.
983 // However, factories may create an instance of the wrong type. 987 // However, factories may create an instance of the wrong type.
984 if (!is_implicit_dynamic_getter && !function.IsConstructor()) { 988 if (!is_implicit_dynamic_getter && !function.IsConstructor()) {
985 const AbstractType& dst_type = 989 const AbstractType& dst_type =
986 AbstractType::ZoneHandle( 990 AbstractType::ZoneHandle(function.result_type());
987 owner()->parsed_function()->function().result_type());
988 return_value = BuildAssignableValue(node->value()->token_pos(), 991 return_value = BuildAssignableValue(node->value()->token_pos(),
989 return_value, 992 return_value,
990 dst_type, 993 dst_type,
991 Symbols::FunctionResult()); 994 Symbols::FunctionResult());
992 } 995 }
993 } 996 }
994 997
995 intptr_t current_context_level = owner()->context_level(); 998 intptr_t current_context_level = owner()->context_level();
996 ASSERT(current_context_level >= 0); 999 ASSERT(current_context_level >= 0);
997 if (owner()->parsed_function()->saved_entry_context_var() != NULL) { 1000 if (owner()->parsed_function()->saved_entry_context_var() != NULL) {
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { 3203 void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) {
3201 Definition* load = BuildLoadLocal(node->local()); 3204 Definition* load = BuildLoadLocal(node->local());
3202 ReturnDefinition(load); 3205 ReturnDefinition(load);
3203 } 3206 }
3204 3207
3205 3208
3206 // <Expression> ::= StoreLocal { local: LocalVariable 3209 // <Expression> ::= StoreLocal { local: LocalVariable
3207 // value: <Expression> } 3210 // value: <Expression> }
3208 void EffectGraphVisitor::HandleStoreLocal(StoreLocalNode* node, 3211 void EffectGraphVisitor::HandleStoreLocal(StoreLocalNode* node,
3209 bool result_is_needed) { 3212 bool result_is_needed) {
3213 // If the right hand side is an expression that does not contain
3214 // a safe point for the debugger to stop, add an explicit stub
3215 // call.
3216 if (node->value()->IsLiteralNode() ||
3217 node->value()->IsLoadLocalNode()) {
3218 AddInstruction(new DebugStepCheckInstr(node->token_pos(),
3219 PcDescriptors::kRuntimeCall));
3220 }
3221
3210 ValueGraphVisitor for_value(owner()); 3222 ValueGraphVisitor for_value(owner());
3211 node->value()->Visit(&for_value); 3223 node->value()->Visit(&for_value);
3212 Append(for_value); 3224 Append(for_value);
3213 Value* store_value = for_value.value(); 3225 Value* store_value = for_value.value();
3214 if (FLAG_enable_type_checks) { 3226 if (FLAG_enable_type_checks) {
3215 store_value = BuildAssignableValue(node->value()->token_pos(), 3227 store_value = BuildAssignableValue(node->value()->token_pos(),
3216 store_value, 3228 store_value,
3217 node->local().type(), 3229 node->local().type(),
3218 node->local().name()); 3230 node->local().name());
3219 } 3231 }
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
4040 LanguageError::kError, 4052 LanguageError::kError,
4041 Heap::kNew, 4053 Heap::kNew,
4042 "FlowGraphBuilder Bailout: %s %s", 4054 "FlowGraphBuilder Bailout: %s %s",
4043 String::Handle(function.name()).ToCString(), 4055 String::Handle(function.name()).ToCString(),
4044 reason)); 4056 reason));
4045 Isolate::Current()->long_jump_base()->Jump(1, error); 4057 Isolate::Current()->long_jump_base()->Jump(1, error);
4046 } 4058 }
4047 4059
4048 4060
4049 } // namespace dart 4061 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/disassembler_x64.cc ('k') | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698