Chromium Code Reviews| Index: src/ast.h |
| diff --git a/src/ast.h b/src/ast.h |
| index e81c02c40a8936b36d6fb91878255a81505cfd73..1f5d72684c2a60a449f75cc49f5a4bac025e8525 100644 |
| --- a/src/ast.h |
| +++ b/src/ast.h |
| @@ -2334,6 +2334,9 @@ class Assignment final : public Expression { |
| Token::Value op() const { return TokenField::decode(bit_field_); } |
| Expression* target() const { return target_; } |
| Expression* value() const { return value_; } |
| + Expression* destructuring_assignment() const { |
| + return destructuring_assignment_; |
| + } |
| BinaryOperation* binary_operation() const { return binary_operation_; } |
| // This check relies on the definition order of token in token.h. |
| @@ -2367,6 +2370,17 @@ class Assignment final : public Expression { |
| void set_store_mode(KeyedAccessStoreMode mode) { |
| bit_field_ = StoreModeField::update(bit_field_, mode); |
| } |
| + bool is_destructuring_assignment() const { |
| + return DestructuringAssignmentField::decode(bit_field_); |
| + } |
| + void set_is_destructuring_assignment() { |
| + bit_field_ |= DestructuringAssignmentField::encode(true); |
| + } |
| + Expression* destructuring_assignment() { return destructuring_assignment_; } |
|
adamk
2015/11/25 21:05:28
Looks like this is a non-const dup of the above ac
caitp (gmail)
2015/11/25 21:41:51
Acknowledged.
|
| + |
| + void set_destructuring_assignment(Expression* expression) { |
| + destructuring_assignment_ = expression; |
| + } |
| void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
| FeedbackVectorSlotCache* cache) override; |
| @@ -2384,12 +2398,15 @@ class Assignment final : public Expression { |
| class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; |
| class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 3> {}; |
| class TokenField : public BitField16<Token::Value, 5, 8> {}; |
| + class DestructuringAssignmentField |
| + : public BitField16<bool, TokenField::kNext, 1> {}; |
|
adamk
2015/11/25 21:05:28
Can you use kNext for the above lines while you're
caitp (gmail)
2015/11/25 21:41:51
Acknowledged.
|
| // Starts with 16-bit field, which should get packed together with |
| // Expression's trailing 16-bit field. |
| uint16_t bit_field_; |
| Expression* target_; |
| Expression* value_; |
| + Expression* destructuring_assignment_; |
| BinaryOperation* binary_operation_; |
| SmallMapList receiver_types_; |
| FeedbackVectorSlot slot_; |
| @@ -3196,6 +3213,15 @@ class AstVisitor BASE_EMBEDDED { |
| #undef DEF_VISIT |
| }; |
| +// Pattern used in some AST visitors |
| +#define RETURN_IF_VISIT_NODE(node) \ |
| + do { \ |
| + AstNode* tmp = node; \ |
| + if (tmp != nullptr) { \ |
| + Visit(tmp); \ |
| + return; \ |
| + } \ |
| + } while (false) |
| #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ |
| public: \ |