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

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

Issue 22851003: Initial support for length guards on final fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
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/code_descriptors.h" 10 #include "vm/code_descriptors.h"
(...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 Value* store_value = for_value.value(); 2931 Value* store_value = for_value.value();
2932 if (FLAG_enable_type_checks) { 2932 if (FLAG_enable_type_checks) {
2933 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); 2933 const AbstractType& type = AbstractType::ZoneHandle(node->field().type());
2934 const String& dst_name = String::ZoneHandle(node->field().name()); 2934 const String& dst_name = String::ZoneHandle(node->field().name());
2935 store_value = BuildAssignableValue(node->value()->token_pos(), 2935 store_value = BuildAssignableValue(node->value()->token_pos(),
2936 store_value, 2936 store_value,
2937 type, 2937 type,
2938 dst_name); 2938 dst_name);
2939 } 2939 }
2940 2940
2941 if (!node->field().is_final()) {
2942 // For now, disable list length guarding on non-final fields by specifying
2943 // that the field doesn't have a length. See issue #12485.
2944 node->field().set_guarded_list_length(Field::kNoLength);
2945 }
2946
2941 store_value = Bind(BuildStoreExprTemp(store_value)); 2947 store_value = Bind(BuildStoreExprTemp(store_value));
2942 GuardFieldInstr* guard = 2948 GuardFieldInstr* guard =
2943 new GuardFieldInstr(store_value, 2949 new GuardFieldInstr(store_value,
2944 node->field(), 2950 node->field(),
2945 Isolate::Current()->GetNextDeoptId()); 2951 Isolate::Current()->GetNextDeoptId());
2946 AddInstruction(guard); 2952 AddInstruction(guard);
2947 2953
2948 store_value = Bind(BuildLoadExprTemp()); 2954 store_value = Bind(BuildLoadExprTemp());
2949 StoreInstanceFieldInstr* store = 2955 StoreInstanceFieldInstr* store =
2950 new StoreInstanceFieldInstr(node->field(), 2956 new StoreInstanceFieldInstr(node->field(),
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
3670 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3676 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3671 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3677 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3672 OS::SNPrint(chars, len, kFormat, function_name, reason); 3678 OS::SNPrint(chars, len, kFormat, function_name, reason);
3673 const Error& error = Error::Handle( 3679 const Error& error = Error::Handle(
3674 LanguageError::New(String::Handle(String::New(chars)))); 3680 LanguageError::New(String::Handle(String::New(chars))));
3675 Isolate::Current()->long_jump_base()->Jump(1, error); 3681 Isolate::Current()->long_jump_base()->Jump(1, error);
3676 } 3682 }
3677 3683
3678 3684
3679 } // namespace dart 3685 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698