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 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 | 1616 |
1617 Handle<FixedArray> constant_elements_; | 1617 Handle<FixedArray> constant_elements_; |
1618 ZoneList<Expression*>* values_; | 1618 ZoneList<Expression*>* values_; |
1619 }; | 1619 }; |
1620 | 1620 |
1621 | 1621 |
1622 class VariableProxy FINAL : public Expression { | 1622 class VariableProxy FINAL : public Expression { |
1623 public: | 1623 public: |
1624 DECLARE_NODE_TYPE(VariableProxy) | 1624 DECLARE_NODE_TYPE(VariableProxy) |
1625 | 1625 |
1626 bool IsValidReferenceExpression() const OVERRIDE { | 1626 bool IsValidReferenceExpression() const OVERRIDE { return !is_this(); } |
1627 return !is_resolved() || var()->IsValidReference(); | |
1628 } | |
1629 | 1627 |
1630 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } | 1628 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } |
1631 | 1629 |
1632 Handle<String> name() const { return raw_name()->string(); } | 1630 Handle<String> name() const { return raw_name()->string(); } |
1633 const AstRawString* raw_name() const { | 1631 const AstRawString* raw_name() const { |
1634 return is_resolved() ? var_->raw_name() : raw_name_; | 1632 return is_resolved() ? var_->raw_name() : raw_name_; |
1635 } | 1633 } |
1636 | 1634 |
1637 Variable* var() const { | 1635 Variable* var() const { |
1638 DCHECK(is_resolved()); | 1636 DCHECK(is_resolved()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } | 1671 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } |
1674 FeedbackVectorICSlot VariableFeedbackSlot() { | 1672 FeedbackVectorICSlot VariableFeedbackSlot() { |
1675 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); | 1673 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); |
1676 return variable_feedback_slot_; | 1674 return variable_feedback_slot_; |
1677 } | 1675 } |
1678 | 1676 |
1679 protected: | 1677 protected: |
1680 VariableProxy(Zone* zone, Variable* var, int start_position, | 1678 VariableProxy(Zone* zone, Variable* var, int start_position, |
1681 int end_position); | 1679 int end_position); |
1682 | 1680 |
1683 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, | 1681 VariableProxy(Zone* zone, const AstRawString* name, |
1684 int start_position, int end_position); | 1682 Variable::Kind variable_kind, int start_position, |
| 1683 int end_position); |
1685 | 1684 |
1686 class IsThisField : public BitField8<bool, 0, 1> {}; | 1685 class IsThisField : public BitField8<bool, 0, 1> {}; |
1687 class IsAssignedField : public BitField8<bool, 1, 1> {}; | 1686 class IsAssignedField : public BitField8<bool, 1, 1> {}; |
1688 class IsResolvedField : public BitField8<bool, 2, 1> {}; | 1687 class IsResolvedField : public BitField8<bool, 2, 1> {}; |
1689 | 1688 |
1690 // Start with 16-bit (or smaller) field, which should get packed together | 1689 // Start with 16-bit (or smaller) field, which should get packed together |
1691 // with Expression's trailing 16-bit field. | 1690 // with Expression's trailing 16-bit field. |
1692 uint8_t bit_field_; | 1691 uint8_t bit_field_; |
1693 FeedbackVectorICSlot variable_feedback_slot_; | 1692 FeedbackVectorICSlot variable_feedback_slot_; |
1694 union { | 1693 union { |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3388 int pos) { | 3387 int pos) { |
3389 return new (zone_) ArrayLiteral(zone_, values, literal_index, pos); | 3388 return new (zone_) ArrayLiteral(zone_, values, literal_index, pos); |
3390 } | 3389 } |
3391 | 3390 |
3392 VariableProxy* NewVariableProxy(Variable* var, | 3391 VariableProxy* NewVariableProxy(Variable* var, |
3393 int start_position = RelocInfo::kNoPosition, | 3392 int start_position = RelocInfo::kNoPosition, |
3394 int end_position = RelocInfo::kNoPosition) { | 3393 int end_position = RelocInfo::kNoPosition) { |
3395 return new (zone_) VariableProxy(zone_, var, start_position, end_position); | 3394 return new (zone_) VariableProxy(zone_, var, start_position, end_position); |
3396 } | 3395 } |
3397 | 3396 |
3398 VariableProxy* NewVariableProxy(const AstRawString* name, bool is_this, | 3397 VariableProxy* NewVariableProxy(const AstRawString* name, |
| 3398 Variable::Kind variable_kind, |
3399 int start_position = RelocInfo::kNoPosition, | 3399 int start_position = RelocInfo::kNoPosition, |
3400 int end_position = RelocInfo::kNoPosition) { | 3400 int end_position = RelocInfo::kNoPosition) { |
3401 return new (zone_) | 3401 return new (zone_) |
3402 VariableProxy(zone_, name, is_this, start_position, end_position); | 3402 VariableProxy(zone_, name, variable_kind, start_position, end_position); |
3403 } | 3403 } |
3404 | 3404 |
3405 Property* NewProperty(Expression* obj, Expression* key, int pos) { | 3405 Property* NewProperty(Expression* obj, Expression* key, int pos) { |
3406 return new (zone_) Property(zone_, obj, key, pos); | 3406 return new (zone_) Property(zone_, obj, key, pos); |
3407 } | 3407 } |
3408 | 3408 |
3409 Call* NewCall(Expression* expression, | 3409 Call* NewCall(Expression* expression, |
3410 ZoneList<Expression*>* arguments, | 3410 ZoneList<Expression*>* arguments, |
3411 int pos) { | 3411 int pos) { |
3412 return new (zone_) Call(zone_, expression, arguments, pos); | 3412 return new (zone_) Call(zone_, expression, arguments, pos); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3529 | 3529 |
3530 private: | 3530 private: |
3531 Zone* zone_; | 3531 Zone* zone_; |
3532 AstValueFactory* ast_value_factory_; | 3532 AstValueFactory* ast_value_factory_; |
3533 }; | 3533 }; |
3534 | 3534 |
3535 | 3535 |
3536 } } // namespace v8::internal | 3536 } } // namespace v8::internal |
3537 | 3537 |
3538 #endif // V8_AST_H_ | 3538 #endif // V8_AST_H_ |
OLD | NEW |