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

Side by Side Diff: src/ast.cc

Issue 883823002: Implement proper scoping for "this" in arrow functions Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased against master, plus fixes. Only 4 tests failing (+2 in TurboFan) Created 5 years, 9 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 | « src/ast.h ('k') | src/compiler/ast-graph-builder.h » ('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 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.h" 5 #include "src/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 #include "src/builtins.h" 8 #include "src/builtins.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 : Expression(zone, position), 63 : Expression(zone, position),
64 bit_field_(IsThisField::encode(var->is_this()) | 64 bit_field_(IsThisField::encode(var->is_this()) |
65 IsAssignedField::encode(false) | 65 IsAssignedField::encode(false) |
66 IsResolvedField::encode(false)), 66 IsResolvedField::encode(false)),
67 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), 67 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()),
68 raw_name_(var->raw_name()) { 68 raw_name_(var->raw_name()) {
69 BindTo(var); 69 BindTo(var);
70 } 70 }
71 71
72 72
73 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this, 73 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name,
74 int position) 74 Variable::Kind variable_kind, int position)
75 : Expression(zone, position), 75 : Expression(zone, position),
76 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) | 76 bit_field_(
77 IsResolvedField::encode(false)), 77 IsThisField::encode(variable_kind == Variable::THIS) |
78 IsAssignedField::encode(false) | IsResolvedField::encode(false) |
79 IsNewTargetField::encode(variable_kind == Variable::NEW_TARGET)),
78 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), 80 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()),
79 raw_name_(name) {} 81 raw_name_(name) {}
80 82
81 83
82 void VariableProxy::BindTo(Variable* var) { 84 void VariableProxy::BindTo(Variable* var) {
83 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); 85 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name());
84 set_var(var); 86 set_var(var);
85 set_is_resolved(); 87 set_is_resolved();
86 var->set_is_used(); 88 var->set_is_used();
87 } 89 }
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 // static 1011 // static
1010 bool Literal::Match(void* literal1, void* literal2) { 1012 bool Literal::Match(void* literal1, void* literal2) {
1011 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1013 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1012 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1014 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1013 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || 1015 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) ||
1014 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1016 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1015 } 1017 }
1016 1018
1017 1019
1018 } } // namespace v8::internal 1020 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/compiler/ast-graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698