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

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 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after
2889 Value* store_value = for_value.value(); 2889 Value* store_value = for_value.value();
2890 if (FLAG_enable_type_checks) { 2890 if (FLAG_enable_type_checks) {
2891 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); 2891 const AbstractType& type = AbstractType::ZoneHandle(node->field().type());
2892 const String& dst_name = String::ZoneHandle(node->field().name()); 2892 const String& dst_name = String::ZoneHandle(node->field().name());
2893 store_value = BuildAssignableValue(node->value()->token_pos(), 2893 store_value = BuildAssignableValue(node->value()->token_pos(),
2894 store_value, 2894 store_value,
2895 type, 2895 type,
2896 dst_name); 2896 dst_name);
2897 } 2897 }
2898 2898
2899 if (!node->field().is_final()) {
2900 // Disable list length guarding on non-final fields by specifying
2901 // that the field doesn't have a length.
srdjan 2013/08/14 17:01:08 Maybe add a 'why' to the comment, or a "for now".
Cutch 2013/08/15 16:39:12 Done.
2902 node->field().set_guarded_list_length(Field::kNoLength);
2903 }
2904
2899 store_value = Bind(BuildStoreExprTemp(store_value)); 2905 store_value = Bind(BuildStoreExprTemp(store_value));
2900 GuardFieldInstr* guard = 2906 GuardFieldInstr* guard =
2901 new GuardFieldInstr(store_value, 2907 new GuardFieldInstr(store_value,
2902 node->field(), 2908 node->field(),
2903 Isolate::Current()->GetNextDeoptId()); 2909 Isolate::Current()->GetNextDeoptId());
2904 AddInstruction(guard); 2910 AddInstruction(guard);
2905 2911
2906 store_value = Bind(BuildLoadExprTemp()); 2912 store_value = Bind(BuildLoadExprTemp());
2907 StoreInstanceFieldInstr* store = 2913 StoreInstanceFieldInstr* store =
2908 new StoreInstanceFieldInstr(node->field(), 2914 new StoreInstanceFieldInstr(node->field(),
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3632 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3627 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3633 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3628 OS::SNPrint(chars, len, kFormat, function_name, reason); 3634 OS::SNPrint(chars, len, kFormat, function_name, reason);
3629 const Error& error = Error::Handle( 3635 const Error& error = Error::Handle(
3630 LanguageError::New(String::Handle(String::New(chars)))); 3636 LanguageError::New(String::Handle(String::New(chars))));
3631 Isolate::Current()->long_jump_base()->Jump(1, error); 3637 Isolate::Current()->long_jump_base()->Jump(1, error);
3632 } 3638 }
3633 3639
3634 3640
3635 } // namespace dart 3641 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698