OLD | NEW |
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 #ifndef V8_AST_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/ast/ast-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
9 #include "src/ast/modules.h" | 9 #include "src/ast/modules.h" |
10 #include "src/ast/variables.h" | 10 #include "src/ast/variables.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // ---------------------------------------------------------------------------- | 36 // ---------------------------------------------------------------------------- |
37 // Nodes of the abstract syntax tree. Only concrete classes are | 37 // Nodes of the abstract syntax tree. Only concrete classes are |
38 // enumerated here. | 38 // enumerated here. |
39 | 39 |
40 #define DECLARATION_NODE_LIST(V) \ | 40 #define DECLARATION_NODE_LIST(V) \ |
41 V(VariableDeclaration) \ | 41 V(VariableDeclaration) \ |
42 V(FunctionDeclaration) \ | 42 V(FunctionDeclaration) \ |
43 V(ImportDeclaration) | 43 V(ImportDeclaration) |
44 | 44 |
| 45 #define ITERATION_NODE_LIST(V) \ |
| 46 V(DoWhileStatement) \ |
| 47 V(WhileStatement) \ |
| 48 V(ForStatement) \ |
| 49 V(ForInStatement) \ |
| 50 V(ForOfStatement) |
| 51 |
| 52 #define BREAKABLE_NODE_LIST(V) \ |
| 53 V(Block) \ |
| 54 V(SwitchStatement) |
| 55 |
45 #define STATEMENT_NODE_LIST(V) \ | 56 #define STATEMENT_NODE_LIST(V) \ |
46 V(Block) \ | 57 ITERATION_NODE_LIST(V) \ |
| 58 BREAKABLE_NODE_LIST(V) \ |
47 V(ExpressionStatement) \ | 59 V(ExpressionStatement) \ |
48 V(EmptyStatement) \ | 60 V(EmptyStatement) \ |
49 V(SloppyBlockFunctionStatement) \ | 61 V(SloppyBlockFunctionStatement) \ |
50 V(IfStatement) \ | 62 V(IfStatement) \ |
51 V(ContinueStatement) \ | 63 V(ContinueStatement) \ |
52 V(BreakStatement) \ | 64 V(BreakStatement) \ |
53 V(ReturnStatement) \ | 65 V(ReturnStatement) \ |
54 V(WithStatement) \ | 66 V(WithStatement) \ |
55 V(SwitchStatement) \ | |
56 V(DoWhileStatement) \ | |
57 V(WhileStatement) \ | |
58 V(ForStatement) \ | |
59 V(ForInStatement) \ | |
60 V(ForOfStatement) \ | |
61 V(TryCatchStatement) \ | 67 V(TryCatchStatement) \ |
62 V(TryFinallyStatement) \ | 68 V(TryFinallyStatement) \ |
63 V(DebuggerStatement) | 69 V(DebuggerStatement) |
64 | 70 |
| 71 #define LITERAL_NODE_LIST(V) \ |
| 72 V(RegExpLiteral) \ |
| 73 V(ObjectLiteral) \ |
| 74 V(ArrayLiteral) |
| 75 |
| 76 #define PROPERTY_NODE_LIST(V) \ |
| 77 V(Assignment) \ |
| 78 V(CountOperation) \ |
| 79 V(Property) |
| 80 |
| 81 #define CALL_NODE_LIST(V) \ |
| 82 V(Call) \ |
| 83 V(CallNew) |
| 84 |
65 #define EXPRESSION_NODE_LIST(V) \ | 85 #define EXPRESSION_NODE_LIST(V) \ |
| 86 LITERAL_NODE_LIST(V) \ |
| 87 PROPERTY_NODE_LIST(V) \ |
| 88 CALL_NODE_LIST(V) \ |
66 V(FunctionLiteral) \ | 89 V(FunctionLiteral) \ |
67 V(ClassLiteral) \ | 90 V(ClassLiteral) \ |
68 V(NativeFunctionLiteral) \ | 91 V(NativeFunctionLiteral) \ |
69 V(Conditional) \ | 92 V(Conditional) \ |
70 V(VariableProxy) \ | 93 V(VariableProxy) \ |
71 V(Literal) \ | 94 V(Literal) \ |
72 V(RegExpLiteral) \ | |
73 V(ObjectLiteral) \ | |
74 V(ArrayLiteral) \ | |
75 V(Assignment) \ | |
76 V(Yield) \ | 95 V(Yield) \ |
77 V(Throw) \ | 96 V(Throw) \ |
78 V(Property) \ | |
79 V(Call) \ | |
80 V(CallNew) \ | |
81 V(CallRuntime) \ | 97 V(CallRuntime) \ |
82 V(UnaryOperation) \ | 98 V(UnaryOperation) \ |
83 V(CountOperation) \ | |
84 V(BinaryOperation) \ | 99 V(BinaryOperation) \ |
85 V(CompareOperation) \ | 100 V(CompareOperation) \ |
86 V(Spread) \ | 101 V(Spread) \ |
87 V(ThisFunction) \ | 102 V(ThisFunction) \ |
88 V(SuperPropertyReference) \ | 103 V(SuperPropertyReference) \ |
89 V(SuperCallReference) \ | 104 V(SuperCallReference) \ |
90 V(CaseClause) \ | 105 V(CaseClause) \ |
91 V(EmptyParentheses) \ | 106 V(EmptyParentheses) \ |
92 V(DoExpression) \ | 107 V(DoExpression) \ |
93 V(RewritableExpression) | 108 V(RewritableExpression) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 #endif // DEBUG | 216 #endif // DEBUG |
202 | 217 |
203 // Type testing & conversion functions overridden by concrete subclasses. | 218 // Type testing & conversion functions overridden by concrete subclasses. |
204 #define DECLARE_NODE_FUNCTIONS(type) \ | 219 #define DECLARE_NODE_FUNCTIONS(type) \ |
205 V8_INLINE bool Is##type() const; \ | 220 V8_INLINE bool Is##type() const; \ |
206 V8_INLINE type* As##type(); \ | 221 V8_INLINE type* As##type(); \ |
207 V8_INLINE const type* As##type() const; | 222 V8_INLINE const type* As##type() const; |
208 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 223 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
209 #undef DECLARE_NODE_FUNCTIONS | 224 #undef DECLARE_NODE_FUNCTIONS |
210 | 225 |
211 virtual BreakableStatement* AsBreakableStatement() { return NULL; } | 226 BreakableStatement* AsBreakableStatement(); |
212 virtual IterationStatement* AsIterationStatement() { return NULL; } | 227 IterationStatement* AsIterationStatement(); |
213 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } | 228 MaterializedLiteral* AsMaterializedLiteral(); |
214 | 229 |
215 private: | 230 private: |
216 // Hidden to prevent accidental usage. It would have to load the | 231 // Hidden to prevent accidental usage. It would have to load the |
217 // current zone from the TLS. | 232 // current zone from the TLS. |
218 void* operator new(size_t size); | 233 void* operator new(size_t size); |
219 | 234 |
220 friend class CaseClause; // Generates AST IDs. | 235 friend class CaseClause; // Generates AST IDs. |
221 | 236 |
222 int position_; | 237 int position_; |
223 }; | 238 }; |
224 | 239 |
225 | 240 |
226 class Statement : public AstNode { | 241 class Statement : public AstNode { |
227 public: | 242 public: |
228 explicit Statement(Zone* zone, int position) : AstNode(position) {} | 243 explicit Statement(Zone* zone, int position) : AstNode(position) {} |
229 | 244 |
230 bool IsEmpty() { return AsEmptyStatement() != NULL; } | 245 bool IsEmpty() { return AsEmptyStatement() != NULL; } |
231 virtual bool IsJump() const { return false; } | 246 bool IsJump() const; |
232 }; | 247 }; |
233 | 248 |
234 | 249 |
235 class SmallMapList final { | 250 class SmallMapList final { |
236 public: | 251 public: |
237 SmallMapList() {} | 252 SmallMapList() {} |
238 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} | 253 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} |
239 | 254 |
240 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } | 255 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } |
241 void Clear() { list_.Clear(); } | 256 void Clear() { list_.Clear(); } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 kUninitialized, | 302 kUninitialized, |
288 // Evaluated for its side effects. | 303 // Evaluated for its side effects. |
289 kEffect, | 304 kEffect, |
290 // Evaluated for its value (and side effects). | 305 // Evaluated for its value (and side effects). |
291 kValue, | 306 kValue, |
292 // Evaluated for control flow (and side effects). | 307 // Evaluated for control flow (and side effects). |
293 kTest | 308 kTest |
294 }; | 309 }; |
295 | 310 |
296 // Mark this expression as being in tail position. | 311 // Mark this expression as being in tail position. |
297 virtual void MarkTail() {} | 312 void MarkTail(); |
298 | 313 |
299 // True iff the expression is a valid reference expression. | 314 // True iff the expression is a valid reference expression. |
300 virtual bool IsValidReferenceExpression() const { return false; } | 315 bool IsValidReferenceExpression() const; |
301 | 316 |
302 // Helpers for ToBoolean conversion. | 317 // Helpers for ToBoolean conversion. |
303 virtual bool ToBooleanIsTrue() const { return false; } | 318 bool ToBooleanIsTrue() const; |
304 virtual bool ToBooleanIsFalse() const { return false; } | 319 bool ToBooleanIsFalse() const; |
305 | 320 |
306 // Symbols that cannot be parsed as array indices are considered property | 321 // Symbols that cannot be parsed as array indices are considered property |
307 // names. We do not treat symbols that can be array indexes as property | 322 // names. We do not treat symbols that can be array indexes as property |
308 // names because [] for string objects is handled only by keyed ICs. | 323 // names because [] for string objects is handled only by keyed ICs. |
309 virtual bool IsPropertyName() const { return false; } | 324 bool IsPropertyName() const; |
310 | 325 |
311 // True iff the expression is a class or function expression without | 326 // True iff the expression is a class or function expression without |
312 // a syntactic name. | 327 // a syntactic name. |
313 virtual bool IsAnonymousFunctionDefinition() const { return false; } | 328 bool IsAnonymousFunctionDefinition() const; |
314 | 329 |
315 // True iff the expression is a literal represented as a smi. | 330 // True iff the expression is a literal represented as a smi. |
316 bool IsSmiLiteral() const; | 331 bool IsSmiLiteral() const; |
317 | 332 |
318 // True iff the expression is a string literal. | 333 // True iff the expression is a string literal. |
319 bool IsStringLiteral() const; | 334 bool IsStringLiteral() const; |
320 | 335 |
321 // True iff the expression is the null literal. | 336 // True iff the expression is the null literal. |
322 bool IsNullLiteral() const; | 337 bool IsNullLiteral() const; |
323 | 338 |
324 // True if we can prove that the expression is the undefined literal. Note | 339 // True if we can prove that the expression is the undefined literal. Note |
325 // that this also checks for loads of the global "undefined" variable. | 340 // that this also checks for loads of the global "undefined" variable. |
326 bool IsUndefinedLiteral() const; | 341 bool IsUndefinedLiteral() const; |
327 | 342 |
328 // True iff the expression is a valid target for an assignment. | 343 // True iff the expression is a valid target for an assignment. |
329 bool IsValidReferenceExpressionOrThis() const; | 344 bool IsValidReferenceExpressionOrThis() const; |
330 | 345 |
331 // Type feedback information for assignments and properties. | |
332 virtual bool IsMonomorphic() { | |
333 UNREACHABLE(); | |
334 return false; | |
335 } | |
336 virtual SmallMapList* GetReceiverTypes() { | |
337 UNREACHABLE(); | |
338 return NULL; | |
339 } | |
340 virtual KeyedAccessStoreMode GetStoreMode() const { | |
341 UNREACHABLE(); | |
342 return STANDARD_STORE; | |
343 } | |
344 virtual IcCheckType GetKeyType() const { | |
345 UNREACHABLE(); | |
346 return ELEMENT; | |
347 } | |
348 | |
349 // TODO(rossberg): this should move to its own AST node eventually. | 346 // TODO(rossberg): this should move to its own AST node eventually. |
350 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 347 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
351 uint16_t to_boolean_types() const { | 348 uint16_t to_boolean_types() const { |
352 return ToBooleanTypesField::decode(bit_field_); | 349 return ToBooleanTypesField::decode(bit_field_); |
353 } | 350 } |
354 | 351 |
| 352 SmallMapList* GetReceiverTypes(); |
| 353 KeyedAccessStoreMode GetStoreMode() const; |
| 354 IcCheckType GetKeyType() const; |
| 355 bool IsMonomorphic() const; |
| 356 |
355 void set_base_id(int id) { base_id_ = id; } | 357 void set_base_id(int id) { base_id_ = id; } |
356 static int num_ids() { return parent_num_ids() + 2; } | 358 static int num_ids() { return parent_num_ids() + 2; } |
357 BailoutId id() const { return BailoutId(local_id(0)); } | 359 BailoutId id() const { return BailoutId(local_id(0)); } |
358 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } | 360 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } |
359 | 361 |
360 protected: | 362 protected: |
361 Expression(Zone* zone, int pos) | 363 Expression(Zone* zone, int pos) |
362 : AstNode(pos), | 364 : AstNode(pos), |
363 base_id_(BailoutId::None().ToInt()), | 365 base_id_(BailoutId::None().ToInt()), |
364 bit_field_(0) {} | 366 bit_field_(0) {} |
(...skipping 22 matching lines...) Expand all Loading... |
387 public: | 389 public: |
388 enum BreakableType { | 390 enum BreakableType { |
389 TARGET_FOR_ANONYMOUS, | 391 TARGET_FOR_ANONYMOUS, |
390 TARGET_FOR_NAMED_ONLY | 392 TARGET_FOR_NAMED_ONLY |
391 }; | 393 }; |
392 | 394 |
393 // The labels associated with this statement. May be NULL; | 395 // The labels associated with this statement. May be NULL; |
394 // if it is != NULL, guaranteed to contain at least one entry. | 396 // if it is != NULL, guaranteed to contain at least one entry. |
395 ZoneList<const AstRawString*>* labels() const { return labels_; } | 397 ZoneList<const AstRawString*>* labels() const { return labels_; } |
396 | 398 |
397 // Type testing & conversion. | |
398 BreakableStatement* AsBreakableStatement() final { return this; } | |
399 | |
400 // Code generation | 399 // Code generation |
401 Label* break_target() { return &break_target_; } | 400 Label* break_target() { return &break_target_; } |
402 | 401 |
403 // Testers. | 402 // Testers. |
404 bool is_target_for_anonymous() const { | 403 bool is_target_for_anonymous() const { |
405 return breakable_type_ == TARGET_FOR_ANONYMOUS; | 404 return breakable_type_ == TARGET_FOR_ANONYMOUS; |
406 } | 405 } |
407 | 406 |
408 void set_base_id(int id) { base_id_ = id; } | 407 void set_base_id(int id) { base_id_ = id; } |
409 static int num_ids() { return parent_num_ids() + 2; } | 408 static int num_ids() { return parent_num_ids() + 2; } |
(...skipping 29 matching lines...) Expand all Loading... |
439 class Block final : public BreakableStatement { | 438 class Block final : public BreakableStatement { |
440 public: | 439 public: |
441 DECLARE_NODE_TYPE(Block) | 440 DECLARE_NODE_TYPE(Block) |
442 | 441 |
443 ZoneList<Statement*>* statements() { return &statements_; } | 442 ZoneList<Statement*>* statements() { return &statements_; } |
444 bool ignore_completion_value() const { return ignore_completion_value_; } | 443 bool ignore_completion_value() const { return ignore_completion_value_; } |
445 | 444 |
446 static int num_ids() { return parent_num_ids() + 1; } | 445 static int num_ids() { return parent_num_ids() + 1; } |
447 BailoutId DeclsId() const { return BailoutId(local_id(0)); } | 446 BailoutId DeclsId() const { return BailoutId(local_id(0)); } |
448 | 447 |
449 bool IsJump() const override { | 448 bool IsJump() const { |
450 return !statements_.is_empty() && statements_.last()->IsJump() | 449 return !statements_.is_empty() && statements_.last()->IsJump() |
451 && labels() == NULL; // Good enough as an approximation... | 450 && labels() == NULL; // Good enough as an approximation... |
452 } | 451 } |
453 | 452 |
454 Scope* scope() const { return scope_; } | 453 Scope* scope() const { return scope_; } |
455 void set_scope(Scope* scope) { scope_ = scope; } | 454 void set_scope(Scope* scope) { scope_ = scope; } |
456 | 455 |
457 protected: | 456 protected: |
458 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, | 457 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, |
459 bool ignore_completion_value, int pos) | 458 bool ignore_completion_value, int pos) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 Block* block_; | 494 Block* block_; |
496 VariableProxy* result_; | 495 VariableProxy* result_; |
497 }; | 496 }; |
498 | 497 |
499 | 498 |
500 class Declaration : public AstNode { | 499 class Declaration : public AstNode { |
501 public: | 500 public: |
502 VariableProxy* proxy() const { return proxy_; } | 501 VariableProxy* proxy() const { return proxy_; } |
503 VariableMode mode() const { return mode_; } | 502 VariableMode mode() const { return mode_; } |
504 Scope* scope() const { return scope_; } | 503 Scope* scope() const { return scope_; } |
505 virtual InitializationFlag initialization() const = 0; | 504 InitializationFlag initialization() const; |
506 | 505 |
507 protected: | 506 protected: |
508 Declaration(Zone* zone, VariableProxy* proxy, VariableMode mode, Scope* scope, | 507 Declaration(Zone* zone, VariableProxy* proxy, VariableMode mode, Scope* scope, |
509 int pos) | 508 int pos) |
510 : AstNode(pos), mode_(mode), proxy_(proxy), scope_(scope) { | 509 : AstNode(pos), mode_(mode), proxy_(proxy), scope_(scope) { |
511 DCHECK(IsDeclaredVariableMode(mode)); | 510 DCHECK(IsDeclaredVariableMode(mode)); |
512 } | 511 } |
513 | 512 |
514 private: | 513 private: |
515 VariableMode mode_; | 514 VariableMode mode_; |
516 VariableProxy* proxy_; | 515 VariableProxy* proxy_; |
517 | 516 |
518 // Nested scope from which the declaration originated. | 517 // Nested scope from which the declaration originated. |
519 Scope* scope_; | 518 Scope* scope_; |
520 }; | 519 }; |
521 | 520 |
522 | 521 |
523 class VariableDeclaration final : public Declaration { | 522 class VariableDeclaration final : public Declaration { |
524 public: | 523 public: |
525 DECLARE_NODE_TYPE(VariableDeclaration) | 524 DECLARE_NODE_TYPE(VariableDeclaration) |
526 | 525 |
527 InitializationFlag initialization() const override { | 526 InitializationFlag initialization() const { |
528 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; | 527 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; |
529 } | 528 } |
530 | 529 |
531 protected: | 530 protected: |
532 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode, | 531 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode, |
533 Scope* scope, int pos) | 532 Scope* scope, int pos) |
534 : Declaration(zone, proxy, mode, scope, pos) {} | 533 : Declaration(zone, proxy, mode, scope, pos) {} |
535 }; | 534 }; |
536 | 535 |
537 | 536 |
538 class FunctionDeclaration final : public Declaration { | 537 class FunctionDeclaration final : public Declaration { |
539 public: | 538 public: |
540 DECLARE_NODE_TYPE(FunctionDeclaration) | 539 DECLARE_NODE_TYPE(FunctionDeclaration) |
541 | 540 |
542 FunctionLiteral* fun() const { return fun_; } | 541 FunctionLiteral* fun() const { return fun_; } |
543 void set_fun(FunctionLiteral* f) { fun_ = f; } | 542 void set_fun(FunctionLiteral* f) { fun_ = f; } |
544 InitializationFlag initialization() const override { | 543 InitializationFlag initialization() const { return kCreatedInitialized; } |
545 return kCreatedInitialized; | |
546 } | |
547 | 544 |
548 protected: | 545 protected: |
549 FunctionDeclaration(Zone* zone, | 546 FunctionDeclaration(Zone* zone, |
550 VariableProxy* proxy, | 547 VariableProxy* proxy, |
551 VariableMode mode, | 548 VariableMode mode, |
552 FunctionLiteral* fun, | 549 FunctionLiteral* fun, |
553 Scope* scope, | 550 Scope* scope, |
554 int pos) | 551 int pos) |
555 : Declaration(zone, proxy, mode, scope, pos), | 552 : Declaration(zone, proxy, mode, scope, pos), |
556 fun_(fun) { | 553 fun_(fun) { |
557 DCHECK(mode == VAR || mode == LET || mode == CONST); | 554 DCHECK(mode == VAR || mode == LET || mode == CONST); |
558 DCHECK(fun != NULL); | 555 DCHECK(fun != NULL); |
559 } | 556 } |
560 | 557 |
561 private: | 558 private: |
562 FunctionLiteral* fun_; | 559 FunctionLiteral* fun_; |
563 }; | 560 }; |
564 | 561 |
565 | 562 |
566 class ImportDeclaration final : public Declaration { | 563 class ImportDeclaration final : public Declaration { |
567 public: | 564 public: |
568 DECLARE_NODE_TYPE(ImportDeclaration) | 565 DECLARE_NODE_TYPE(ImportDeclaration) |
569 | 566 |
570 const AstRawString* import_name() const { return import_name_; } | 567 const AstRawString* import_name() const { return import_name_; } |
571 const AstRawString* module_specifier() const { return module_specifier_; } | 568 const AstRawString* module_specifier() const { return module_specifier_; } |
572 void set_module_specifier(const AstRawString* module_specifier) { | 569 void set_module_specifier(const AstRawString* module_specifier) { |
573 DCHECK(module_specifier_ == NULL); | 570 DCHECK(module_specifier_ == NULL); |
574 module_specifier_ = module_specifier; | 571 module_specifier_ = module_specifier; |
575 } | 572 } |
576 InitializationFlag initialization() const override { | 573 InitializationFlag initialization() const { return kNeedsInitialization; } |
577 return kNeedsInitialization; | |
578 } | |
579 | 574 |
580 protected: | 575 protected: |
581 ImportDeclaration(Zone* zone, VariableProxy* proxy, | 576 ImportDeclaration(Zone* zone, VariableProxy* proxy, |
582 const AstRawString* import_name, | 577 const AstRawString* import_name, |
583 const AstRawString* module_specifier, Scope* scope, int pos) | 578 const AstRawString* module_specifier, Scope* scope, int pos) |
584 : Declaration(zone, proxy, CONST, scope, pos), | 579 : Declaration(zone, proxy, CONST, scope, pos), |
585 import_name_(import_name), | 580 import_name_(import_name), |
586 module_specifier_(module_specifier) {} | 581 module_specifier_(module_specifier) {} |
587 | 582 |
588 private: | 583 private: |
(...skipping 14 matching lines...) Expand all Loading... |
603 : AstNode(pos), descriptor_(descriptor), body_(body) {} | 598 : AstNode(pos), descriptor_(descriptor), body_(body) {} |
604 | 599 |
605 private: | 600 private: |
606 ModuleDescriptor* descriptor_; | 601 ModuleDescriptor* descriptor_; |
607 Block* body_; | 602 Block* body_; |
608 }; | 603 }; |
609 | 604 |
610 | 605 |
611 class IterationStatement : public BreakableStatement { | 606 class IterationStatement : public BreakableStatement { |
612 public: | 607 public: |
613 // Type testing & conversion. | |
614 IterationStatement* AsIterationStatement() final { return this; } | |
615 | |
616 Statement* body() const { return body_; } | 608 Statement* body() const { return body_; } |
617 void set_body(Statement* s) { body_ = s; } | 609 void set_body(Statement* s) { body_ = s; } |
618 | 610 |
619 int yield_count() const { return yield_count_; } | 611 int yield_count() const { return yield_count_; } |
620 int first_yield_id() const { return first_yield_id_; } | 612 int first_yield_id() const { return first_yield_id_; } |
621 void set_yield_count(int yield_count) { yield_count_ = yield_count; } | 613 void set_yield_count(int yield_count) { yield_count_ = yield_count; } |
622 void set_first_yield_id(int first_yield_id) { | 614 void set_first_yield_id(int first_yield_id) { |
623 first_yield_id_ = first_yield_id; | 615 first_yield_id_ = first_yield_id; |
624 } | 616 } |
625 | 617 |
626 static int num_ids() { return parent_num_ids() + 1; } | 618 static int num_ids() { return parent_num_ids() + 1; } |
627 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); } | 619 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); } |
628 virtual BailoutId ContinueId() const = 0; | |
629 virtual BailoutId StackCheckId() const = 0; | |
630 | 620 |
631 // Code generation | 621 // Code generation |
632 Label* continue_target() { return &continue_target_; } | 622 Label* continue_target() { return &continue_target_; } |
633 | 623 |
634 protected: | 624 protected: |
635 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 625 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
636 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), | 626 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), |
637 body_(NULL), | 627 body_(NULL), |
638 yield_count_(0), | 628 yield_count_(0), |
639 first_yield_id_(0) {} | 629 first_yield_id_(0) {} |
(...skipping 16 matching lines...) Expand all Loading... |
656 | 646 |
657 void Initialize(Expression* cond, Statement* body) { | 647 void Initialize(Expression* cond, Statement* body) { |
658 IterationStatement::Initialize(body); | 648 IterationStatement::Initialize(body); |
659 cond_ = cond; | 649 cond_ = cond; |
660 } | 650 } |
661 | 651 |
662 Expression* cond() const { return cond_; } | 652 Expression* cond() const { return cond_; } |
663 void set_cond(Expression* e) { cond_ = e; } | 653 void set_cond(Expression* e) { cond_ = e; } |
664 | 654 |
665 static int num_ids() { return parent_num_ids() + 2; } | 655 static int num_ids() { return parent_num_ids() + 2; } |
666 BailoutId ContinueId() const override { return BailoutId(local_id(0)); } | 656 BailoutId ContinueId() const { return BailoutId(local_id(0)); } |
667 BailoutId StackCheckId() const override { return BackEdgeId(); } | 657 BailoutId StackCheckId() const { return BackEdgeId(); } |
668 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); } | 658 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); } |
669 | 659 |
670 protected: | 660 protected: |
671 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 661 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
672 : IterationStatement(zone, labels, pos), cond_(NULL) {} | 662 : IterationStatement(zone, labels, pos), cond_(NULL) {} |
673 static int parent_num_ids() { return IterationStatement::num_ids(); } | 663 static int parent_num_ids() { return IterationStatement::num_ids(); } |
674 | 664 |
675 private: | 665 private: |
676 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 666 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
677 | 667 |
678 Expression* cond_; | 668 Expression* cond_; |
679 }; | 669 }; |
680 | 670 |
681 | 671 |
682 class WhileStatement final : public IterationStatement { | 672 class WhileStatement final : public IterationStatement { |
683 public: | 673 public: |
684 DECLARE_NODE_TYPE(WhileStatement) | 674 DECLARE_NODE_TYPE(WhileStatement) |
685 | 675 |
686 void Initialize(Expression* cond, Statement* body) { | 676 void Initialize(Expression* cond, Statement* body) { |
687 IterationStatement::Initialize(body); | 677 IterationStatement::Initialize(body); |
688 cond_ = cond; | 678 cond_ = cond; |
689 } | 679 } |
690 | 680 |
691 Expression* cond() const { return cond_; } | 681 Expression* cond() const { return cond_; } |
692 void set_cond(Expression* e) { cond_ = e; } | 682 void set_cond(Expression* e) { cond_ = e; } |
693 | 683 |
694 static int num_ids() { return parent_num_ids() + 1; } | 684 static int num_ids() { return parent_num_ids() + 1; } |
695 BailoutId ContinueId() const override { return EntryId(); } | 685 BailoutId ContinueId() const { return EntryId(); } |
696 BailoutId StackCheckId() const override { return BodyId(); } | 686 BailoutId StackCheckId() const { return BodyId(); } |
697 BailoutId BodyId() const { return BailoutId(local_id(0)); } | 687 BailoutId BodyId() const { return BailoutId(local_id(0)); } |
698 | 688 |
699 protected: | 689 protected: |
700 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 690 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
701 : IterationStatement(zone, labels, pos), cond_(NULL) {} | 691 : IterationStatement(zone, labels, pos), cond_(NULL) {} |
702 static int parent_num_ids() { return IterationStatement::num_ids(); } | 692 static int parent_num_ids() { return IterationStatement::num_ids(); } |
703 | 693 |
704 private: | 694 private: |
705 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 695 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
706 | 696 |
(...skipping 17 matching lines...) Expand all Loading... |
724 | 714 |
725 Statement* init() const { return init_; } | 715 Statement* init() const { return init_; } |
726 Expression* cond() const { return cond_; } | 716 Expression* cond() const { return cond_; } |
727 Statement* next() const { return next_; } | 717 Statement* next() const { return next_; } |
728 | 718 |
729 void set_init(Statement* s) { init_ = s; } | 719 void set_init(Statement* s) { init_ = s; } |
730 void set_cond(Expression* e) { cond_ = e; } | 720 void set_cond(Expression* e) { cond_ = e; } |
731 void set_next(Statement* s) { next_ = s; } | 721 void set_next(Statement* s) { next_ = s; } |
732 | 722 |
733 static int num_ids() { return parent_num_ids() + 2; } | 723 static int num_ids() { return parent_num_ids() + 2; } |
734 BailoutId ContinueId() const override { return BailoutId(local_id(0)); } | 724 BailoutId ContinueId() const { return BailoutId(local_id(0)); } |
735 BailoutId StackCheckId() const override { return BodyId(); } | 725 BailoutId StackCheckId() const { return BodyId(); } |
736 BailoutId BodyId() const { return BailoutId(local_id(1)); } | 726 BailoutId BodyId() const { return BailoutId(local_id(1)); } |
737 | 727 |
738 protected: | 728 protected: |
739 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 729 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
740 : IterationStatement(zone, labels, pos), | 730 : IterationStatement(zone, labels, pos), |
741 init_(NULL), | 731 init_(NULL), |
742 cond_(NULL), | 732 cond_(NULL), |
743 next_(NULL) {} | 733 next_(NULL) {} |
744 static int parent_num_ids() { return IterationStatement::num_ids(); } | 734 static int parent_num_ids() { return IterationStatement::num_ids(); } |
745 | 735 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 ForInType for_in_type() const { return for_in_type_; } | 794 ForInType for_in_type() const { return for_in_type_; } |
805 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 795 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
806 | 796 |
807 static int num_ids() { return parent_num_ids() + 6; } | 797 static int num_ids() { return parent_num_ids() + 6; } |
808 BailoutId BodyId() const { return BailoutId(local_id(0)); } | 798 BailoutId BodyId() const { return BailoutId(local_id(0)); } |
809 BailoutId EnumId() const { return BailoutId(local_id(1)); } | 799 BailoutId EnumId() const { return BailoutId(local_id(1)); } |
810 BailoutId ToObjectId() const { return BailoutId(local_id(2)); } | 800 BailoutId ToObjectId() const { return BailoutId(local_id(2)); } |
811 BailoutId PrepareId() const { return BailoutId(local_id(3)); } | 801 BailoutId PrepareId() const { return BailoutId(local_id(3)); } |
812 BailoutId FilterId() const { return BailoutId(local_id(4)); } | 802 BailoutId FilterId() const { return BailoutId(local_id(4)); } |
813 BailoutId AssignmentId() const { return BailoutId(local_id(5)); } | 803 BailoutId AssignmentId() const { return BailoutId(local_id(5)); } |
814 BailoutId ContinueId() const override { return EntryId(); } | 804 BailoutId ContinueId() const { return EntryId(); } |
815 BailoutId StackCheckId() const override { return BodyId(); } | 805 BailoutId StackCheckId() const { return BodyId(); } |
816 | 806 |
817 protected: | 807 protected: |
818 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 808 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
819 : ForEachStatement(zone, labels, pos), | 809 : ForEachStatement(zone, labels, pos), |
820 each_(nullptr), | 810 each_(nullptr), |
821 subject_(nullptr), | 811 subject_(nullptr), |
822 for_in_type_(SLOW_FOR_IN) {} | 812 for_in_type_(SLOW_FOR_IN) {} |
823 static int parent_num_ids() { return ForEachStatement::num_ids(); } | 813 static int parent_num_ids() { return ForEachStatement::num_ids(); } |
824 | 814 |
825 private: | 815 private: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 // each = result.value | 860 // each = result.value |
871 Expression* assign_each() const { | 861 Expression* assign_each() const { |
872 return assign_each_; | 862 return assign_each_; |
873 } | 863 } |
874 | 864 |
875 void set_assign_iterator(Expression* e) { assign_iterator_ = e; } | 865 void set_assign_iterator(Expression* e) { assign_iterator_ = e; } |
876 void set_next_result(Expression* e) { next_result_ = e; } | 866 void set_next_result(Expression* e) { next_result_ = e; } |
877 void set_result_done(Expression* e) { result_done_ = e; } | 867 void set_result_done(Expression* e) { result_done_ = e; } |
878 void set_assign_each(Expression* e) { assign_each_ = e; } | 868 void set_assign_each(Expression* e) { assign_each_ = e; } |
879 | 869 |
880 BailoutId ContinueId() const override { return EntryId(); } | 870 BailoutId ContinueId() const { return EntryId(); } |
881 BailoutId StackCheckId() const override { return BackEdgeId(); } | 871 BailoutId StackCheckId() const { return BackEdgeId(); } |
882 | 872 |
883 static int num_ids() { return parent_num_ids() + 1; } | 873 static int num_ids() { return parent_num_ids() + 1; } |
884 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); } | 874 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); } |
885 | 875 |
886 protected: | 876 protected: |
887 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 877 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
888 : ForEachStatement(zone, labels, pos), | 878 : ForEachStatement(zone, labels, pos), |
889 iterator_(NULL), | 879 iterator_(NULL), |
890 assign_iterator_(NULL), | 880 assign_iterator_(NULL), |
891 next_result_(NULL), | 881 next_result_(NULL), |
(...skipping 11 matching lines...) Expand all Loading... |
903 Expression* assign_each_; | 893 Expression* assign_each_; |
904 }; | 894 }; |
905 | 895 |
906 | 896 |
907 class ExpressionStatement final : public Statement { | 897 class ExpressionStatement final : public Statement { |
908 public: | 898 public: |
909 DECLARE_NODE_TYPE(ExpressionStatement) | 899 DECLARE_NODE_TYPE(ExpressionStatement) |
910 | 900 |
911 void set_expression(Expression* e) { expression_ = e; } | 901 void set_expression(Expression* e) { expression_ = e; } |
912 Expression* expression() const { return expression_; } | 902 Expression* expression() const { return expression_; } |
913 bool IsJump() const override { return expression_->IsThrow(); } | 903 bool IsJump() const { return expression_->IsThrow(); } |
914 | 904 |
915 protected: | 905 protected: |
916 ExpressionStatement(Zone* zone, Expression* expression, int pos) | 906 ExpressionStatement(Zone* zone, Expression* expression, int pos) |
917 : Statement(zone, pos), expression_(expression) { } | 907 : Statement(zone, pos), expression_(expression) { } |
918 | 908 |
919 private: | 909 private: |
920 Expression* expression_; | 910 Expression* expression_; |
921 }; | 911 }; |
922 | 912 |
923 | 913 |
924 class JumpStatement : public Statement { | 914 class JumpStatement : public Statement { |
925 public: | 915 public: |
926 bool IsJump() const final { return true; } | 916 bool IsJump() const { return true; } |
927 | 917 |
928 protected: | 918 protected: |
929 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {} | 919 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {} |
930 }; | 920 }; |
931 | 921 |
932 | 922 |
933 class ContinueStatement final : public JumpStatement { | 923 class ContinueStatement final : public JumpStatement { |
934 public: | 924 public: |
935 DECLARE_NODE_TYPE(ContinueStatement) | 925 DECLARE_NODE_TYPE(ContinueStatement) |
936 | 926 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } | 1081 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } |
1092 | 1082 |
1093 Expression* condition() const { return condition_; } | 1083 Expression* condition() const { return condition_; } |
1094 Statement* then_statement() const { return then_statement_; } | 1084 Statement* then_statement() const { return then_statement_; } |
1095 Statement* else_statement() const { return else_statement_; } | 1085 Statement* else_statement() const { return else_statement_; } |
1096 | 1086 |
1097 void set_condition(Expression* e) { condition_ = e; } | 1087 void set_condition(Expression* e) { condition_ = e; } |
1098 void set_then_statement(Statement* s) { then_statement_ = s; } | 1088 void set_then_statement(Statement* s) { then_statement_ = s; } |
1099 void set_else_statement(Statement* s) { else_statement_ = s; } | 1089 void set_else_statement(Statement* s) { else_statement_ = s; } |
1100 | 1090 |
1101 bool IsJump() const override { | 1091 bool IsJump() const { |
1102 return HasThenStatement() && then_statement()->IsJump() | 1092 return HasThenStatement() && then_statement()->IsJump() |
1103 && HasElseStatement() && else_statement()->IsJump(); | 1093 && HasElseStatement() && else_statement()->IsJump(); |
1104 } | 1094 } |
1105 | 1095 |
1106 void set_base_id(int id) { base_id_ = id; } | 1096 void set_base_id(int id) { base_id_ = id; } |
1107 static int num_ids() { return parent_num_ids() + 3; } | 1097 static int num_ids() { return parent_num_ids() + 3; } |
1108 BailoutId IfId() const { return BailoutId(local_id(0)); } | 1098 BailoutId IfId() const { return BailoutId(local_id(0)); } |
1109 BailoutId ThenId() const { return BailoutId(local_id(1)); } | 1099 BailoutId ThenId() const { return BailoutId(local_id(1)); } |
1110 BailoutId ElseId() const { return BailoutId(local_id(2)); } | 1100 BailoutId ElseId() const { return BailoutId(local_id(2)); } |
1111 | 1101 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 | 1262 |
1273 Statement* statement_; | 1263 Statement* statement_; |
1274 Scope* const scope_; | 1264 Scope* const scope_; |
1275 }; | 1265 }; |
1276 | 1266 |
1277 | 1267 |
1278 class Literal final : public Expression { | 1268 class Literal final : public Expression { |
1279 public: | 1269 public: |
1280 DECLARE_NODE_TYPE(Literal) | 1270 DECLARE_NODE_TYPE(Literal) |
1281 | 1271 |
1282 bool IsPropertyName() const override { return value_->IsPropertyName(); } | 1272 bool IsPropertyName() const { return value_->IsPropertyName(); } |
1283 | 1273 |
1284 Handle<String> AsPropertyName() { | 1274 Handle<String> AsPropertyName() { |
1285 DCHECK(IsPropertyName()); | 1275 DCHECK(IsPropertyName()); |
1286 return Handle<String>::cast(value()); | 1276 return Handle<String>::cast(value()); |
1287 } | 1277 } |
1288 | 1278 |
1289 const AstRawString* AsRawPropertyName() { | 1279 const AstRawString* AsRawPropertyName() { |
1290 DCHECK(IsPropertyName()); | 1280 DCHECK(IsPropertyName()); |
1291 return value_->AsString(); | 1281 return value_->AsString(); |
1292 } | 1282 } |
1293 | 1283 |
1294 bool ToBooleanIsTrue() const override { return value()->BooleanValue(); } | 1284 bool ToBooleanIsTrue() const { return value()->BooleanValue(); } |
1295 bool ToBooleanIsFalse() const override { return !value()->BooleanValue(); } | 1285 bool ToBooleanIsFalse() const { return !value()->BooleanValue(); } |
1296 | 1286 |
1297 Handle<Object> value() const { return value_->value(); } | 1287 Handle<Object> value() const { return value_->value(); } |
1298 const AstValue* raw_value() const { return value_; } | 1288 const AstValue* raw_value() const { return value_; } |
1299 | 1289 |
1300 // Support for using Literal as a HashMap key. NOTE: Currently, this works | 1290 // Support for using Literal as a HashMap key. NOTE: Currently, this works |
1301 // only for string and number literals! | 1291 // only for string and number literals! |
1302 uint32_t Hash(); | 1292 uint32_t Hash(); |
1303 static bool Match(void* literal1, void* literal2); | 1293 static bool Match(void* literal1, void* literal2); |
1304 | 1294 |
1305 static int num_ids() { return parent_num_ids() + 1; } | 1295 static int num_ids() { return parent_num_ids() + 1; } |
(...skipping 11 matching lines...) Expand all Loading... |
1317 | 1307 |
1318 const AstValue* value_; | 1308 const AstValue* value_; |
1319 }; | 1309 }; |
1320 | 1310 |
1321 | 1311 |
1322 class AstLiteralReindexer; | 1312 class AstLiteralReindexer; |
1323 | 1313 |
1324 // Base class for literals that needs space in the corresponding JSFunction. | 1314 // Base class for literals that needs space in the corresponding JSFunction. |
1325 class MaterializedLiteral : public Expression { | 1315 class MaterializedLiteral : public Expression { |
1326 public: | 1316 public: |
1327 MaterializedLiteral* AsMaterializedLiteral() final { return this; } | |
1328 | |
1329 int literal_index() { return literal_index_; } | 1317 int literal_index() { return literal_index_; } |
1330 | 1318 |
1331 int depth() const { | 1319 int depth() const { |
1332 // only callable after initialization. | 1320 // only callable after initialization. |
1333 DCHECK(depth_ >= 1); | 1321 DCHECK(depth_ >= 1); |
1334 return depth_; | 1322 return depth_; |
1335 } | 1323 } |
1336 | 1324 |
1337 protected: | 1325 protected: |
1338 MaterializedLiteral(Zone* zone, int literal_index, int pos) | 1326 MaterializedLiteral(Zone* zone, int literal_index, int pos) |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 ZoneList<Expression*>* values_; | 1646 ZoneList<Expression*>* values_; |
1659 int first_spread_index_; | 1647 int first_spread_index_; |
1660 FeedbackVectorSlot literal_slot_; | 1648 FeedbackVectorSlot literal_slot_; |
1661 }; | 1649 }; |
1662 | 1650 |
1663 | 1651 |
1664 class VariableProxy final : public Expression { | 1652 class VariableProxy final : public Expression { |
1665 public: | 1653 public: |
1666 DECLARE_NODE_TYPE(VariableProxy) | 1654 DECLARE_NODE_TYPE(VariableProxy) |
1667 | 1655 |
1668 bool IsValidReferenceExpression() const override { | 1656 bool IsValidReferenceExpression() const { |
1669 return !is_this() && !is_new_target(); | 1657 return !is_this() && !is_new_target(); |
1670 } | 1658 } |
1671 | 1659 |
1672 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } | 1660 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } |
1673 | 1661 |
1674 Handle<String> name() const { return raw_name()->string(); } | 1662 Handle<String> name() const { return raw_name()->string(); } |
1675 const AstRawString* raw_name() const { | 1663 const AstRawString* raw_name() const { |
1676 return is_resolved() ? var_->raw_name() : raw_name_; | 1664 return is_resolved() ? var_->raw_name() : raw_name_; |
1677 } | 1665 } |
1678 | 1666 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 KEYED_PROPERTY, | 1746 KEYED_PROPERTY, |
1759 NAMED_SUPER_PROPERTY, | 1747 NAMED_SUPER_PROPERTY, |
1760 KEYED_SUPER_PROPERTY | 1748 KEYED_SUPER_PROPERTY |
1761 }; | 1749 }; |
1762 | 1750 |
1763 | 1751 |
1764 class Property final : public Expression { | 1752 class Property final : public Expression { |
1765 public: | 1753 public: |
1766 DECLARE_NODE_TYPE(Property) | 1754 DECLARE_NODE_TYPE(Property) |
1767 | 1755 |
1768 bool IsValidReferenceExpression() const override { return true; } | 1756 bool IsValidReferenceExpression() const { return true; } |
1769 | 1757 |
1770 Expression* obj() const { return obj_; } | 1758 Expression* obj() const { return obj_; } |
1771 Expression* key() const { return key_; } | 1759 Expression* key() const { return key_; } |
1772 | 1760 |
1773 void set_obj(Expression* e) { obj_ = e; } | 1761 void set_obj(Expression* e) { obj_ = e; } |
1774 void set_key(Expression* e) { key_ = e; } | 1762 void set_key(Expression* e) { key_ = e; } |
1775 | 1763 |
1776 static int num_ids() { return parent_num_ids() + 1; } | 1764 static int num_ids() { return parent_num_ids() + 1; } |
1777 BailoutId LoadId() const { return BailoutId(local_id(0)); } | 1765 BailoutId LoadId() const { return BailoutId(local_id(0)); } |
1778 | 1766 |
1779 bool IsStringAccess() const { | 1767 bool IsStringAccess() const { |
1780 return IsStringAccessField::decode(bit_field_); | 1768 return IsStringAccessField::decode(bit_field_); |
1781 } | 1769 } |
1782 | 1770 |
1783 // Type feedback information. | 1771 // Type feedback information. |
1784 bool IsMonomorphic() override { return receiver_types_.length() == 1; } | 1772 bool IsMonomorphic() const { return receiver_types_.length() == 1; } |
1785 SmallMapList* GetReceiverTypes() override { return &receiver_types_; } | 1773 SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
1786 KeyedAccessStoreMode GetStoreMode() const override { return STANDARD_STORE; } | 1774 KeyedAccessStoreMode GetStoreMode() const { return STANDARD_STORE; } |
1787 IcCheckType GetKeyType() const override { | 1775 IcCheckType GetKeyType() const { return KeyTypeField::decode(bit_field_); } |
1788 return KeyTypeField::decode(bit_field_); | |
1789 } | |
1790 bool IsUninitialized() const { | 1776 bool IsUninitialized() const { |
1791 return !is_for_call() && HasNoTypeInformation(); | 1777 return !is_for_call() && HasNoTypeInformation(); |
1792 } | 1778 } |
1793 bool HasNoTypeInformation() const { | 1779 bool HasNoTypeInformation() const { |
1794 return GetInlineCacheState() == UNINITIALIZED; | 1780 return GetInlineCacheState() == UNINITIALIZED; |
1795 } | 1781 } |
1796 InlineCacheState GetInlineCacheState() const { | 1782 InlineCacheState GetInlineCacheState() const { |
1797 return InlineCacheStateField::decode(bit_field_); | 1783 return InlineCacheStateField::decode(bit_field_); |
1798 } | 1784 } |
1799 void set_is_string_access(bool b) { | 1785 void set_is_string_access(bool b) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 void set_expression(Expression* e) { expression_ = e; } | 1853 void set_expression(Expression* e) { expression_ = e; } |
1868 | 1854 |
1869 // Type feedback information. | 1855 // Type feedback information. |
1870 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1856 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
1871 FeedbackVectorSlotCache* cache); | 1857 FeedbackVectorSlotCache* cache); |
1872 | 1858 |
1873 FeedbackVectorSlot CallFeedbackSlot() const { return stub_slot_; } | 1859 FeedbackVectorSlot CallFeedbackSlot() const { return stub_slot_; } |
1874 | 1860 |
1875 FeedbackVectorSlot CallFeedbackICSlot() const { return ic_slot_; } | 1861 FeedbackVectorSlot CallFeedbackICSlot() const { return ic_slot_; } |
1876 | 1862 |
1877 SmallMapList* GetReceiverTypes() override { | 1863 SmallMapList* GetReceiverTypes() { |
1878 if (expression()->IsProperty()) { | 1864 if (expression()->IsProperty()) { |
1879 return expression()->AsProperty()->GetReceiverTypes(); | 1865 return expression()->AsProperty()->GetReceiverTypes(); |
1880 } | 1866 } |
1881 return NULL; | 1867 return nullptr; |
1882 } | 1868 } |
1883 | 1869 |
1884 bool IsMonomorphic() override { | 1870 bool IsMonomorphic() const { |
1885 if (expression()->IsProperty()) { | 1871 if (expression()->IsProperty()) { |
1886 return expression()->AsProperty()->IsMonomorphic(); | 1872 return expression()->AsProperty()->IsMonomorphic(); |
1887 } | 1873 } |
1888 return !target_.is_null(); | 1874 return !target_.is_null(); |
1889 } | 1875 } |
1890 | 1876 |
1891 bool global_call() const { | 1877 bool global_call() const { |
1892 VariableProxy* proxy = expression_->AsVariableProxy(); | 1878 VariableProxy* proxy = expression_->AsVariableProxy(); |
1893 return proxy != NULL && proxy->var()->IsUnallocatedOrGlobalSlot(); | 1879 return proxy != NULL && proxy->var()->IsUnallocatedOrGlobalSlot(); |
1894 } | 1880 } |
(...skipping 25 matching lines...) Expand all Loading... |
1920 return IsUninitializedField::decode(bit_field_); | 1906 return IsUninitializedField::decode(bit_field_); |
1921 } | 1907 } |
1922 void set_is_uninitialized(bool b) { | 1908 void set_is_uninitialized(bool b) { |
1923 bit_field_ = IsUninitializedField::update(bit_field_, b); | 1909 bit_field_ = IsUninitializedField::update(bit_field_, b); |
1924 } | 1910 } |
1925 | 1911 |
1926 TailCallMode tail_call_mode() const { | 1912 TailCallMode tail_call_mode() const { |
1927 return IsTailField::decode(bit_field_) ? TailCallMode::kAllow | 1913 return IsTailField::decode(bit_field_) ? TailCallMode::kAllow |
1928 : TailCallMode::kDisallow; | 1914 : TailCallMode::kDisallow; |
1929 } | 1915 } |
1930 void MarkTail() override { | 1916 void MarkTail() { bit_field_ = IsTailField::update(bit_field_, true); } |
1931 bit_field_ = IsTailField::update(bit_field_, true); | |
1932 } | |
1933 | 1917 |
1934 enum CallType { | 1918 enum CallType { |
1935 POSSIBLY_EVAL_CALL, | 1919 POSSIBLY_EVAL_CALL, |
1936 GLOBAL_CALL, | 1920 GLOBAL_CALL, |
1937 LOOKUP_SLOT_CALL, | 1921 LOOKUP_SLOT_CALL, |
1938 NAMED_PROPERTY_CALL, | 1922 NAMED_PROPERTY_CALL, |
1939 KEYED_PROPERTY_CALL, | 1923 KEYED_PROPERTY_CALL, |
1940 NAMED_SUPER_PROPERTY_CALL, | 1924 NAMED_SUPER_PROPERTY_CALL, |
1941 KEYED_SUPER_PROPERTY_CALL, | 1925 KEYED_SUPER_PROPERTY_CALL, |
1942 SUPER_CALL, | 1926 SUPER_CALL, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 // Construct calls have two slots, one right after the other. | 1981 // Construct calls have two slots, one right after the other. |
1998 // The second slot stores the call count for monomorphic calls. | 1982 // The second slot stores the call count for monomorphic calls. |
1999 spec->AddGeneralSlot(); | 1983 spec->AddGeneralSlot(); |
2000 } | 1984 } |
2001 | 1985 |
2002 FeedbackVectorSlot CallNewFeedbackSlot() { | 1986 FeedbackVectorSlot CallNewFeedbackSlot() { |
2003 DCHECK(!callnew_feedback_slot_.IsInvalid()); | 1987 DCHECK(!callnew_feedback_slot_.IsInvalid()); |
2004 return callnew_feedback_slot_; | 1988 return callnew_feedback_slot_; |
2005 } | 1989 } |
2006 | 1990 |
2007 bool IsMonomorphic() override { return is_monomorphic_; } | 1991 bool IsMonomorphic() const { return is_monomorphic_; } |
2008 Handle<JSFunction> target() const { return target_; } | 1992 Handle<JSFunction> target() const { return target_; } |
2009 Handle<AllocationSite> allocation_site() const { | 1993 Handle<AllocationSite> allocation_site() const { |
2010 return allocation_site_; | 1994 return allocation_site_; |
2011 } | 1995 } |
2012 | 1996 |
2013 static int num_ids() { return parent_num_ids() + 1; } | 1997 static int num_ids() { return parent_num_ids() + 1; } |
2014 static int feedback_slots() { return 1; } | 1998 static int feedback_slots() { return 1; } |
2015 BailoutId ReturnId() const { return BailoutId(local_id(0)); } | 1999 BailoutId ReturnId() const { return BailoutId(local_id(0)); } |
2016 | 2000 |
2017 void set_allocation_site(Handle<AllocationSite> site) { | 2001 void set_allocation_site(Handle<AllocationSite> site) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 Token::Value op() const { return op_; } | 2087 Token::Value op() const { return op_; } |
2104 Expression* expression() const { return expression_; } | 2088 Expression* expression() const { return expression_; } |
2105 void set_expression(Expression* e) { expression_ = e; } | 2089 void set_expression(Expression* e) { expression_ = e; } |
2106 | 2090 |
2107 // For unary not (Token::NOT), the AST ids where true and false will | 2091 // For unary not (Token::NOT), the AST ids where true and false will |
2108 // actually be materialized, respectively. | 2092 // actually be materialized, respectively. |
2109 static int num_ids() { return parent_num_ids() + 2; } | 2093 static int num_ids() { return parent_num_ids() + 2; } |
2110 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); } | 2094 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); } |
2111 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); } | 2095 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); } |
2112 | 2096 |
2113 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) override; | 2097 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
2114 | 2098 |
2115 protected: | 2099 protected: |
2116 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos) | 2100 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos) |
2117 : Expression(zone, pos), op_(op), expression_(expression) { | 2101 : Expression(zone, pos), op_(op), expression_(expression) { |
2118 DCHECK(Token::IsUnaryOp(op)); | 2102 DCHECK(Token::IsUnaryOp(op)); |
2119 } | 2103 } |
2120 static int parent_num_ids() { return Expression::num_ids(); } | 2104 static int parent_num_ids() { return Expression::num_ids(); } |
2121 | 2105 |
2122 private: | 2106 private: |
2123 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2107 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
(...skipping 10 matching lines...) Expand all Loading... |
2134 Token::Value op() const { return static_cast<Token::Value>(op_); } | 2118 Token::Value op() const { return static_cast<Token::Value>(op_); } |
2135 Expression* left() const { return left_; } | 2119 Expression* left() const { return left_; } |
2136 void set_left(Expression* e) { left_ = e; } | 2120 void set_left(Expression* e) { left_ = e; } |
2137 Expression* right() const { return right_; } | 2121 Expression* right() const { return right_; } |
2138 void set_right(Expression* e) { right_ = e; } | 2122 void set_right(Expression* e) { right_ = e; } |
2139 Handle<AllocationSite> allocation_site() const { return allocation_site_; } | 2123 Handle<AllocationSite> allocation_site() const { return allocation_site_; } |
2140 void set_allocation_site(Handle<AllocationSite> allocation_site) { | 2124 void set_allocation_site(Handle<AllocationSite> allocation_site) { |
2141 allocation_site_ = allocation_site; | 2125 allocation_site_ = allocation_site; |
2142 } | 2126 } |
2143 | 2127 |
2144 void MarkTail() override { | 2128 void MarkTail() { |
2145 switch (op()) { | 2129 switch (op()) { |
2146 case Token::COMMA: | 2130 case Token::COMMA: |
2147 case Token::AND: | 2131 case Token::AND: |
2148 case Token::OR: | 2132 case Token::OR: |
2149 right_->MarkTail(); | 2133 right_->MarkTail(); |
2150 default: | 2134 default: |
2151 break; | 2135 break; |
2152 } | 2136 } |
2153 } | 2137 } |
2154 | 2138 |
2155 // The short-circuit logical operations need an AST ID for their | 2139 // The short-circuit logical operations need an AST ID for their |
2156 // right-hand subexpression. | 2140 // right-hand subexpression. |
2157 static int num_ids() { return parent_num_ids() + 2; } | 2141 static int num_ids() { return parent_num_ids() + 2; } |
2158 BailoutId RightId() const { return BailoutId(local_id(0)); } | 2142 BailoutId RightId() const { return BailoutId(local_id(0)); } |
2159 | 2143 |
2160 TypeFeedbackId BinaryOperationFeedbackId() const { | 2144 TypeFeedbackId BinaryOperationFeedbackId() const { |
2161 return TypeFeedbackId(local_id(1)); | 2145 return TypeFeedbackId(local_id(1)); |
2162 } | 2146 } |
2163 Maybe<int> fixed_right_arg() const { | 2147 Maybe<int> fixed_right_arg() const { |
2164 return has_fixed_right_arg_ ? Just(fixed_right_arg_value_) : Nothing<int>(); | 2148 return has_fixed_right_arg_ ? Just(fixed_right_arg_value_) : Nothing<int>(); |
2165 } | 2149 } |
2166 void set_fixed_right_arg(Maybe<int> arg) { | 2150 void set_fixed_right_arg(Maybe<int> arg) { |
2167 has_fixed_right_arg_ = arg.IsJust(); | 2151 has_fixed_right_arg_ = arg.IsJust(); |
2168 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust(); | 2152 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust(); |
2169 } | 2153 } |
2170 | 2154 |
2171 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) override; | 2155 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
2172 | 2156 |
2173 protected: | 2157 protected: |
2174 BinaryOperation(Zone* zone, Token::Value op, Expression* left, | 2158 BinaryOperation(Zone* zone, Token::Value op, Expression* left, |
2175 Expression* right, int pos) | 2159 Expression* right, int pos) |
2176 : Expression(zone, pos), | 2160 : Expression(zone, pos), |
2177 op_(static_cast<byte>(op)), | 2161 op_(static_cast<byte>(op)), |
2178 has_fixed_right_arg_(false), | 2162 has_fixed_right_arg_(false), |
2179 fixed_right_arg_value_(0), | 2163 fixed_right_arg_value_(0), |
2180 left_(left), | 2164 left_(left), |
2181 right_(right) { | 2165 right_(right) { |
(...skipping 23 matching lines...) Expand all Loading... |
2205 bool is_postfix() const { return !is_prefix(); } | 2189 bool is_postfix() const { return !is_prefix(); } |
2206 | 2190 |
2207 Token::Value op() const { return TokenField::decode(bit_field_); } | 2191 Token::Value op() const { return TokenField::decode(bit_field_); } |
2208 Token::Value binary_op() { | 2192 Token::Value binary_op() { |
2209 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 2193 return (op() == Token::INC) ? Token::ADD : Token::SUB; |
2210 } | 2194 } |
2211 | 2195 |
2212 Expression* expression() const { return expression_; } | 2196 Expression* expression() const { return expression_; } |
2213 void set_expression(Expression* e) { expression_ = e; } | 2197 void set_expression(Expression* e) { expression_ = e; } |
2214 | 2198 |
2215 bool IsMonomorphic() override { return receiver_types_.length() == 1; } | 2199 bool IsMonomorphic() const { return receiver_types_.length() == 1; } |
2216 SmallMapList* GetReceiverTypes() override { return &receiver_types_; } | 2200 SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
2217 IcCheckType GetKeyType() const override { | 2201 IcCheckType GetKeyType() const { return KeyTypeField::decode(bit_field_); } |
2218 return KeyTypeField::decode(bit_field_); | 2202 KeyedAccessStoreMode GetStoreMode() const { |
2219 } | |
2220 KeyedAccessStoreMode GetStoreMode() const override { | |
2221 return StoreModeField::decode(bit_field_); | 2203 return StoreModeField::decode(bit_field_); |
2222 } | 2204 } |
2223 Type* type() const { return type_; } | 2205 Type* type() const { return type_; } |
2224 void set_key_type(IcCheckType type) { | 2206 void set_key_type(IcCheckType type) { |
2225 bit_field_ = KeyTypeField::update(bit_field_, type); | 2207 bit_field_ = KeyTypeField::update(bit_field_, type); |
2226 } | 2208 } |
2227 void set_store_mode(KeyedAccessStoreMode mode) { | 2209 void set_store_mode(KeyedAccessStoreMode mode) { |
2228 bit_field_ = StoreModeField::update(bit_field_, mode); | 2210 bit_field_ = StoreModeField::update(bit_field_, mode); |
2229 } | 2211 } |
2230 void set_type(Type* type) { type_ = type; } | 2212 void set_type(Type* type) { type_ = type; } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 DECLARE_NODE_TYPE(Conditional) | 2330 DECLARE_NODE_TYPE(Conditional) |
2349 | 2331 |
2350 Expression* condition() const { return condition_; } | 2332 Expression* condition() const { return condition_; } |
2351 Expression* then_expression() const { return then_expression_; } | 2333 Expression* then_expression() const { return then_expression_; } |
2352 Expression* else_expression() const { return else_expression_; } | 2334 Expression* else_expression() const { return else_expression_; } |
2353 | 2335 |
2354 void set_condition(Expression* e) { condition_ = e; } | 2336 void set_condition(Expression* e) { condition_ = e; } |
2355 void set_then_expression(Expression* e) { then_expression_ = e; } | 2337 void set_then_expression(Expression* e) { then_expression_ = e; } |
2356 void set_else_expression(Expression* e) { else_expression_ = e; } | 2338 void set_else_expression(Expression* e) { else_expression_ = e; } |
2357 | 2339 |
2358 void MarkTail() override { | 2340 void MarkTail() { |
2359 then_expression_->MarkTail(); | 2341 then_expression_->MarkTail(); |
2360 else_expression_->MarkTail(); | 2342 else_expression_->MarkTail(); |
2361 } | 2343 } |
2362 | 2344 |
2363 static int num_ids() { return parent_num_ids() + 2; } | 2345 static int num_ids() { return parent_num_ids() + 2; } |
2364 BailoutId ThenId() const { return BailoutId(local_id(0)); } | 2346 BailoutId ThenId() const { return BailoutId(local_id(0)); } |
2365 BailoutId ElseId() const { return BailoutId(local_id(1)); } | 2347 BailoutId ElseId() const { return BailoutId(local_id(1)); } |
2366 | 2348 |
2367 protected: | 2349 protected: |
2368 Conditional(Zone* zone, Expression* condition, Expression* then_expression, | 2350 Conditional(Zone* zone, Expression* condition, Expression* then_expression, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2400 BinaryOperation* binary_operation() const { return binary_operation_; } | 2382 BinaryOperation* binary_operation() const { return binary_operation_; } |
2401 | 2383 |
2402 // This check relies on the definition order of token in token.h. | 2384 // This check relies on the definition order of token in token.h. |
2403 bool is_compound() const { return op() > Token::ASSIGN; } | 2385 bool is_compound() const { return op() > Token::ASSIGN; } |
2404 | 2386 |
2405 static int num_ids() { return parent_num_ids() + 2; } | 2387 static int num_ids() { return parent_num_ids() + 2; } |
2406 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } | 2388 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } |
2407 | 2389 |
2408 // Type feedback information. | 2390 // Type feedback information. |
2409 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); } | 2391 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); } |
2410 bool IsMonomorphic() override { return receiver_types_.length() == 1; } | |
2411 bool IsUninitialized() const { | 2392 bool IsUninitialized() const { |
2412 return IsUninitializedField::decode(bit_field_); | 2393 return IsUninitializedField::decode(bit_field_); |
2413 } | 2394 } |
2414 bool HasNoTypeInformation() { | 2395 bool HasNoTypeInformation() { |
2415 return IsUninitializedField::decode(bit_field_); | 2396 return IsUninitializedField::decode(bit_field_); |
2416 } | 2397 } |
2417 SmallMapList* GetReceiverTypes() override { return &receiver_types_; } | 2398 bool IsMonomorphic() const { return receiver_types_.length() == 1; } |
2418 IcCheckType GetKeyType() const override { | 2399 SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
2419 return KeyTypeField::decode(bit_field_); | 2400 IcCheckType GetKeyType() const { return KeyTypeField::decode(bit_field_); } |
2420 } | 2401 KeyedAccessStoreMode GetStoreMode() const { |
2421 KeyedAccessStoreMode GetStoreMode() const override { | |
2422 return StoreModeField::decode(bit_field_); | 2402 return StoreModeField::decode(bit_field_); |
2423 } | 2403 } |
2424 void set_is_uninitialized(bool b) { | 2404 void set_is_uninitialized(bool b) { |
2425 bit_field_ = IsUninitializedField::update(bit_field_, b); | 2405 bit_field_ = IsUninitializedField::update(bit_field_, b); |
2426 } | 2406 } |
2427 void set_key_type(IcCheckType key_type) { | 2407 void set_key_type(IcCheckType key_type) { |
2428 bit_field_ = KeyTypeField::update(bit_field_, key_type); | 2408 bit_field_ = KeyTypeField::update(bit_field_, key_type); |
2429 } | 2409 } |
2430 void set_store_mode(KeyedAccessStoreMode mode) { | 2410 void set_store_mode(KeyedAccessStoreMode mode) { |
2431 bit_field_ = StoreModeField::update(bit_field_, mode); | 2411 bit_field_ = StoreModeField::update(bit_field_, mode); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 } | 2661 } |
2682 const FeedbackVectorSpec* feedback_vector_spec() const { | 2662 const FeedbackVectorSpec* feedback_vector_spec() const { |
2683 return ast_properties_.get_spec(); | 2663 return ast_properties_.get_spec(); |
2684 } | 2664 } |
2685 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2665 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
2686 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2666 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
2687 void set_dont_optimize_reason(BailoutReason reason) { | 2667 void set_dont_optimize_reason(BailoutReason reason) { |
2688 dont_optimize_reason_ = reason; | 2668 dont_optimize_reason_ = reason; |
2689 } | 2669 } |
2690 | 2670 |
2691 bool IsAnonymousFunctionDefinition() const final { | 2671 bool IsAnonymousFunctionDefinition() const { |
2692 return is_anonymous_expression(); | 2672 return is_anonymous_expression(); |
2693 } | 2673 } |
2694 | 2674 |
2695 int yield_count() { return yield_count_; } | 2675 int yield_count() { return yield_count_; } |
2696 void set_yield_count(int yield_count) { yield_count_ = yield_count; } | 2676 void set_yield_count(int yield_count) { yield_count_ = yield_count; } |
2697 | 2677 |
2698 protected: | 2678 protected: |
2699 FunctionLiteral(Zone* zone, const AstString* name, | 2679 FunctionLiteral(Zone* zone, const AstString* name, |
2700 AstValueFactory* ast_value_factory, Scope* scope, | 2680 AstValueFactory* ast_value_factory, Scope* scope, |
2701 ZoneList<Statement*>* body, int materialized_literal_count, | 2681 ZoneList<Statement*>* body, int materialized_literal_count, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 FeedbackVectorSlotCache* cache); | 2770 FeedbackVectorSlotCache* cache); |
2791 | 2771 |
2792 bool NeedsProxySlot() const { | 2772 bool NeedsProxySlot() const { |
2793 return class_variable_proxy() != nullptr && | 2773 return class_variable_proxy() != nullptr && |
2794 class_variable_proxy()->var()->IsUnallocated(); | 2774 class_variable_proxy()->var()->IsUnallocated(); |
2795 } | 2775 } |
2796 | 2776 |
2797 FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; } | 2777 FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; } |
2798 FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } | 2778 FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } |
2799 | 2779 |
2800 bool IsAnonymousFunctionDefinition() const final { | 2780 bool IsAnonymousFunctionDefinition() const { |
2801 return constructor()->raw_name()->length() == 0; | 2781 return constructor()->raw_name()->length() == 0; |
2802 } | 2782 } |
2803 | 2783 |
2804 protected: | 2784 protected: |
2805 ClassLiteral(Zone* zone, Scope* scope, VariableProxy* class_variable_proxy, | 2785 ClassLiteral(Zone* zone, Scope* scope, VariableProxy* class_variable_proxy, |
2806 Expression* extends, FunctionLiteral* constructor, | 2786 Expression* extends, FunctionLiteral* constructor, |
2807 ZoneList<Property*>* properties, int start_position, | 2787 ZoneList<Property*>* properties, int start_position, |
2808 int end_position) | 2788 int end_position) |
2809 : Expression(zone, start_position), | 2789 : Expression(zone, start_position), |
2810 scope_(scope), | 2790 scope_(scope), |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3566 : NULL; \ | 3546 : NULL; \ |
3567 } | 3547 } |
3568 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3548 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3569 #undef DECLARE_NODE_FUNCTIONS | 3549 #undef DECLARE_NODE_FUNCTIONS |
3570 | 3550 |
3571 | 3551 |
3572 } // namespace internal | 3552 } // namespace internal |
3573 } // namespace v8 | 3553 } // namespace v8 |
3574 | 3554 |
3575 #endif // V8_AST_AST_H_ | 3555 #endif // V8_AST_AST_H_ |
OLD | NEW |