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

Side by Side Diff: src/ast.h

Issue 938443002: [es6] implement spread calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove --harmony-spread flag Created 5 years, 9 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
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 V(Yield) \ 85 V(Yield) \
86 V(Throw) \ 86 V(Throw) \
87 V(Property) \ 87 V(Property) \
88 V(Call) \ 88 V(Call) \
89 V(CallNew) \ 89 V(CallNew) \
90 V(CallRuntime) \ 90 V(CallRuntime) \
91 V(UnaryOperation) \ 91 V(UnaryOperation) \
92 V(CountOperation) \ 92 V(CountOperation) \
93 V(BinaryOperation) \ 93 V(BinaryOperation) \
94 V(CompareOperation) \ 94 V(CompareOperation) \
95 V(SpreadOperation) \
95 V(ThisFunction) \ 96 V(ThisFunction) \
96 V(SuperReference) \ 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
(...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 callruntime_feedback_slot_ = slot; 2006 callruntime_feedback_slot_ = slot;
2006 } 2007 }
2007 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } 2008 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; }
2008 2009
2009 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { 2010 FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
2010 DCHECK(!HasCallRuntimeFeedbackSlot() || 2011 DCHECK(!HasCallRuntimeFeedbackSlot() ||
2011 !callruntime_feedback_slot_.IsInvalid()); 2012 !callruntime_feedback_slot_.IsInvalid());
2012 return callruntime_feedback_slot_; 2013 return callruntime_feedback_slot_;
2013 } 2014 }
2014 2015
2016 bool IsSuperCall() const { return is_super_call_; }
2017 void SetIsSuperCall() { is_super_call_ = true; }
2018
2015 static int num_ids() { return parent_num_ids() + 1; } 2019 static int num_ids() { return parent_num_ids() + 1; }
2016 TypeFeedbackId CallRuntimeFeedbackId() const { 2020 TypeFeedbackId CallRuntimeFeedbackId() const {
2017 return TypeFeedbackId(local_id(0)); 2021 return TypeFeedbackId(local_id(0));
2018 } 2022 }
2019 2023
2020 protected: 2024 protected:
2021 CallRuntime(Zone* zone, const AstRawString* name, 2025 CallRuntime(Zone* zone, const AstRawString* name,
2022 const Runtime::Function* function, 2026 const Runtime::Function* function,
2023 ZoneList<Expression*>* arguments, int pos) 2027 ZoneList<Expression*>* arguments, int pos)
2024 : Expression(zone, pos), 2028 : Expression(zone, pos),
2025 raw_name_(name), 2029 raw_name_(name),
2026 function_(function), 2030 function_(function),
2027 arguments_(arguments), 2031 arguments_(arguments),
2028 callruntime_feedback_slot_(FeedbackVectorICSlot::Invalid()) {} 2032 callruntime_feedback_slot_(FeedbackVectorICSlot::Invalid()),
2033 is_super_call_(false) {}
2029 static int parent_num_ids() { return Expression::num_ids(); } 2034 static int parent_num_ids() { return Expression::num_ids(); }
2030 2035
2031 private: 2036 private:
2032 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2037 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2033 2038
2034 const AstRawString* raw_name_; 2039 const AstRawString* raw_name_;
2035 const Runtime::Function* function_; 2040 const Runtime::Function* function_;
2036 ZoneList<Expression*>* arguments_; 2041 ZoneList<Expression*>* arguments_;
2037 FeedbackVectorICSlot callruntime_feedback_slot_; 2042 FeedbackVectorICSlot callruntime_feedback_slot_;
2043 bool is_super_call_;
2038 }; 2044 };
2039 2045
2040 2046
2041 class UnaryOperation FINAL : public Expression { 2047 class UnaryOperation FINAL : public Expression {
2042 public: 2048 public:
2043 DECLARE_NODE_TYPE(UnaryOperation) 2049 DECLARE_NODE_TYPE(UnaryOperation)
2044 2050
2045 Token::Value op() const { return op_; } 2051 Token::Value op() const { return op_; }
2046 Expression* expression() const { return expression_; } 2052 Expression* expression() const { return expression_; }
2047 2053
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2240 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2235 2241
2236 Token::Value op_; 2242 Token::Value op_;
2237 Expression* left_; 2243 Expression* left_;
2238 Expression* right_; 2244 Expression* right_;
2239 2245
2240 Type* combined_type_; 2246 Type* combined_type_;
2241 }; 2247 };
2242 2248
2243 2249
2250 class SpreadOperation FINAL : public Expression {
2251 public:
2252 DECLARE_NODE_TYPE(SpreadOperation)
2253
2254 Expression* expression() const { return expression_; }
2255
2256 static int num_ids() { return parent_num_ids(); }
2257
2258 protected:
2259 SpreadOperation(Zone* zone, Expression* expression, int pos)
2260 : Expression(zone, pos), expression_(expression) {}
2261 static int parent_num_ids() { return Expression::num_ids(); }
2262
2263 private:
2264 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2265
2266 Expression* expression_;
2267 };
2268
2269
2244 class Conditional FINAL : public Expression { 2270 class Conditional FINAL : public Expression {
2245 public: 2271 public:
2246 DECLARE_NODE_TYPE(Conditional) 2272 DECLARE_NODE_TYPE(Conditional)
2247 2273
2248 Expression* condition() const { return condition_; } 2274 Expression* condition() const { return condition_; }
2249 Expression* then_expression() const { return then_expression_; } 2275 Expression* then_expression() const { return then_expression_; }
2250 Expression* else_expression() const { return else_expression_; } 2276 Expression* else_expression() const { return else_expression_; }
2251 2277
2252 static int num_ids() { return parent_num_ids() + 2; } 2278 static int num_ids() { return parent_num_ids() + 2; }
2253 BailoutId ThenId() const { return BailoutId(local_id(0)); } 2279 BailoutId ThenId() const { return BailoutId(local_id(0)); }
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); 3471 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos);
3446 } 3472 }
3447 3473
3448 CompareOperation* NewCompareOperation(Token::Value op, 3474 CompareOperation* NewCompareOperation(Token::Value op,
3449 Expression* left, 3475 Expression* left,
3450 Expression* right, 3476 Expression* right,
3451 int pos) { 3477 int pos) {
3452 return new (zone_) CompareOperation(zone_, op, left, right, pos); 3478 return new (zone_) CompareOperation(zone_, op, left, right, pos);
3453 } 3479 }
3454 3480
3481 SpreadOperation* NewSpreadOperation(Expression* expression, int pos) {
3482 return new (zone_) SpreadOperation(zone_, expression, pos);
3483 }
3484
3455 Conditional* NewConditional(Expression* condition, 3485 Conditional* NewConditional(Expression* condition,
3456 Expression* then_expression, 3486 Expression* then_expression,
3457 Expression* else_expression, 3487 Expression* else_expression,
3458 int position) { 3488 int position) {
3459 return new (zone_) Conditional(zone_, condition, then_expression, 3489 return new (zone_) Conditional(zone_, condition, then_expression,
3460 else_expression, position); 3490 else_expression, position);
3461 } 3491 }
3462 3492
3463 Assignment* NewAssignment(Token::Value op, 3493 Assignment* NewAssignment(Token::Value op,
3464 Expression* target, 3494 Expression* target,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3529 3559
3530 private: 3560 private:
3531 Zone* zone_; 3561 Zone* zone_;
3532 AstValueFactory* ast_value_factory_; 3562 AstValueFactory* ast_value_factory_;
3533 }; 3563 };
3534 3564
3535 3565
3536 } } // namespace v8::internal 3566 } } // namespace v8::internal
3537 3567
3538 #endif // V8_AST_H_ 3568 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/ast-numbering.cc » ('j') | src/compiler/ast-graph-builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698