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

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

Issue 2249783004: Cleanup: no need to pass Zone around when creating Ast nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/ast.h ('k') | 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 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/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 case k##Node: \ 156 case k##Node: \
157 return static_cast<const Node*>(this)->IsJump(); 157 return static_cast<const Node*>(this)->IsJump();
158 JUMP_NODE_LIST(GENERATE_CASE) 158 JUMP_NODE_LIST(GENERATE_CASE)
159 #undef GENERATE_CASE 159 #undef GENERATE_CASE
160 #undef JUMP_NODE_LIST 160 #undef JUMP_NODE_LIST
161 default: 161 default:
162 return false; 162 return false;
163 } 163 }
164 } 164 }
165 165
166 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position, 166 VariableProxy::VariableProxy(Variable* var, int start_position,
167 int end_position) 167 int end_position)
168 : Expression(zone, start_position, kVariableProxy), 168 : Expression(start_position, kVariableProxy),
169 bit_field_(IsThisField::encode(var->is_this()) | 169 bit_field_(IsThisField::encode(var->is_this()) |
170 IsAssignedField::encode(false) | 170 IsAssignedField::encode(false) |
171 IsResolvedField::encode(false)), 171 IsResolvedField::encode(false)),
172 end_position_(end_position), 172 end_position_(end_position),
173 raw_name_(var->raw_name()), 173 raw_name_(var->raw_name()),
174 next_unresolved_(nullptr) { 174 next_unresolved_(nullptr) {
175 BindTo(var); 175 BindTo(var);
176 } 176 }
177 177
178 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, 178 VariableProxy::VariableProxy(const AstRawString* name,
179 Variable::Kind variable_kind, int start_position, 179 Variable::Kind variable_kind, int start_position,
180 int end_position) 180 int end_position)
181 : Expression(zone, start_position, kVariableProxy), 181 : Expression(start_position, kVariableProxy),
182 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | 182 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) |
183 IsAssignedField::encode(false) | 183 IsAssignedField::encode(false) |
184 IsResolvedField::encode(false)), 184 IsResolvedField::encode(false)),
185 end_position_(end_position), 185 end_position_(end_position),
186 raw_name_(name), 186 raw_name_(name),
187 next_unresolved_(nullptr) {} 187 next_unresolved_(nullptr) {}
188 188
189 VariableProxy::VariableProxy(Zone* zone, const VariableProxy* copy_from) 189 VariableProxy::VariableProxy(const VariableProxy* copy_from)
190 : Expression(zone, copy_from->position(), kVariableProxy), 190 : Expression(copy_from->position(), kVariableProxy),
191 bit_field_(copy_from->bit_field_), 191 bit_field_(copy_from->bit_field_),
192 end_position_(copy_from->end_position_), 192 end_position_(copy_from->end_position_),
193 next_unresolved_(nullptr) { 193 next_unresolved_(nullptr) {
194 if (copy_from->is_resolved()) { 194 if (copy_from->is_resolved()) {
195 var_ = copy_from->var_; 195 var_ = copy_from->var_;
196 } else { 196 } else {
197 raw_name_ = copy_from->raw_name_; 197 raw_name_ = copy_from->raw_name_;
198 } 198 }
199 } 199 }
200 200
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 243 }
244 } 244 }
245 245
246 void ForInStatement::AssignFeedbackVectorSlots(Isolate* isolate, 246 void ForInStatement::AssignFeedbackVectorSlots(Isolate* isolate,
247 FeedbackVectorSpec* spec, 247 FeedbackVectorSpec* spec,
248 FeedbackVectorSlotCache* cache) { 248 FeedbackVectorSlotCache* cache) {
249 AssignVectorSlots(each(), spec, &each_slot_); 249 AssignVectorSlots(each(), spec, &each_slot_);
250 for_in_feedback_slot_ = spec->AddGeneralSlot(); 250 for_in_feedback_slot_ = spec->AddGeneralSlot();
251 } 251 }
252 252
253 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, 253 Assignment::Assignment(Token::Value op, Expression* target, Expression* value,
254 Expression* value, int pos) 254 int pos)
255 : Expression(zone, pos, kAssignment), 255 : Expression(pos, kAssignment),
256 bit_field_( 256 bit_field_(
257 IsUninitializedField::encode(false) | KeyTypeField::encode(ELEMENT) | 257 IsUninitializedField::encode(false) | KeyTypeField::encode(ELEMENT) |
258 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)), 258 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)),
259 target_(target), 259 target_(target),
260 value_(value), 260 value_(value),
261 binary_operation_(NULL) {} 261 binary_operation_(NULL) {}
262 262
263 void Assignment::AssignFeedbackVectorSlots(Isolate* isolate, 263 void Assignment::AssignFeedbackVectorSlots(Isolate* isolate,
264 FeedbackVectorSpec* spec, 264 FeedbackVectorSpec* spec,
265 FeedbackVectorSlotCache* cache) { 265 FeedbackVectorSlotCache* cache) {
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 if (property->key()->IsPropertyName()) { 928 if (property->key()->IsPropertyName()) {
929 return is_super ? NAMED_SUPER_PROPERTY_CALL : NAMED_PROPERTY_CALL; 929 return is_super ? NAMED_SUPER_PROPERTY_CALL : NAMED_PROPERTY_CALL;
930 } else { 930 } else {
931 return is_super ? KEYED_SUPER_PROPERTY_CALL : KEYED_PROPERTY_CALL; 931 return is_super ? KEYED_SUPER_PROPERTY_CALL : KEYED_PROPERTY_CALL;
932 } 932 }
933 } 933 }
934 934
935 return OTHER_CALL; 935 return OTHER_CALL;
936 } 936 }
937 937
938 938 CaseClause::CaseClause(Expression* label, ZoneList<Statement*>* statements,
939 CaseClause::CaseClause(Zone* zone, Expression* label, 939 int pos)
940 ZoneList<Statement*>* statements, int pos) 940 : Expression(pos, kCaseClause),
941 : Expression(zone, pos, kCaseClause),
942 label_(label), 941 label_(label),
943 statements_(statements), 942 statements_(statements),
944 compare_type_(Type::None()) {} 943 compare_type_(Type::None()) {}
945 944
946 uint32_t Literal::Hash() { 945 uint32_t Literal::Hash() {
947 return raw_value()->IsString() 946 return raw_value()->IsString()
948 ? raw_value()->AsString()->hash() 947 ? raw_value()->AsString()->hash()
949 : ComputeLongHash(double_to_uint64(raw_value()->AsNumber())); 948 : ComputeLongHash(double_to_uint64(raw_value()->AsNumber()));
950 } 949 }
951 950
952 951
953 // static 952 // static
954 bool Literal::Match(void* literal1, void* literal2) { 953 bool Literal::Match(void* literal1, void* literal2) {
955 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 954 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
956 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 955 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
957 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 956 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
958 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 957 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
959 } 958 }
960 959
961 } // namespace internal 960 } // namespace internal
962 } // namespace v8 961 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698