Chromium Code Reviews| 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 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1628 Handle<FixedArray> constant_elements_; | 1628 Handle<FixedArray> constant_elements_; |
| 1629 ZoneList<Expression*>* values_; | 1629 ZoneList<Expression*>* values_; |
| 1630 }; | 1630 }; |
| 1631 | 1631 |
| 1632 | 1632 |
| 1633 class VariableProxy FINAL : public Expression { | 1633 class VariableProxy FINAL : public Expression { |
| 1634 public: | 1634 public: |
| 1635 DECLARE_NODE_TYPE(VariableProxy) | 1635 DECLARE_NODE_TYPE(VariableProxy) |
| 1636 | 1636 |
| 1637 bool IsValidReferenceExpression() const OVERRIDE { | 1637 bool IsValidReferenceExpression() const OVERRIDE { |
| 1638 return !is_resolved() || var()->IsValidReference(); | 1638 return !is_this(); |
| 1639 } | 1639 } |
| 1640 | 1640 |
| 1641 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } | 1641 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } |
| 1642 | 1642 |
| 1643 Handle<String> name() const { return raw_name()->string(); } | 1643 Handle<String> name() const { return raw_name()->string(); } |
| 1644 const AstRawString* raw_name() const { | 1644 const AstRawString* raw_name() const { |
| 1645 return is_resolved() ? var_->raw_name() : raw_name_; | 1645 return is_resolved() ? var_->raw_name() : raw_name_; |
| 1646 } | 1646 } |
| 1647 | 1647 |
| 1648 Variable* var() const { | 1648 Variable* var() const { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1686 } | 1686 } |
| 1687 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } | 1687 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } |
| 1688 FeedbackVectorICSlot VariableFeedbackSlot() { | 1688 FeedbackVectorICSlot VariableFeedbackSlot() { |
| 1689 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); | 1689 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); |
| 1690 return variable_feedback_slot_; | 1690 return variable_feedback_slot_; |
| 1691 } | 1691 } |
| 1692 | 1692 |
| 1693 protected: | 1693 protected: |
| 1694 VariableProxy(Zone* zone, Variable* var, int position); | 1694 VariableProxy(Zone* zone, Variable* var, int position); |
| 1695 | 1695 |
| 1696 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, | 1696 VariableProxy(Zone* zone, |
| 1697 Interface* interface, int position); | 1697 const AstRawString* name, |
| 1698 Variable::Kind variable_kind, | |
| 1699 Interface* interface, | |
| 1700 int position); | |
| 1698 | 1701 |
| 1699 class IsThisField : public BitField8<bool, 0, 1> {}; | 1702 class IsThisField : public BitField8<bool, 0, 1> {}; |
| 1700 class IsAssignedField : public BitField8<bool, 1, 1> {}; | 1703 class IsAssignedField : public BitField8<bool, 1, 1> {}; |
| 1701 class IsResolvedField : public BitField8<bool, 2, 1> {}; | 1704 class IsResolvedField : public BitField8<bool, 2, 1> {}; |
| 1702 | 1705 |
| 1703 // Start with 16-bit (or smaller) field, which should get packed together | 1706 // Start with 16-bit (or smaller) field, which should get packed together |
| 1704 // with Expression's trailing 16-bit field. | 1707 // with Expression's trailing 16-bit field. |
| 1705 uint8_t bit_field_; | 1708 uint8_t bit_field_; |
| 1706 FeedbackVectorICSlot variable_feedback_slot_; | 1709 FeedbackVectorICSlot variable_feedback_slot_; |
| 1707 union { | 1710 union { |
| (...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3408 int pos) { | 3411 int pos) { |
| 3409 return new (zone_) ArrayLiteral(zone_, values, literal_index, pos); | 3412 return new (zone_) ArrayLiteral(zone_, values, literal_index, pos); |
| 3410 } | 3413 } |
| 3411 | 3414 |
| 3412 VariableProxy* NewVariableProxy(Variable* var, | 3415 VariableProxy* NewVariableProxy(Variable* var, |
| 3413 int pos = RelocInfo::kNoPosition) { | 3416 int pos = RelocInfo::kNoPosition) { |
| 3414 return new (zone_) VariableProxy(zone_, var, pos); | 3417 return new (zone_) VariableProxy(zone_, var, pos); |
| 3415 } | 3418 } |
| 3416 | 3419 |
| 3417 VariableProxy* NewVariableProxy(const AstRawString* name, | 3420 VariableProxy* NewVariableProxy(const AstRawString* name, |
| 3418 bool is_this, | |
| 3419 Interface* interface = Interface::NewValue(), | 3421 Interface* interface = Interface::NewValue(), |
| 3420 int position = RelocInfo::kNoPosition) { | 3422 int position = RelocInfo::kNoPosition) { |
| 3421 return new (zone_) VariableProxy(zone_, name, is_this, interface, position); | 3423 return new (zone_) VariableProxy(zone_, name, |
| 3424 (name == ast_value_factory_->this_string()) | |
|
wingo
2015/02/06 17:31:19
Can we instead change from "bool is_this," to "Var
aperez
2015/02/09 16:08:14
Acknowledged.
| |
| 3425 ? Variable::THIS | |
| 3426 : Variable::NORMAL, | |
| 3427 interface, position); | |
| 3422 } | 3428 } |
| 3423 | 3429 |
| 3424 Property* NewProperty(Expression* obj, Expression* key, int pos) { | 3430 Property* NewProperty(Expression* obj, Expression* key, int pos) { |
| 3425 return new (zone_) Property(zone_, obj, key, pos); | 3431 return new (zone_) Property(zone_, obj, key, pos); |
| 3426 } | 3432 } |
| 3427 | 3433 |
| 3428 Call* NewCall(Expression* expression, | 3434 Call* NewCall(Expression* expression, |
| 3429 ZoneList<Expression*>* arguments, | 3435 ZoneList<Expression*>* arguments, |
| 3430 int pos) { | 3436 int pos) { |
| 3431 return new (zone_) Call(zone_, expression, arguments, pos); | 3437 return new (zone_) Call(zone_, expression, arguments, pos); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3548 | 3554 |
| 3549 private: | 3555 private: |
| 3550 Zone* zone_; | 3556 Zone* zone_; |
| 3551 AstValueFactory* ast_value_factory_; | 3557 AstValueFactory* ast_value_factory_; |
| 3552 }; | 3558 }; |
| 3553 | 3559 |
| 3554 | 3560 |
| 3555 } } // namespace v8::internal | 3561 } } // namespace v8::internal |
| 3556 | 3562 |
| 3557 #endif // V8_AST_H_ | 3563 #endif // V8_AST_H_ |
| OLD | NEW |