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

Side by Side Diff: src/ast.h

Issue 480543002: Parse 'super' keyword. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch for landing (minor fix for tests in release mode) Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ast.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 #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
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
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
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
2571 protected:
2572 explicit SuperReference(Zone* zone, VariableProxy* this_var, int pos)
2573 : Expression(zone, pos), this_var_(this_var) {
2574 DCHECK(this_var->is_this());
2575 }
2576
2577 VariableProxy* this_var_;
2578 };
2579
2580
2557 #undef DECLARE_NODE_TYPE 2581 #undef DECLARE_NODE_TYPE
2558 2582
2559 2583
2560 // ---------------------------------------------------------------------------- 2584 // ----------------------------------------------------------------------------
2561 // Regular expressions 2585 // Regular expressions
2562 2586
2563 2587
2564 class RegExpVisitor BASE_EMBEDDED { 2588 class RegExpVisitor BASE_EMBEDDED {
2565 public: 2589 public:
2566 virtual ~RegExpVisitor() { } 2590 virtual ~RegExpVisitor() { }
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
3465 NativeFunctionLiteral* lit = 3489 NativeFunctionLiteral* lit =
3466 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); 3490 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos);
3467 VISIT_AND_RETURN(NativeFunctionLiteral, lit) 3491 VISIT_AND_RETURN(NativeFunctionLiteral, lit)
3468 } 3492 }
3469 3493
3470 ThisFunction* NewThisFunction(int pos) { 3494 ThisFunction* NewThisFunction(int pos) {
3471 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); 3495 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos);
3472 VISIT_AND_RETURN(ThisFunction, fun) 3496 VISIT_AND_RETURN(ThisFunction, fun)
3473 } 3497 }
3474 3498
3499 SuperReference* NewSuperReference(VariableProxy* this_var, int pos) {
3500 SuperReference* super = new (zone_) SuperReference(zone_, this_var, pos);
3501 VISIT_AND_RETURN(SuperReference, super);
3502 }
3503
3475 #undef VISIT_AND_RETURN 3504 #undef VISIT_AND_RETURN
3476 3505
3477 private: 3506 private:
3478 Zone* zone_; 3507 Zone* zone_;
3479 Visitor visitor_; 3508 Visitor visitor_;
3480 AstValueFactory* ast_value_factory_; 3509 AstValueFactory* ast_value_factory_;
3481 }; 3510 };
3482 3511
3483 3512
3484 } } // namespace v8::internal 3513 } } // namespace v8::internal
3485 3514
3486 #endif // V8_AST_H_ 3515 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698