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

Side by Side Diff: src/ast.cc

Issue 1083193005: WIP: new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix return from new func Created 5 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 | « src/ast.h ('k') | src/ast-numbering.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 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // else could be reassigned. 56 // else could be reassigned.
57 return var != NULL && var->location() == Variable::UNALLOCATED && 57 return var != NULL && var->location() == Variable::UNALLOCATED &&
58 var_proxy->raw_name()->IsOneByteEqualTo("undefined"); 58 var_proxy->raw_name()->IsOneByteEqualTo("undefined");
59 } 59 }
60 60
61 61
62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position, 62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position,
63 int end_position) 63 int end_position)
64 : Expression(zone, start_position), 64 : Expression(zone, start_position),
65 bit_field_(IsThisField::encode(var->is_this()) | 65 bit_field_(IsThisField::encode(var->is_this()) |
66 IsNewTargetField::encode(var->is_new_target()) |
66 IsAssignedField::encode(false) | 67 IsAssignedField::encode(false) |
67 IsResolvedField::encode(false)), 68 IsResolvedField::encode(false)),
68 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), 69 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()),
69 raw_name_(var->raw_name()), 70 raw_name_(var->raw_name()),
70 end_position_(end_position) { 71 end_position_(end_position) {
71 BindTo(var); 72 BindTo(var);
72 } 73 }
73 74
74 75
75 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, 76 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name,
76 Variable::Kind variable_kind, int start_position, 77 Variable::Kind variable_kind, int start_position,
77 int end_position) 78 int end_position)
78 : Expression(zone, start_position), 79 : Expression(zone, start_position),
79 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | 80 bit_field_(
80 IsAssignedField::encode(false) | 81 IsThisField::encode(variable_kind == Variable::THIS) |
81 IsResolvedField::encode(false)), 82 IsNewTargetField::encode(variable_kind == Variable::NEW_TARGET) |
83 IsAssignedField::encode(false) | IsResolvedField::encode(false)),
82 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), 84 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()),
83 raw_name_(name), 85 raw_name_(name),
84 end_position_(end_position) {} 86 end_position_(end_position) {}
85 87
86 88
87 void VariableProxy::BindTo(Variable* var) { 89 void VariableProxy::BindTo(Variable* var) {
88 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); 90 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name() ||
91 is_new_target() && var->is_new_target());
89 set_var(var); 92 set_var(var);
90 set_is_resolved(); 93 set_is_resolved();
91 var->set_is_used(); 94 var->set_is_used();
92 } 95 }
93 96
94 97
95 void VariableProxy::SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 98 void VariableProxy::SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
96 ICSlotCache* cache) { 99 ICSlotCache* cache) {
97 variable_feedback_slot_ = slot; 100 variable_feedback_slot_ = slot;
98 if (var()->IsUnallocated()) { 101 if (var()->IsUnallocated()) {
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 // static 1006 // static
1004 bool Literal::Match(void* literal1, void* literal2) { 1007 bool Literal::Match(void* literal1, void* literal2) {
1005 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1008 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1006 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1009 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1007 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1010 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1008 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1011 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1009 } 1012 }
1010 1013
1011 1014
1012 } } // namespace v8::internal 1015 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/ast-numbering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698