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

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

Issue 22915008: Tests for GuardField length check along with bug fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | « no previous file | runtime/vm/guard_field_test.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 3043 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 Value* store_value = for_value.value(); 3054 Value* store_value = for_value.value();
3055 if (FLAG_enable_type_checks) { 3055 if (FLAG_enable_type_checks) {
3056 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); 3056 const AbstractType& type = AbstractType::ZoneHandle(node->field().type());
3057 const String& dst_name = String::ZoneHandle(node->field().name()); 3057 const String& dst_name = String::ZoneHandle(node->field().name());
3058 store_value = BuildAssignableValue(node->value()->token_pos(), 3058 store_value = BuildAssignableValue(node->value()->token_pos(),
3059 store_value, 3059 store_value,
3060 type, 3060 type,
3061 dst_name); 3061 dst_name);
3062 } 3062 }
3063 3063
3064 if (!node->field().is_final()) {
3065 // For now, disable list length guarding on non-final fields by specifying
3066 // that the field doesn't have a length. See issue #12485.
3067 node->field().set_guarded_list_length(Field::kNoFixedLength);
3068 }
3069
3070 store_value = Bind(BuildStoreExprTemp(store_value)); 3064 store_value = Bind(BuildStoreExprTemp(store_value));
3071 GuardFieldInstr* guard = 3065 GuardFieldInstr* guard =
3072 new GuardFieldInstr(store_value, 3066 new GuardFieldInstr(store_value,
3073 node->field(), 3067 node->field(),
3074 Isolate::Current()->GetNextDeoptId()); 3068 Isolate::Current()->GetNextDeoptId());
3075 AddInstruction(guard); 3069 AddInstruction(guard);
3076 3070
3077 store_value = Bind(BuildLoadExprTemp()); 3071 store_value = Bind(BuildLoadExprTemp());
3078 StoreInstanceFieldInstr* store = 3072 StoreInstanceFieldInstr* store =
3079 new StoreInstanceFieldInstr(node->field(), 3073 new StoreInstanceFieldInstr(node->field(),
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
3820 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3814 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3821 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3815 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3822 OS::SNPrint(chars, len, kFormat, function_name, reason); 3816 OS::SNPrint(chars, len, kFormat, function_name, reason);
3823 const Error& error = Error::Handle( 3817 const Error& error = Error::Handle(
3824 LanguageError::New(String::Handle(String::New(chars)))); 3818 LanguageError::New(String::Handle(String::New(chars))));
3825 Isolate::Current()->long_jump_base()->Jump(1, error); 3819 Isolate::Current()->long_jump_base()->Jump(1, error);
3826 } 3820 }
3827 3821
3828 3822
3829 } // namespace dart 3823 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/guard_field_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698