Changeset 36032 in webkit for trunk/JavaScriptCore/kjs/StructureID.cpp
- Timestamp:
- Sep 2, 2008, 7:31:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/StructureID.cpp
r36018 r36032 29 29 30 30 #include "identifier.h" 31 #include "JS Cell.h"31 #include "JSObject.h" 32 32 #include <wtf/RefPtr.h> 33 33 … … 54 54 55 55 if (structureID->m_transitionCount > s_maxTransitionLength) 56 return dictionaryTransition(structureID);56 return toDictionaryTransition(structureID); 57 57 58 58 RefPtr<StructureID> transition = create(structureID->m_prototype); … … 66 66 } 67 67 68 PassRefPtr<StructureID> StructureID:: dictionaryTransition(StructureID* structureID)68 PassRefPtr<StructureID> StructureID::toDictionaryTransition(StructureID* structureID) 69 69 { 70 70 ASSERT(!structureID->m_isDictionary); … … 72 72 RefPtr<StructureID> transition = create(structureID->m_prototype); 73 73 transition->m_isDictionary = true; 74 transition->m_transitionCount = structureID->m_transitionCount + 1;75 74 return transition.release(); 75 } 76 77 PassRefPtr<StructureID> StructureID::fromDictionaryTransition(StructureID* structureID) 78 { 79 ASSERT(structureID->m_isDictionary); 80 81 // Since dictionary StructureIDs are not shared, and no opcodes specialize 82 // for them, we don't need to allocate a new StructureID when transitioning 83 // to non-dictionary status. 84 structureID->m_isDictionary = false; 85 return structureID; 76 86 } 77 87 … … 99 109 100 110 StructureIDChain::StructureIDChain(StructureID* structureID) 101 : m_size(0)102 111 { 112 size_t size = 0; 113 103 114 StructureID* tmp = structureID; 104 while ( tmp->prototype() != jsNull()) {105 ++ m_size;115 while (!tmp->prototype()->isNull()) { 116 ++size; 106 117 tmp = static_cast<JSCell*>(tmp->prototype())->structureID(); 107 118 } 108 119 109 m_vector.set(new RefPtr<StructureID>[ m_size]);120 m_vector.set(new RefPtr<StructureID>[size]); 110 121 111 for (size_t i = 0; i < m_size; ++i) {122 for (size_t i = 0; i < size; ++i) { 112 123 m_vector[i] = structureID; 113 structureID = static_cast<JS Cell*>(structureID->prototype())->structureID();124 structureID = static_cast<JSObject*>(structureID->prototype())->structureID(); 114 125 } 115 126 }
Note:
See TracChangeset
for help on using the changeset viewer.