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

Side by Side Diff: src/ast/ast.cc

Issue 2656753003: [ast/parsing] Pessimistically assume all top-level variables will be assigned. (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 | src/ast/scopes.cc » ('j') | src/parsing/parser.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ast/ast.h" 5 #include "src/ast/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 8
9 #include "src/ast/compile-time-value.h" 9 #include "src/ast/compile-time-value.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 bit_field_ = copy_from->bit_field_; 195 bit_field_ = copy_from->bit_field_;
196 DCHECK(!copy_from->is_resolved()); 196 DCHECK(!copy_from->is_resolved());
197 raw_name_ = copy_from->raw_name_; 197 raw_name_ = copy_from->raw_name_;
198 } 198 }
199 199
200 void VariableProxy::BindTo(Variable* var) { 200 void VariableProxy::BindTo(Variable* var) {
201 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); 201 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name());
202 set_var(var); 202 set_var(var);
203 set_is_resolved(); 203 set_is_resolved();
204 var->set_is_used(); 204 var->set_is_used();
205 if (is_assigned()) var->set_maybe_assigned();
205 } 206 }
206 207
207 void VariableProxy::AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, 208 void VariableProxy::AssignFeedbackVectorSlots(FeedbackVectorSpec* spec,
208 FeedbackVectorSlotCache* cache) { 209 FeedbackVectorSlotCache* cache) {
209 if (UsesVariableFeedbackSlot()) { 210 if (UsesVariableFeedbackSlot()) {
210 // VariableProxies that point to the same Variable within a function can 211 // VariableProxies that point to the same Variable within a function can
211 // make their loads from the same IC slot. 212 // make their loads from the same IC slot.
212 if (var()->IsUnallocated() || var()->mode() == DYNAMIC_GLOBAL) { 213 if (var()->IsUnallocated() || var()->mode() == DYNAMIC_GLOBAL) {
213 ZoneHashMap::Entry* entry = cache->Get(var()); 214 ZoneHashMap::Entry* entry = cache->Get(var());
214 if (entry != NULL) { 215 if (entry != NULL) {
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 // static 1060 // static
1060 bool Literal::Match(void* literal1, void* literal2) { 1061 bool Literal::Match(void* literal1, void* literal2) {
1061 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1062 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1062 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1063 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1063 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1064 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1064 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1065 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1065 } 1066 }
1066 1067
1067 } // namespace internal 1068 } // namespace internal
1068 } // namespace v8 1069 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | src/parsing/parser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698