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" |
11 #include "src/ast-value-factory.h" | 11 #include "src/ast-value-factory.h" |
12 #include "src/factory.h" | 12 #include "src/factory.h" |
13 #include "src/feedback-slots.h" | 13 #include "src/feedback-slots.h" |
14 #include "src/interface.h" | 14 #include "src/interface.h" |
15 #include "src/isolate.h" | 15 #include "src/isolate.h" |
16 #include "src/jsregexp.h" | 16 #include "src/jsregexp.h" |
17 #include "src/list-inl.h" | 17 #include "src/list-inl.h" |
18 #include "src/ostreams.h" | |
19 #include "src/runtime.h" | 18 #include "src/runtime.h" |
20 #include "src/small-pointer-list.h" | 19 #include "src/small-pointer-list.h" |
21 #include "src/smart-pointers.h" | 20 #include "src/smart-pointers.h" |
22 #include "src/token.h" | 21 #include "src/token.h" |
23 #include "src/types.h" | 22 #include "src/types.h" |
24 #include "src/utils.h" | 23 #include "src/utils.h" |
25 #include "src/variables.h" | 24 #include "src/variables.h" |
26 #include "src/zone-inl.h" | 25 #include "src/zone-inl.h" |
27 | 26 |
28 namespace v8 { | 27 namespace v8 { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Forward declarations | 105 // Forward declarations |
107 class AstConstructionVisitor; | 106 class AstConstructionVisitor; |
108 template<class> class AstNodeFactory; | 107 template<class> class AstNodeFactory; |
109 class AstVisitor; | 108 class AstVisitor; |
110 class Declaration; | 109 class Declaration; |
111 class Module; | 110 class Module; |
112 class BreakableStatement; | 111 class BreakableStatement; |
113 class Expression; | 112 class Expression; |
114 class IterationStatement; | 113 class IterationStatement; |
115 class MaterializedLiteral; | 114 class MaterializedLiteral; |
| 115 class OStream; |
116 class Statement; | 116 class Statement; |
117 class TargetCollector; | 117 class TargetCollector; |
118 class TypeFeedbackOracle; | 118 class TypeFeedbackOracle; |
119 | 119 |
120 class RegExpAlternative; | 120 class RegExpAlternative; |
121 class RegExpAssertion; | 121 class RegExpAssertion; |
122 class RegExpAtom; | 122 class RegExpAtom; |
123 class RegExpBackReference; | 123 class RegExpBackReference; |
124 class RegExpCapture; | 124 class RegExpCapture; |
125 class RegExpCharacterClass; | 125 class RegExpCharacterClass; |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 static bool IsBoilerplateProperty(Property* property); | 1509 static bool IsBoilerplateProperty(Property* property); |
1510 | 1510 |
1511 // Populate the constant properties fixed array. | 1511 // Populate the constant properties fixed array. |
1512 void BuildConstantProperties(Isolate* isolate); | 1512 void BuildConstantProperties(Isolate* isolate); |
1513 | 1513 |
1514 // Mark all computed expressions that are bound to a key that | 1514 // Mark all computed expressions that are bound to a key that |
1515 // is shadowed by a later occurrence of the same key. For the | 1515 // is shadowed by a later occurrence of the same key. For the |
1516 // marked expressions, no store code is emitted. | 1516 // marked expressions, no store code is emitted. |
1517 void CalculateEmitStore(Zone* zone); | 1517 void CalculateEmitStore(Zone* zone); |
1518 | 1518 |
| 1519 // Assemble bitfield of flags for the CreateObjectLiteral helper. |
| 1520 int ComputeFlags() const { |
| 1521 int flags = fast_elements() ? kFastElements : kNoFlags; |
| 1522 flags |= has_function() ? kHasFunction : kNoFlags; |
| 1523 return flags; |
| 1524 } |
| 1525 |
1519 enum Flags { | 1526 enum Flags { |
1520 kNoFlags = 0, | 1527 kNoFlags = 0, |
1521 kFastElements = 1, | 1528 kFastElements = 1, |
1522 kHasFunction = 1 << 1 | 1529 kHasFunction = 1 << 1 |
1523 }; | 1530 }; |
1524 | 1531 |
1525 struct Accessors: public ZoneObject { | 1532 struct Accessors: public ZoneObject { |
1526 Accessors() : getter(NULL), setter(NULL) { } | 1533 Accessors() : getter(NULL), setter(NULL) { } |
1527 Expression* getter; | 1534 Expression* getter; |
1528 Expression* setter; | 1535 Expression* setter; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 ZoneList<Expression*>* values() const { return values_; } | 1595 ZoneList<Expression*>* values() const { return values_; } |
1589 | 1596 |
1590 // Return an AST id for an element that is used in simulate instructions. | 1597 // Return an AST id for an element that is used in simulate instructions. |
1591 BailoutId GetIdForElement(int i) { | 1598 BailoutId GetIdForElement(int i) { |
1592 return BailoutId(first_element_id_.ToInt() + i); | 1599 return BailoutId(first_element_id_.ToInt() + i); |
1593 } | 1600 } |
1594 | 1601 |
1595 // Populate the constant elements fixed array. | 1602 // Populate the constant elements fixed array. |
1596 void BuildConstantElements(Isolate* isolate); | 1603 void BuildConstantElements(Isolate* isolate); |
1597 | 1604 |
| 1605 // Assemble bitfield of flags for the CreateArrayLiteral helper. |
| 1606 int ComputeFlags() const { |
| 1607 int flags = depth() == 1 ? kShallowElements : kNoFlags; |
| 1608 flags |= ArrayLiteral::kDisableMementos; |
| 1609 return flags; |
| 1610 } |
| 1611 |
1598 enum Flags { | 1612 enum Flags { |
1599 kNoFlags = 0, | 1613 kNoFlags = 0, |
1600 kShallowElements = 1, | 1614 kShallowElements = 1, |
1601 kDisableMementos = 1 << 1 | 1615 kDisableMementos = 1 << 1 |
1602 }; | 1616 }; |
1603 | 1617 |
1604 protected: | 1618 protected: |
1605 ArrayLiteral(Zone* zone, | 1619 ArrayLiteral(Zone* zone, |
1606 ZoneList<Expression*>* values, | 1620 ZoneList<Expression*>* values, |
1607 int literal_index, | 1621 int literal_index, |
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3463 private: | 3477 private: |
3464 Zone* zone_; | 3478 Zone* zone_; |
3465 Visitor visitor_; | 3479 Visitor visitor_; |
3466 AstValueFactory* ast_value_factory_; | 3480 AstValueFactory* ast_value_factory_; |
3467 }; | 3481 }; |
3468 | 3482 |
3469 | 3483 |
3470 } } // namespace v8::internal | 3484 } } // namespace v8::internal |
3471 | 3485 |
3472 #endif // V8_AST_H_ | 3486 #endif // V8_AST_H_ |
OLD | NEW |