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

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
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/intermediate_language_arm.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) 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 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 Value* store_value = for_value.value(); 2997 Value* store_value = for_value.value();
2998 if (FLAG_enable_type_checks) { 2998 if (FLAG_enable_type_checks) {
2999 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); 2999 const AbstractType& type = AbstractType::ZoneHandle(node->field().type());
3000 const String& dst_name = String::ZoneHandle(node->field().name()); 3000 const String& dst_name = String::ZoneHandle(node->field().name());
3001 store_value = BuildAssignableValue(node->value()->token_pos(), 3001 store_value = BuildAssignableValue(node->value()->token_pos(),
3002 store_value, 3002 store_value,
3003 type, 3003 type,
3004 dst_name); 3004 dst_name);
3005 } 3005 }
3006 3006
3007 if (!node->field().is_final()) {
3008 // For now, disable list length guarding on non-final fields by specifying
3009 // that the field doesn't have a length. See issue #12485.
3010 node->field().set_guarded_list_length(Field::kNoFixedLength);
3011 }
3012
3007 store_value = Bind(BuildStoreExprTemp(store_value)); 3013 store_value = Bind(BuildStoreExprTemp(store_value));
3008 GuardFieldInstr* guard = 3014 GuardFieldInstr* guard =
3009 new GuardFieldInstr(store_value, 3015 new GuardFieldInstr(store_value,
3010 node->field(), 3016 node->field(),
3011 Isolate::Current()->GetNextDeoptId()); 3017 Isolate::Current()->GetNextDeoptId());
3012 AddInstruction(guard); 3018 AddInstruction(guard);
3013 3019
3014 store_value = Bind(BuildLoadExprTemp()); 3020 store_value = Bind(BuildLoadExprTemp());
3015 StoreInstanceFieldInstr* store = 3021 StoreInstanceFieldInstr* store =
3016 new StoreInstanceFieldInstr(node->field(), 3022 new StoreInstanceFieldInstr(node->field(),
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
3737 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3743 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3738 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3744 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3739 OS::SNPrint(chars, len, kFormat, function_name, reason); 3745 OS::SNPrint(chars, len, kFormat, function_name, reason);
3740 const Error& error = Error::Handle( 3746 const Error& error = Error::Handle(
3741 LanguageError::New(String::Handle(String::New(chars)))); 3747 LanguageError::New(String::Handle(String::New(chars))));
3742 Isolate::Current()->long_jump_base()->Jump(1, error); 3748 Isolate::Current()->long_jump_base()->Jump(1, error);
3743 } 3749 }
3744 3750
3745 3751
3746 } // namespace dart 3752 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698