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

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

Issue 2665003002: Fix background compiler issue with new-space allocation in the parser. (Closed)
Patch Set: Created 3 years, 10 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 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 ReportError(token_pos, "class '%s' does not have a superclass", 2350 ReportError(token_pos, "class '%s' does not have a superclass",
2351 String::Handle(Z, current_class().Name()).ToCString()); 2351 String::Handle(Z, current_class().Name()).ToCString());
2352 } 2352 }
2353 Function& super_func = Function::Handle( 2353 Function& super_func = Function::Handle(
2354 Z, Resolver::ResolveDynamicAnyArgs(Z, super_class, name)); 2354 Z, Resolver::ResolveDynamicAnyArgs(Z, super_class, name));
2355 if (!super_func.IsNull() && 2355 if (!super_func.IsNull() &&
2356 !super_func.AreValidArguments(arguments->length(), arguments->names(), 2356 !super_func.AreValidArguments(arguments->length(), arguments->names(),
2357 NULL)) { 2357 NULL)) {
2358 super_func = Function::null(); 2358 super_func = Function::null();
2359 } else if (super_func.IsNull() && resolve_getter) { 2359 } else if (super_func.IsNull() && resolve_getter) {
2360 const String& getter_name = String::ZoneHandle(Z, Field::GetterName(name)); 2360 const String& getter_name =
2361 String::ZoneHandle(Z, Field::GetterSymbol(name));
2361 super_func = Resolver::ResolveDynamicAnyArgs(Z, super_class, getter_name); 2362 super_func = Resolver::ResolveDynamicAnyArgs(Z, super_class, getter_name);
2362 ASSERT(super_func.IsNull() || 2363 ASSERT(super_func.IsNull() ||
2363 (super_func.kind() != RawFunction::kImplicitStaticFinalGetter)); 2364 (super_func.kind() != RawFunction::kImplicitStaticFinalGetter));
2364 } 2365 }
2365 if (super_func.IsNull()) { 2366 if (super_func.IsNull()) {
2366 super_func = Resolver::ResolveDynamicAnyArgs(Z, super_class, 2367 super_func = Resolver::ResolveDynamicAnyArgs(Z, super_class,
2367 Symbols::NoSuchMethod()); 2368 Symbols::NoSuchMethod());
2368 ASSERT(!super_func.IsNull()); 2369 ASSERT(!super_func.IsNull());
2369 *is_no_such_method = true; 2370 *is_no_such_method = true;
2370 } else { 2371 } else {
(...skipping 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after
5629 String& var_name = *ExpectIdentifier("variable name expected"); 5630 String& var_name = *ExpectIdentifier("variable name expected");
5630 5631
5631 if (library_.LookupLocalObject(var_name) != Object::null()) { 5632 if (library_.LookupLocalObject(var_name) != Object::null()) {
5632 ReportError(name_pos, "'%s' is already defined", var_name.ToCString()); 5633 ReportError(name_pos, "'%s' is already defined", var_name.ToCString());
5633 } 5634 }
5634 5635
5635 // Check whether a getter or setter for this name exists. A const 5636 // Check whether a getter or setter for this name exists. A const
5636 // or final field implies a setter which throws a NoSuchMethodError, 5637 // or final field implies a setter which throws a NoSuchMethodError,
5637 // thus we need to check for conflicts with existing setters and 5638 // thus we need to check for conflicts with existing setters and
5638 // getters. 5639 // getters.
5639 String& accessor_name = String::Handle(Z, Field::GetterName(var_name)); 5640 String& accessor_name = String::Handle(Z, Field::GetterSymbol(var_name));
5640 if (library_.LookupLocalObject(accessor_name) != Object::null()) { 5641 if (library_.LookupLocalObject(accessor_name) != Object::null()) {
5641 ReportError(name_pos, "getter for '%s' is already defined", 5642 ReportError(name_pos, "getter for '%s' is already defined",
5642 var_name.ToCString()); 5643 var_name.ToCString());
5643 } 5644 }
5644 accessor_name = Field::SetterName(var_name); 5645 accessor_name = Field::SetterName(var_name);
5645 if (library_.LookupLocalObject(accessor_name) != Object::null()) { 5646 if (library_.LookupLocalObject(accessor_name) != Object::null()) {
5646 ReportError(name_pos, "setter for '%s' is already defined", 5647 ReportError(name_pos, "setter for '%s' is already defined",
5647 var_name.ToCString()); 5648 var_name.ToCString());
5648 } 5649 }
5649 5650
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
5750 const TokenPosition name_pos = TokenPos(); 5751 const TokenPosition name_pos = TokenPos();
5751 const String& func_name = *ExpectIdentifier("function name expected"); 5752 const String& func_name = *ExpectIdentifier("function name expected");
5752 5753
5753 bool found = library_.LookupLocalObject(func_name) != Object::null(); 5754 bool found = library_.LookupLocalObject(func_name) != Object::null();
5754 if (found && !is_patch) { 5755 if (found && !is_patch) {
5755 ReportError(name_pos, "'%s' is already defined", func_name.ToCString()); 5756 ReportError(name_pos, "'%s' is already defined", func_name.ToCString());
5756 } else if (!found && is_patch) { 5757 } else if (!found && is_patch) {
5757 ReportError(name_pos, "missing '%s' cannot be patched", 5758 ReportError(name_pos, "missing '%s' cannot be patched",
5758 func_name.ToCString()); 5759 func_name.ToCString());
5759 } 5760 }
5760 String& accessor_name = String::Handle(Z, Field::GetterName(func_name)); 5761 String& accessor_name = String::Handle(Z, Field::GetterSymbol(func_name));
5761 if (library_.LookupLocalObject(accessor_name) != Object::null()) { 5762 if (library_.LookupLocalObject(accessor_name) != Object::null()) {
5762 ReportError(name_pos, "'%s' is already defined as getter", 5763 ReportError(name_pos, "'%s' is already defined as getter",
5763 func_name.ToCString()); 5764 func_name.ToCString());
5764 } 5765 }
5765 // A setter named x= may co-exist with a function named x, thus we do 5766 // A setter named x= may co-exist with a function named x, thus we do
5766 // not need to check setters. 5767 // not need to check setters.
5767 5768
5768 Function& func = Function::Handle( 5769 Function& func = Function::Handle(
5769 Z, Function::New(func_name, RawFunction::kRegularFunction, 5770 Z, Function::New(func_name, RawFunction::kRegularFunction,
5770 /* is_static = */ true, 5771 /* is_static = */ true,
(...skipping 5695 matching lines...) Expand 10 before | Expand all | Expand 10 after
11466 arguments->names())); 11467 arguments->names()));
11467 if (func.IsNull()) { 11468 if (func.IsNull()) {
11468 // Check if there is a static field of the same name, it could be a closure 11469 // Check if there is a static field of the same name, it could be a closure
11469 // and so we try and invoke the closure. 11470 // and so we try and invoke the closure.
11470 AstNode* closure = NULL; 11471 AstNode* closure = NULL;
11471 const Field& field = Field::ZoneHandle(Z, cls.LookupStaticField(func_name)); 11472 const Field& field = Field::ZoneHandle(Z, cls.LookupStaticField(func_name));
11472 Function& func = Function::ZoneHandle(Z); 11473 Function& func = Function::ZoneHandle(Z);
11473 if (field.IsNull()) { 11474 if (field.IsNull()) {
11474 // No field, check if we have an explicit getter function. 11475 // No field, check if we have an explicit getter function.
11475 const String& getter_name = 11476 const String& getter_name =
11476 String::ZoneHandle(Z, Field::GetterName(func_name)); 11477 String::ZoneHandle(Z, Field::GetterSymbol(func_name));
hausner 2017/01/30 23:01:03 I don't think we want to create a symbol for the g
Florian Schneider 2017/01/30 23:30:23 Ok, instead I could for example create the tempora
11477 const int kNumArguments = 0; // no arguments. 11478 const int kNumArguments = 0; // no arguments.
11478 func = Resolver::ResolveStatic(cls, getter_name, kNumArguments, 11479 func = Resolver::ResolveStatic(cls, getter_name, kNumArguments,
11479 Object::empty_array()); 11480 Object::empty_array());
11480 if (!func.IsNull()) { 11481 if (!func.IsNull()) {
11481 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter); 11482 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter);
11482 closure = new (Z) StaticGetterNode( 11483 closure = new (Z) StaticGetterNode(
11483 call_pos, NULL, Class::ZoneHandle(Z, cls.raw()), func_name); 11484 call_pos, NULL, Class::ZoneHandle(Z, cls.raw()), func_name);
11484 return BuildClosureCall(call_pos, closure, arguments); 11485 return BuildClosureCall(call_pos, closure, arguments);
11485 } 11486 }
11486 } else { 11487 } else {
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
12077 } 12078 }
12078 } else { 12079 } else {
12079 Function& func = Function::Handle(Z); 12080 Function& func = Function::Handle(Z);
12080 if (is_setter_name) { 12081 if (is_setter_name) {
12081 extractor_name = Field::SetterName(extractor_name); 12082 extractor_name = Field::SetterName(extractor_name);
12082 func = cls.LookupStaticFunction(extractor_name); 12083 func = cls.LookupStaticFunction(extractor_name);
12083 } else { 12084 } else {
12084 func = cls.LookupStaticFunction(extractor_name); 12085 func = cls.LookupStaticFunction(extractor_name);
12085 if (func.IsNull()) { 12086 if (func.IsNull()) {
12086 const String& getter_name = 12087 const String& getter_name =
12087 String::Handle(Z, Field::GetterName(extractor_name)); 12088 String::Handle(Z, Field::GetterSymbol(extractor_name));
12088 func = cls.LookupStaticFunction(getter_name); 12089 func = cls.LookupStaticFunction(getter_name);
12089 } 12090 }
12090 } 12091 }
12091 if (!func.IsNull()) { 12092 if (!func.IsNull()) {
12092 return CreateImplicitClosureNode(func, property_pos, NULL); 12093 return CreateImplicitClosureNode(func, property_pos, NULL);
12093 } 12094 }
12094 } 12095 }
12095 return ThrowNoSuchMethodError( 12096 return ThrowNoSuchMethodError(
12096 property_pos, cls, extractor_name, 12097 property_pos, cls, extractor_name,
12097 NULL, // No arguments. 12098 NULL, // No arguments.
(...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after
15018 const ArgumentListNode& function_args, 15019 const ArgumentListNode& function_args,
15019 const LocalVariable* temp_for_last_arg, 15020 const LocalVariable* temp_for_last_arg,
15020 bool is_super_invocation) { 15021 bool is_super_invocation) {
15021 UNREACHABLE(); 15022 UNREACHABLE();
15022 return NULL; 15023 return NULL;
15023 } 15024 }
15024 15025
15025 } // namespace dart 15026 } // namespace dart
15026 15027
15027 #endif // DART_PRECOMPILED_RUNTIME 15028 #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