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

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

Issue 1870343002: - Refactor Symbol allocation to expect a thread parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review feedback. Created 4 years, 8 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 | « runtime/lib/string.cc ('k') | runtime/vm/ast_printer_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/ast.h" 5 #include "vm/ast.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "vm/dart_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/log.h" 9 #include "vm/log.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 98
99 LetNode::LetNode(TokenPosition token_pos) 99 LetNode::LetNode(TokenPosition token_pos)
100 : AstNode(token_pos), 100 : AstNode(token_pos),
101 vars_(1), 101 vars_(1),
102 initializers_(1), 102 initializers_(1),
103 nodes_(1) { } 103 nodes_(1) { }
104 104
105 105
106 LocalVariable* LetNode::AddInitializer(AstNode* node) { 106 LocalVariable* LetNode::AddInitializer(AstNode* node) {
107 Thread* thread = Thread::Current();
108 Zone* zone = thread->zone();
107 initializers_.Add(node); 109 initializers_.Add(node);
108 char name[64]; 110 char name[64];
109 OS::SNPrint(name, sizeof(name), ":lt%s_%" Pd "", 111 OS::SNPrint(name, sizeof(name), ":lt%s_%" Pd "",
110 token_pos().ToCString(), vars_.length()); 112 token_pos().ToCString(), vars_.length());
111 LocalVariable* temp_var = 113 LocalVariable* temp_var =
112 new LocalVariable(token_pos(), 114 new LocalVariable(token_pos(),
113 String::ZoneHandle(Symbols::New(name)), 115 String::ZoneHandle(zone, Symbols::New(thread, name)),
114 Object::dynamic_type()); 116 Object::dynamic_type());
115 vars_.Add(temp_var); 117 vars_.Add(temp_var);
116 return temp_var; 118 return temp_var;
117 } 119 }
118 120
119 121
120 void LetNode::VisitChildren(AstNodeVisitor* visitor) const { 122 void LetNode::VisitChildren(AstNodeVisitor* visitor) const {
121 for (intptr_t i = 0; i < num_temps(); ++i) { 123 for (intptr_t i = 0; i < num_temps(); ++i) {
122 initializers_[i]->Visit(visitor); 124 initializers_[i]->Visit(visitor);
123 } 125 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { 630 AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) {
629 Thread* thread = Thread::Current(); 631 Thread* thread = Thread::Current();
630 Zone* zone = thread->zone(); 632 Zone* zone = thread->zone();
631 Isolate* isolate = thread->isolate(); 633 Isolate* isolate = thread->isolate();
632 if (is_super_getter()) { 634 if (is_super_getter()) {
633 ASSERT(receiver() != NULL); 635 ASSERT(receiver() != NULL);
634 const String& setter_name = 636 const String& setter_name =
635 String::ZoneHandle(zone, Field::LookupSetterSymbol(field_name_)); 637 String::ZoneHandle(zone, Field::LookupSetterSymbol(field_name_));
636 Function& setter = Function::ZoneHandle(zone); 638 Function& setter = Function::ZoneHandle(zone);
637 if (!setter_name.IsNull()) { 639 if (!setter_name.IsNull()) {
638 setter = Resolver::ResolveDynamicAnyArgs(cls(), setter_name); 640 setter = Resolver::ResolveDynamicAnyArgs(zone, cls(), setter_name);
639 } 641 }
640 if (setter.IsNull() || setter.is_abstract()) { 642 if (setter.IsNull() || setter.is_abstract()) {
641 // No instance setter found in super class chain, 643 // No instance setter found in super class chain,
642 // noSuchMethod will be called at runtime. 644 // noSuchMethod will be called at runtime.
643 return new StaticSetterNode(token_pos(), 645 return new StaticSetterNode(token_pos(),
644 receiver(), 646 receiver(),
645 cls(), 647 cls(),
646 field_name_, 648 field_name_,
647 rhs); 649 rhs);
648 } 650 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 if (result.IsError() || result.IsNull()) { 825 if (result.IsError() || result.IsNull()) {
824 // TODO(turnidge): We could get better error messages by returning 826 // TODO(turnidge): We could get better error messages by returning
825 // the Error object directly to the parser. This will involve 827 // the Error object directly to the parser. This will involve
826 // replumbing all of the EvalConstExpr methods. 828 // replumbing all of the EvalConstExpr methods.
827 return NULL; 829 return NULL;
828 } 830 }
829 return &Instance::ZoneHandle(Instance::Cast(result).raw()); 831 return &Instance::ZoneHandle(Instance::Cast(result).raw());
830 } 832 }
831 833
832 } // namespace dart 834 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/string.cc ('k') | runtime/vm/ast_printer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698