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_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 V(Throw) \ | 87 V(Throw) \ |
88 V(Property) \ | 88 V(Property) \ |
89 V(Call) \ | 89 V(Call) \ |
90 V(CallNew) \ | 90 V(CallNew) \ |
91 V(CallRuntime) \ | 91 V(CallRuntime) \ |
92 V(UnaryOperation) \ | 92 V(UnaryOperation) \ |
93 V(CountOperation) \ | 93 V(CountOperation) \ |
94 V(BinaryOperation) \ | 94 V(BinaryOperation) \ |
95 V(CompareOperation) \ | 95 V(CompareOperation) \ |
96 V(ThisFunction) \ | 96 V(ThisFunction) \ |
97 V(SuperReference) \ | |
97 V(CaseClause) | 98 V(CaseClause) |
98 | 99 |
99 #define AST_NODE_LIST(V) \ | 100 #define AST_NODE_LIST(V) \ |
100 DECLARATION_NODE_LIST(V) \ | 101 DECLARATION_NODE_LIST(V) \ |
101 MODULE_NODE_LIST(V) \ | 102 MODULE_NODE_LIST(V) \ |
102 STATEMENT_NODE_LIST(V) \ | 103 STATEMENT_NODE_LIST(V) \ |
103 EXPRESSION_NODE_LIST(V) | 104 EXPRESSION_NODE_LIST(V) |
104 | 105 |
105 // Forward declarations | 106 // Forward declarations |
106 class AstConstructionVisitor; | 107 class AstConstructionVisitor; |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1703 } | 1704 } |
1704 bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; } | 1705 bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; } |
1705 bool HasNoTypeInformation() { | 1706 bool HasNoTypeInformation() { |
1706 return is_uninitialized_; | 1707 return is_uninitialized_; |
1707 } | 1708 } |
1708 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 1709 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
1709 void set_is_string_access(bool b) { is_string_access_ = b; } | 1710 void set_is_string_access(bool b) { is_string_access_ = b; } |
1710 void mark_for_call() { is_for_call_ = true; } | 1711 void mark_for_call() { is_for_call_ = true; } |
1711 bool IsForCall() { return is_for_call_; } | 1712 bool IsForCall() { return is_for_call_; } |
1712 | 1713 |
1714 bool IsSuperAccess() { | |
1715 return obj()->IsSuperReference(); | |
1716 } | |
1717 | |
1713 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } | 1718 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } |
1714 | 1719 |
1715 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } | 1720 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } |
1716 virtual void SetFirstFeedbackSlot(int slot) { | 1721 virtual void SetFirstFeedbackSlot(int slot) { |
1717 property_feedback_slot_ = slot; | 1722 property_feedback_slot_ = slot; |
1718 } | 1723 } |
1719 | 1724 |
1720 int PropertyFeedbackSlot() const { return property_feedback_slot_; } | 1725 int PropertyFeedbackSlot() const { return property_feedback_slot_; } |
1721 | 1726 |
1722 protected: | 1727 protected: |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2547 | 2552 |
2548 | 2553 |
2549 class ThisFunction V8_FINAL : public Expression { | 2554 class ThisFunction V8_FINAL : public Expression { |
2550 public: | 2555 public: |
2551 DECLARE_NODE_TYPE(ThisFunction) | 2556 DECLARE_NODE_TYPE(ThisFunction) |
2552 | 2557 |
2553 protected: | 2558 protected: |
2554 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} | 2559 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} |
2555 }; | 2560 }; |
2556 | 2561 |
2562 | |
2563 class SuperReference V8_FINAL : public Expression { | |
2564 public: | |
2565 DECLARE_NODE_TYPE(SuperReference) | |
2566 | |
2567 VariableProxy* this_var() const { return this_var_; } | |
2568 | |
2569 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); } | |
2570 protected: | |
arv (Not doing code reviews)
2014/08/15 19:41:07
Empty line before protected.
Dmitry Lomov (no reviews)
2014/08/15 22:11:41
Done.
| |
2571 explicit SuperReference(Zone* zone, VariableProxy* this_var, int pos) | |
2572 : Expression(zone, pos), this_var_(this_var) { | |
2573 DCHECK(this_var->is_this()); | |
2574 } | |
2575 | |
2576 VariableProxy* this_var_; | |
2577 }; | |
2578 | |
2579 | |
2557 #undef DECLARE_NODE_TYPE | 2580 #undef DECLARE_NODE_TYPE |
2558 | 2581 |
2559 | 2582 |
2560 // ---------------------------------------------------------------------------- | 2583 // ---------------------------------------------------------------------------- |
2561 // Regular expressions | 2584 // Regular expressions |
2562 | 2585 |
2563 | 2586 |
2564 class RegExpVisitor BASE_EMBEDDED { | 2587 class RegExpVisitor BASE_EMBEDDED { |
2565 public: | 2588 public: |
2566 virtual ~RegExpVisitor() { } | 2589 virtual ~RegExpVisitor() { } |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3465 NativeFunctionLiteral* lit = | 3488 NativeFunctionLiteral* lit = |
3466 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); | 3489 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); |
3467 VISIT_AND_RETURN(NativeFunctionLiteral, lit) | 3490 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
3468 } | 3491 } |
3469 | 3492 |
3470 ThisFunction* NewThisFunction(int pos) { | 3493 ThisFunction* NewThisFunction(int pos) { |
3471 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); | 3494 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); |
3472 VISIT_AND_RETURN(ThisFunction, fun) | 3495 VISIT_AND_RETURN(ThisFunction, fun) |
3473 } | 3496 } |
3474 | 3497 |
3498 SuperReference* NewSuperReference(VariableProxy* this_var, int pos) { | |
3499 SuperReference* super = new (zone_) SuperReference(zone_, this_var, pos); | |
3500 VISIT_AND_RETURN(SuperReference, super); | |
3501 } | |
3502 | |
3475 #undef VISIT_AND_RETURN | 3503 #undef VISIT_AND_RETURN |
3476 | 3504 |
3477 private: | 3505 private: |
3478 Zone* zone_; | 3506 Zone* zone_; |
3479 Visitor visitor_; | 3507 Visitor visitor_; |
3480 AstValueFactory* ast_value_factory_; | 3508 AstValueFactory* ast_value_factory_; |
3481 }; | 3509 }; |
3482 | 3510 |
3483 | 3511 |
3484 } } // namespace v8::internal | 3512 } } // namespace v8::internal |
3485 | 3513 |
3486 #endif // V8_AST_H_ | 3514 #endif // V8_AST_H_ |
OLD | NEW |