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

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

Issue 2158563002: Put a NoOOBMessageScope everywhere we have a NoReloadScope (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 12207 matching lines...) Expand 10 before | Expand all | Expand 10 after
12218 // The implicit static getter will throw the exception if necessary. 12218 // The implicit static getter will throw the exception if necessary.
12219 return new(Z) StaticGetterNode( 12219 return new(Z) StaticGetterNode(
12220 field_ref_pos, NULL, field_owner, field_name); 12220 field_ref_pos, NULL, field_owner, field_name);
12221 } 12221 }
12222 } else if (value.raw() == Object::sentinel().raw()) { 12222 } else if (value.raw() == Object::sentinel().raw()) {
12223 // This field has not been referenced yet and thus the value has 12223 // This field has not been referenced yet and thus the value has
12224 // not been evaluated. If the field is const, call the static getter method 12224 // not been evaluated. If the field is const, call the static getter method
12225 // to evaluate the expression and canonicalize the value. 12225 // to evaluate the expression and canonicalize the value.
12226 if (field.is_const()) { 12226 if (field.is_const()) {
12227 NoReloadScope no_reload_scope(isolate(), thread()); 12227 NoReloadScope no_reload_scope(isolate(), thread());
12228 NoOOBMessageScope no_msg_scope(thread());
12228 field.SetStaticValue(Object::transition_sentinel()); 12229 field.SetStaticValue(Object::transition_sentinel());
12229 const int kNumArguments = 0; // no arguments. 12230 const int kNumArguments = 0; // no arguments.
12230 const Function& func = Function::Handle(Z, 12231 const Function& func = Function::Handle(Z,
12231 Resolver::ResolveStatic(field_owner, 12232 Resolver::ResolveStatic(field_owner,
12232 getter_name, 12233 getter_name,
12233 kNumArguments, 12234 kNumArguments,
12234 Object::empty_array())); 12235 Object::empty_array()));
12235 ASSERT(!func.IsNull()); 12236 ASSERT(!func.IsNull());
12236 ASSERT(func.kind() == RawFunction::kImplicitStaticFinalGetter); 12237 ASSERT(func.kind() == RawFunction::kImplicitStaticFinalGetter);
12237 Object& const_value = Object::Handle(Z); 12238 Object& const_value = Object::Handle(Z);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
12270 if (getter.IsNull() || 12271 if (getter.IsNull() ||
12271 (getter.kind() == RawFunction::kImplicitStaticFinalGetter)) { 12272 (getter.kind() == RawFunction::kImplicitStaticFinalGetter)) {
12272 return NULL; 12273 return NULL;
12273 } 12274 }
12274 ASSERT(getter.kind() == RawFunction::kImplicitGetter); 12275 ASSERT(getter.kind() == RawFunction::kImplicitGetter);
12275 return new(Z) StaticGetterNode( 12276 return new(Z) StaticGetterNode(
12276 field_ref_pos, NULL, field_owner, field_name); 12277 field_ref_pos, NULL, field_owner, field_name);
12277 } 12278 }
12278 12279
12279 12280
12280 RawObject* Parser::EvaluateConstConstructorCall( 12281 RawObject* Parser::EvaluateConstConstructorCall(
rmacnak 2016/07/15 20:39:07 Coulda swore we already had this one...
12281 const Class& type_class, 12282 const Class& type_class,
12282 const TypeArguments& type_arguments, 12283 const TypeArguments& type_arguments,
12283 const Function& constructor, 12284 const Function& constructor,
12284 ArgumentListNode* arguments) { 12285 ArgumentListNode* arguments) {
12285 NoReloadScope no_reload_scope(isolate(), thread()); 12286 NoReloadScope no_reload_scope(isolate(), thread());
12287 NoOOBMessageScope no_msg_scope(thread());
12286 // Factories have one extra argument: the type arguments. 12288 // Factories have one extra argument: the type arguments.
12287 // Constructors have 1 extra arguments: receiver. 12289 // Constructors have 1 extra arguments: receiver.
12288 const int kNumExtraArgs = 1; 12290 const int kNumExtraArgs = 1;
12289 const int num_arguments = arguments->length() + kNumExtraArgs; 12291 const int num_arguments = arguments->length() + kNumExtraArgs;
12290 const Array& arg_values = 12292 const Array& arg_values =
12291 Array::Handle(Z, Array::New(num_arguments, Heap::kOld)); 12293 Array::Handle(Z, Array::New(num_arguments, Heap::kOld));
12292 Instance& instance = Instance::Handle(Z); 12294 Instance& instance = Instance::Handle(Z);
12293 if (!constructor.IsFactory()) { 12295 if (!constructor.IsFactory()) {
12294 instance = Instance::New(type_class, Heap::kOld); 12296 instance = Instance::New(type_class, Heap::kOld);
12295 if (!type_arguments.IsNull()) { 12297 if (!type_arguments.IsNull()) {
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
13791 if (!type_bound.IsNull()) { 13793 if (!type_bound.IsNull()) {
13792 new_object = new(Z) AssignableNode( 13794 new_object = new(Z) AssignableNode(
13793 new_pos, new_object, type_bound, Symbols::FactoryResult()); 13795 new_pos, new_object, type_bound, Symbols::FactoryResult());
13794 } 13796 }
13795 return new_object; 13797 return new_object;
13796 } 13798 }
13797 13799
13798 13800
13799 String& Parser::Interpolate(const GrowableArray<AstNode*>& values) { 13801 String& Parser::Interpolate(const GrowableArray<AstNode*>& values) {
13800 NoReloadScope no_reload_scope(isolate(), thread()); 13802 NoReloadScope no_reload_scope(isolate(), thread());
13803 NoOOBMessageScope no_msg_scope(thread());
13801 const Class& cls = Class::Handle( 13804 const Class& cls = Class::Handle(
13802 Z, Library::LookupCoreClass(Symbols::StringBase())); 13805 Z, Library::LookupCoreClass(Symbols::StringBase()));
13803 ASSERT(!cls.IsNull()); 13806 ASSERT(!cls.IsNull());
13804 const Function& func = Function::Handle(Z, cls.LookupStaticFunction( 13807 const Function& func = Function::Handle(Z, cls.LookupStaticFunction(
13805 Library::PrivateCoreLibName(Symbols::Interpolate()))); 13808 Library::PrivateCoreLibName(Symbols::Interpolate())));
13806 ASSERT(!func.IsNull()); 13809 ASSERT(!func.IsNull());
13807 13810
13808 // Build the array of literal values to interpolate. 13811 // Build the array of literal values to interpolate.
13809 const Array& value_arr = Array::Handle(Z, 13812 const Array& value_arr = Array::Handle(Z,
13810 Array::New(values.length(), Heap::kOld)); 13813 Array::New(values.length(), Heap::kOld));
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
14139 } 14142 }
14140 return primary; 14143 return primary;
14141 } 14144 }
14142 14145
14143 14146
14144 // Evaluate expression in expr and return the value. The expression must 14147 // Evaluate expression in expr and return the value. The expression must
14145 // be a compile time constant. 14148 // be a compile time constant.
14146 const Instance& Parser::EvaluateConstExpr(TokenPosition expr_pos, 14149 const Instance& Parser::EvaluateConstExpr(TokenPosition expr_pos,
14147 AstNode* expr) { 14150 AstNode* expr) {
14148 NoReloadScope no_reload_scope(isolate(), thread()); 14151 NoReloadScope no_reload_scope(isolate(), thread());
14152 NoOOBMessageScope no_msg_scope(thread());
14149 if (expr->IsLiteralNode()) { 14153 if (expr->IsLiteralNode()) {
14150 return expr->AsLiteralNode()->literal(); 14154 return expr->AsLiteralNode()->literal();
14151 } else if (expr->IsLoadLocalNode() && 14155 } else if (expr->IsLoadLocalNode() &&
14152 expr->AsLoadLocalNode()->local().IsConst()) { 14156 expr->AsLoadLocalNode()->local().IsConst()) {
14153 return *expr->AsLoadLocalNode()->local().ConstValue(); 14157 return *expr->AsLoadLocalNode()->local().ConstValue();
14154 } else if (expr->IsLoadStaticFieldNode()) { 14158 } else if (expr->IsLoadStaticFieldNode()) {
14155 const Field& field = expr->AsLoadStaticFieldNode()->field(); 14159 const Field& field = expr->AsLoadStaticFieldNode()->field();
14156 // We already checked that this field is const and has been 14160 // We already checked that this field is const and has been
14157 // initialized. 14161 // initialized.
14158 ASSERT(field.is_const()); 14162 ASSERT(field.is_const());
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
14634 const ArgumentListNode& function_args, 14638 const ArgumentListNode& function_args,
14635 const LocalVariable* temp_for_last_arg, 14639 const LocalVariable* temp_for_last_arg,
14636 bool is_super_invocation) { 14640 bool is_super_invocation) {
14637 UNREACHABLE(); 14641 UNREACHABLE();
14638 return NULL; 14642 return NULL;
14639 } 14643 }
14640 14644
14641 } // namespace dart 14645 } // namespace dart
14642 14646
14643 #endif // DART_PRECOMPILED_RUNTIME 14647 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698