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

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') | runtime/vm/intermediate_language_ia32.cc » ('J')
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 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after
3003 Value* store_value = for_value.value(); 3003 Value* store_value = for_value.value();
3004 if (FLAG_enable_type_checks) { 3004 if (FLAG_enable_type_checks) {
3005 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); 3005 const AbstractType& type = AbstractType::ZoneHandle(node->field().type());
3006 const String& dst_name = String::ZoneHandle(node->field().name()); 3006 const String& dst_name = String::ZoneHandle(node->field().name());
3007 store_value = BuildAssignableValue(node->value()->token_pos(), 3007 store_value = BuildAssignableValue(node->value()->token_pos(),
3008 store_value, 3008 store_value,
3009 type, 3009 type,
3010 dst_name); 3010 dst_name);
3011 } 3011 }
3012 3012
3013 if (!node->field().is_final()) {
3014 // For now, disable list length guarding on non-final fields by specifying
3015 // that the field doesn't have a length. See issue #12485.
3016 node->field().set_guarded_list_length(Field::kNoFixedLength);
3017 }
3018
3019 store_value = Bind(BuildStoreExprTemp(store_value)); 3013 store_value = Bind(BuildStoreExprTemp(store_value));
3020 GuardFieldInstr* guard = 3014 GuardFieldInstr* guard =
3021 new GuardFieldInstr(store_value, 3015 new GuardFieldInstr(store_value,
3022 node->field(), 3016 node->field(),
3023 Isolate::Current()->GetNextDeoptId()); 3017 Isolate::Current()->GetNextDeoptId());
3024 AddInstruction(guard); 3018 AddInstruction(guard);
3025 3019
3026 store_value = Bind(BuildLoadExprTemp()); 3020 store_value = Bind(BuildLoadExprTemp());
3027 StoreInstanceFieldInstr* store = 3021 StoreInstanceFieldInstr* store =
3028 new StoreInstanceFieldInstr(node->field(), 3022 new StoreInstanceFieldInstr(node->field(),
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 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;
3750 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3744 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3751 OS::SNPrint(chars, len, kFormat, function_name, reason); 3745 OS::SNPrint(chars, len, kFormat, function_name, reason);
3752 const Error& error = Error::Handle( 3746 const Error& error = Error::Handle(
3753 LanguageError::New(String::Handle(String::New(chars)))); 3747 LanguageError::New(String::Handle(String::New(chars))));
3754 Isolate::Current()->long_jump_base()->Jump(1, error); 3748 Isolate::Current()->long_jump_base()->Jump(1, error);
3755 } 3749 }
3756 3750
3757 3751
3758 } // namespace dart 3752 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/guard_field_test.cc » ('j') | runtime/vm/intermediate_language_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698