Changeset 128680 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Sep 14, 2012, 8:29:04 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r128670 r128680 1 2012-09-14 Filip Pizlo <[email protected]> 2 3 All of the things in SparseArrayValueMap should be out-of-line 4 https://bugs.webkit.org/show_bug.cgi?id=96854 5 6 Reviewed by Andy Estes. 7 8 Those inline methods were buying us nothing. 9 10 * GNUmakefile.list.am: 11 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 12 * JavaScriptCore.xcodeproj/project.pbxproj: 13 * runtime/JSArray.cpp: 14 * runtime/JSGlobalData.cpp: 15 * runtime/JSObject.cpp: 16 * runtime/RegExpMatchesArray.cpp: 17 * runtime/SparseArrayValueMap.cpp: 18 (JSC::SparseArrayValueMap::SparseArrayValueMap): 19 (JSC): 20 (JSC::SparseArrayValueMap::~SparseArrayValueMap): 21 (JSC::SparseArrayValueMap::finishCreation): 22 (JSC::SparseArrayValueMap::create): 23 (JSC::SparseArrayValueMap::destroy): 24 (JSC::SparseArrayValueMap::createStructure): 25 (JSC::SparseArrayValueMap::add): 26 (JSC::SparseArrayValueMap::putEntry): 27 (JSC::SparseArrayValueMap::putDirect): 28 (JSC::SparseArrayEntry::get): 29 (JSC::SparseArrayEntry::getNonSparseMode): 30 (JSC::SparseArrayValueMap::visitChildren): 31 * runtime/SparseArrayValueMapInlineMethods.h: Removed. 32 1 33 2012-09-14 Mike West <[email protected]> 2 34 -
trunk/Source/JavaScriptCore/GNUmakefile.list.am
r128400 r128680 648 648 Source/JavaScriptCore/runtime/SmallStrings.cpp \ 649 649 Source/JavaScriptCore/runtime/SmallStrings.h \ 650 Source/JavaScriptCore/runtime/SparseArrayValueMapInlineMethods.h \651 650 Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp \ 652 651 Source/JavaScriptCore/runtime/SparseArrayValueMap.h \ -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
r128400 r128680 519 519 </File> 520 520 <File 521 RelativePath="..\..\runtime\SparseArrayValueMapInlineMethods.h"522 >523 </File>524 <File525 521 RelativePath="..\..\runtime\ArrayStorage.h" 526 522 > -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r128400 r128680 201 201 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39115ED8E3800F167B2 /* Reject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 202 202 0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; 203 0FB7F39F15ED8E4600F167B2 /* SparseArrayValueMapInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB7F39315ED8E3800F167B2 /* SparseArrayValueMapInlineMethods.h */; settings = {ATTRIBUTES = (Private, ); }; };204 203 0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */; }; 205 204 0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 972 971 0FB7F39115ED8E3800F167B2 /* Reject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reject.h; sourceTree = "<group>"; }; 973 972 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SparseArrayValueMap.h; sourceTree = "<group>"; }; 974 0FB7F39315ED8E3800F167B2 /* SparseArrayValueMapInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SparseArrayValueMapInlineMethods.h; sourceTree = "<group>"; };975 973 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFGExitProfile.cpp; sourceTree = "<group>"; }; 976 974 0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFGExitProfile.h; sourceTree = "<group>"; }; … … 2058 2056 0FB7F39115ED8E3800F167B2 /* Reject.h */, 2059 2057 0FB7F39215ED8E3800F167B2 /* SparseArrayValueMap.h */, 2060 0FB7F39315ED8E3800F167B2 /* SparseArrayValueMapInlineMethods.h */,2061 2058 C2D58C3315912FEE0021A844 /* GCActivityCallback.cpp */, 2062 2059 BCF605110E203EF800B9A64D /* ArgList.cpp */, … … 2953 2950 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */, 2954 2951 0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */, 2955 0FB7F39F15ED8E4600F167B2 /* SparseArrayValueMapInlineMethods.h in Headers */,2956 2952 0F0CD4C215F1A6070032F1C0 /* PutDirectIndexMode.h in Headers */, 2957 2953 ); -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r128667 r128680 35 35 #include "PropertyNameArray.h" 36 36 #include "Reject.h" 37 #include "SparseArrayValueMapInlineMethods.h"38 37 #include <wtf/AVLTree.h> 39 38 #include <wtf/Assertions.h> -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r128498 r128680 56 56 #include "RegExpCache.h" 57 57 #include "RegExpObject.h" 58 #include "SparseArrayValueMapInlineMethods.h"59 58 #include "StrictEvalActivation.h" 60 59 #include "StrongInlines.h" -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r128428 r128680 43 43 #include "Reject.h" 44 44 #include "SlotVisitorInlineMethods.h" 45 #include "SparseArrayValueMapInlineMethods.h"46 45 #include <math.h> 47 46 #include <wtf/Assertions.h> -
trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp
r128400 r128680 28 28 29 29 #include "ButterflyInlineMethods.h" 30 #include "SparseArrayValueMapInlineMethods.h"31 30 32 31 namespace JSC { -
trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
r128400 r128680 28 28 29 29 #include "ClassInfo.h" 30 #include "SparseArrayValueMapInlineMethods.h" 30 #include "GetterSetter.h" 31 #include "JSObject.h" 32 #include "PropertySlot.h" 33 #include "Reject.h" 34 #include "SlotVisitor.h" 35 #include "Structure.h" 31 36 32 37 namespace JSC { … … 34 39 const ClassInfo SparseArrayValueMap::s_info = { "SparseArrayValueMap", 0, 0, 0, CREATE_METHOD_TABLE(SparseArrayValueMap) }; 35 40 41 SparseArrayValueMap::SparseArrayValueMap(JSGlobalData& globalData) 42 : Base(globalData, globalData.sparseArrayValueMapStructure.get()) 43 , m_flags(Normal) 44 , m_reportedCapacity(0) 45 { 46 } 47 48 SparseArrayValueMap::~SparseArrayValueMap() 49 { 50 } 51 52 void SparseArrayValueMap::finishCreation(JSGlobalData& globalData) 53 { 54 Base::finishCreation(globalData); 55 } 56 57 SparseArrayValueMap* SparseArrayValueMap::create(JSGlobalData& globalData) 58 { 59 SparseArrayValueMap* result = new (NotNull, allocateCell<SparseArrayValueMap>(globalData.heap)) SparseArrayValueMap(globalData); 60 result->finishCreation(globalData); 61 return result; 62 } 63 64 void SparseArrayValueMap::destroy(JSCell* cell) 65 { 66 static_cast<SparseArrayValueMap*>(cell)->SparseArrayValueMap::~SparseArrayValueMap(); 67 } 68 69 Structure* SparseArrayValueMap::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) 70 { 71 return Structure::create(globalData, globalObject, prototype, TypeInfo(CompoundType, StructureFlags), &s_info); 72 } 73 74 SparseArrayValueMap::AddResult SparseArrayValueMap::add(JSObject* array, unsigned i) 75 { 76 SparseArrayEntry entry; 77 entry.setWithoutWriteBarrier(jsUndefined()); 78 79 AddResult result = m_map.add(i, entry); 80 size_t capacity = m_map.capacity(); 81 if (capacity != m_reportedCapacity) { 82 Heap::heap(array)->reportExtraMemoryCost((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>))); 83 m_reportedCapacity = capacity; 84 } 85 return result; 86 } 87 88 void SparseArrayValueMap::putEntry(ExecState* exec, JSObject* array, unsigned i, JSValue value, bool shouldThrow) 89 { 90 AddResult result = add(array, i); 91 SparseArrayEntry& entry = result.iterator->second; 92 93 // To save a separate find & add, we first always add to the sparse map. 94 // In the uncommon case that this is a new property, and the array is not 95 // extensible, this is not the right thing to have done - so remove again. 96 if (result.isNewEntry && !array->isExtensible()) { 97 remove(result.iterator); 98 if (shouldThrow) 99 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 100 return; 101 } 102 103 if (!(entry.attributes & Accessor)) { 104 if (entry.attributes & ReadOnly) { 105 if (shouldThrow) 106 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 107 return; 108 } 109 110 entry.set(exec->globalData(), this, value); 111 return; 112 } 113 114 JSValue accessor = entry.SparseArrayEntry::Base::get(); 115 ASSERT(accessor.isGetterSetter()); 116 JSObject* setter = asGetterSetter(accessor)->setter(); 117 118 if (!setter) { 119 if (shouldThrow) 120 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 121 return; 122 } 123 124 CallData callData; 125 CallType callType = setter->methodTable()->getCallData(setter, callData); 126 MarkedArgumentBuffer args; 127 args.append(value); 128 call(exec, setter, callType, callData, array, args); 129 } 130 131 bool SparseArrayValueMap::putDirect(ExecState* exec, JSObject* array, unsigned i, JSValue value, unsigned attributes, PutDirectIndexMode mode) 132 { 133 AddResult result = add(array, i); 134 SparseArrayEntry& entry = result.iterator->second; 135 136 // To save a separate find & add, we first always add to the sparse map. 137 // In the uncommon case that this is a new property, and the array is not 138 // extensible, this is not the right thing to have done - so remove again. 139 if (mode != PutDirectIndexLikePutDirect && result.isNewEntry && !array->isExtensible()) { 140 remove(result.iterator); 141 return reject(exec, mode == PutDirectIndexShouldThrow, "Attempting to define property on object that is not extensible."); 142 } 143 144 entry.attributes = attributes; 145 entry.set(exec->globalData(), this, value); 146 return true; 147 } 148 149 void SparseArrayEntry::get(PropertySlot& slot) const 150 { 151 JSValue value = Base::get(); 152 ASSERT(value); 153 154 if (LIKELY(!value.isGetterSetter())) { 155 slot.setValue(value); 156 return; 157 } 158 159 JSObject* getter = asGetterSetter(value)->getter(); 160 if (!getter) { 161 slot.setUndefined(); 162 return; 163 } 164 165 slot.setGetterSlot(getter); 166 } 167 168 void SparseArrayEntry::get(PropertyDescriptor& descriptor) const 169 { 170 descriptor.setDescriptor(Base::get(), attributes); 171 } 172 173 JSValue SparseArrayEntry::get(ExecState* exec, JSObject* array) const 174 { 175 JSValue result = Base::get(); 176 ASSERT(result); 177 178 if (LIKELY(!result.isGetterSetter())) 179 return result; 180 181 JSObject* getter = asGetterSetter(result)->getter(); 182 if (!getter) 183 return jsUndefined(); 184 185 CallData callData; 186 CallType callType = getter->methodTable()->getCallData(getter, callData); 187 return call(exec, getter, callType, callData, array, exec->emptyList()); 188 } 189 190 JSValue SparseArrayEntry::getNonSparseMode() const 191 { 192 ASSERT(!attributes); 193 return Base::get(); 194 } 195 196 void SparseArrayValueMap::visitChildren(JSCell* thisObject, SlotVisitor& visitor) 197 { 198 Base::visitChildren(thisObject, visitor); 199 200 SparseArrayValueMap* thisMap = jsCast<SparseArrayValueMap*>(thisObject); 201 iterator end = thisMap->m_map.end(); 202 for (iterator it = thisMap->m_map.begin(); it != end; ++it) 203 visitor.append(&it->second); 204 } 205 36 206 } // namespace JSC 37 207
Note:
See TracChangeset
for help on using the changeset viewer.