Changeset 43479 in webkit for trunk/JavaScriptCore/parser/Nodes.h
- Timestamp:
- May 10, 2009, 9:30:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/parser/Nodes.h
r43471 r43479 30 30 #include "JITCode.h" 31 31 #include "Opcode.h" 32 #include "ParserArena.h" 32 33 #include "ResultType.h" 33 34 #include "SourceCode.h" … … 102 103 }; 103 104 104 class Parser RefCounted : public RefCounted<ParserRefCounted>{105 class ParserArenaDeletable { 105 106 protected: 106 ParserRefCounted(JSGlobalData*); 107 108 public: 109 virtual ~ParserRefCounted(); 110 111 // Placeholder: To be changed to arena allocation. 112 void* operator new(size_t size, JSGlobalData*) { return fastMalloc(size); } 113 114 private: 107 ParserArenaDeletable() { } 108 109 public: 110 virtual ~ParserArenaDeletable() { } 111 112 // Objects created with this version of new are deleted when the arena is deleted. 113 void* operator new(size_t, JSGlobalData*); 114 115 // Objects created with this version of new are not deleted when the arena is deleted. 116 // Other arrangements must be made. 115 117 void* operator new(size_t); 116 118 }; 117 119 118 #ifdef NDEBUG 119 inline ParserRefCounted::~ParserRefCounted() 120 { 121 } 122 #endif 123 124 class Node : public ParserRefCounted { 125 public: 120 class ParserArenaRefCounted : public RefCounted<ParserArenaRefCounted> { 121 protected: 122 ParserArenaRefCounted(JSGlobalData*); 123 124 public: 125 virtual ~ParserArenaRefCounted() 126 { 127 ASSERT(deletionHasBegun()); 128 } 129 }; 130 131 class Node : public ParserArenaDeletable { 132 protected: 126 133 Node(JSGlobalData*); 127 134 135 public: 128 136 /* 129 137 Return value: The register holding the production's value. … … 387 395 }; 388 396 389 class ElementNode : public Parser RefCounted{397 class ElementNode : public ParserArenaDeletable { 390 398 public: 391 399 ElementNode(JSGlobalData*, int elision, ExpressionNode*); … … 420 428 }; 421 429 422 class PropertyNode : public Parser RefCounted{430 class PropertyNode : public ParserArenaDeletable { 423 431 public: 424 432 enum Type { Constant, Getter, Setter }; … … 505 513 }; 506 514 507 class ArgumentsNode : public Parser RefCounted{515 class ArgumentsNode : public ParserArenaDeletable { 508 516 public: 509 517 ArgumentsNode(JSGlobalData*); … … 1130 1138 typedef Vector<StatementNode*> StatementVector; 1131 1139 1132 class SourceElements : public Parser RefCounted{1140 class SourceElements : public ParserArenaDeletable { 1133 1141 public: 1134 1142 SourceElements(JSGlobalData*); … … 1357 1365 }; 1358 1366 1359 class ParameterNode : public Parser RefCounted{1367 class ParameterNode : public ParserArenaDeletable { 1360 1368 public: 1361 1369 ParameterNode(JSGlobalData*, const Identifier&); … … 1369 1377 ParameterNode* m_next; 1370 1378 }; 1371 1372 // Placholder. Later this will become a true arena.1373 typedef Vector<RefPtr<ParserRefCounted> > ParserArena;1374 1379 1375 1380 struct ScopeNodeData { … … 1388 1393 }; 1389 1394 1390 class ScopeNode : public StatementNode {1395 class ScopeNode : public StatementNode, public ParserArenaRefCounted { 1391 1396 public: 1392 1397 typedef DeclarationStacks::VarStack VarStack; … … 1398 1403 void adoptData(std::auto_ptr<ScopeNodeData> data) 1399 1404 { 1400 ASSERT( data->m_arena.find(this) == notFound);1405 ASSERT(!data->m_arena.contains(this)); 1401 1406 ASSERT(!m_data); 1402 1407 m_data.adopt(data); … … 1568 1573 }; 1569 1574 1570 class FuncExprNode : public ExpressionNode {1575 class FuncExprNode : public ExpressionNode, public ParserArenaRefCounted { 1571 1576 public: 1572 1577 FuncExprNode(JSGlobalData*, const Identifier&, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter = 0); … … 1585 1590 }; 1586 1591 1587 class FuncDeclNode : public StatementNode {1592 class FuncDeclNode : public StatementNode, public ParserArenaRefCounted { 1588 1593 public: 1589 1594 FuncDeclNode(JSGlobalData*, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0); … … 1601 1606 }; 1602 1607 1603 class CaseClauseNode : public Parser RefCounted{1608 class CaseClauseNode : public ParserArenaDeletable { 1604 1609 public: 1605 1610 CaseClauseNode(JSGlobalData*, ExpressionNode*); … … 1614 1619 }; 1615 1620 1616 class ClauseListNode : public Parser RefCounted{1621 class ClauseListNode : public ParserArenaDeletable { 1617 1622 public: 1618 1623 ClauseListNode(JSGlobalData*, CaseClauseNode*); … … 1627 1632 }; 1628 1633 1629 class CaseBlockNode : public Parser RefCounted{1634 class CaseBlockNode : public ParserArenaDeletable { 1630 1635 public: 1631 1636 CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2);
Note:
See TracChangeset
for help on using the changeset viewer.