Changeset 205324 in webkit
- Timestamp:
- Sep 1, 2016, 3:34:27 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/JavaScriptCore/ChangeLog ¶
r205321 r205324 1 2016-09-01 Mark Lam <mark.lam@apple.com> 2 3 Move some JSObject and JSArray inline functions to their respective Inlines.h files. 4 https://bugs.webkit.org/show_bug.cgi?id=161499 5 6 Reviewed by Saam Barati. 7 8 This is just a refactoring patch to move some inline functions to their Inlines.h 9 files. This will be needed to enable https://bugs.webkit.org/show_bug.cgi?id=161498 10 later. 11 12 * bindings/ScriptValue.cpp: 13 * interpreter/Interpreter.cpp: 14 * runtime/IntlDateTimeFormatPrototype.cpp: 15 * runtime/IntlNumberFormatPrototype.cpp: 16 * runtime/JSArray.cpp: 17 * runtime/JSArray.h: 18 (JSC::getLength): Deleted. 19 (JSC::toLength): Deleted. 20 * runtime/JSArrayInlines.h: 21 (JSC::JSArray::mergeIndexingTypeForCopying): 22 (JSC::JSArray::canFastCopy): 23 (JSC::getLength): 24 (JSC::toLength): 25 * runtime/JSInternalPromise.cpp: 26 * runtime/JSInternalPromiseDeferred.cpp: 27 * runtime/JSJob.cpp: 28 * runtime/JSModuleRecord.cpp: 29 * runtime/JSObject.h: 30 (JSC::JSObject::getPropertySlot): Deleted. 31 (JSC::JSObject::getNonIndexPropertySlot): Deleted. 32 * runtime/JSObjectInlines.h: 33 (JSC::JSObject::getPropertySlot): 34 (JSC::JSObject::getNonIndexPropertySlot): 35 * runtime/JSPromiseDeferred.cpp: 36 * runtime/JSTypedArrayViewPrototype.cpp: 37 * runtime/MapConstructor.cpp: 38 * runtime/SamplingProfiler.cpp: 39 * runtime/SetConstructor.cpp: 40 * runtime/WeakMapConstructor.cpp: 41 * runtime/WeakSetConstructor.cpp: 42 1 43 2016-09-01 JF Bastien <jfbastien@apple.com> 2 44 -
TabularUnified trunk/Source/JavaScriptCore/bindings/ScriptValue.cpp ¶
r204912 r205324 34 34 #include "InspectorValues.h" 35 35 #include "JSLock.h" 36 #include "JSObjectInlines.h" 36 37 #include "StructureInlines.h" 37 38 -
TabularUnified trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp ¶
r205198 r205324 44 44 #include "ExceptionHelpers.h" 45 45 #include "GetterSetter.h" 46 #include "JSArray .h"46 #include "JSArrayInlines.h" 47 47 #include "JSBoundFunction.h" 48 48 #include "JSCInlines.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp ¶
r205198 r205324 38 38 #include "JSCJSValueInlines.h" 39 39 #include "JSCellInlines.h" 40 #include "JSObject .h"40 #include "JSObjectInlines.h" 41 41 #include "StructureInlines.h" 42 42 -
TabularUnified trunk/Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp ¶
r205198 r205324 36 36 #include "JSCJSValueInlines.h" 37 37 #include "JSCellInlines.h" 38 #include "JSObject .h"38 #include "JSObjectInlines.h" 39 39 #include "StructureInlines.h" 40 40 -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSArray.cpp ¶
r205198 r205324 32 32 #include "GetterSetter.h" 33 33 #include "IndexingHeaderInlines.h" 34 #include "JSArrayInlines.h" 34 35 #include "JSCInlines.h" 35 36 #include "PropertyNameArray.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSArray.h ¶
r204912 r205324 342 342 } 343 343 344 ALWAYS_INLINE unsigned getLength(ExecState* exec, JSObject* obj)345 {346 if (isJSArray(obj))347 return jsCast<JSArray*>(obj)->length();348 349 VM& vm = exec->vm();350 JSValue lengthValue = obj->get(exec, vm.propertyNames->length);351 if (UNLIKELY(vm.exception()))352 return UINT_MAX;353 return lengthValue.toUInt32(exec);354 }355 356 ALWAYS_INLINE double toLength(ExecState* exec, JSObject* obj)357 {358 if (isJSArray(obj))359 return jsCast<JSArray*>(obj)->length();360 361 VM& vm = exec->vm();362 JSValue lengthValue = obj->get(exec, vm.propertyNames->length);363 if (UNLIKELY(vm.exception()))364 return PNaN;365 return lengthValue.toLength(exec);366 }367 368 344 } // namespace JSC 369 345 -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h ¶
r202125 r205324 27 27 namespace JSC { 28 28 29 IndexingType JSArray::mergeIndexingTypeForCopying(IndexingType other)29 inline IndexingType JSArray::mergeIndexingTypeForCopying(IndexingType other) 30 30 { 31 31 IndexingType type = indexingType(); … … 57 57 } 58 58 59 bool JSArray::canFastCopy(VM& vm, JSArray* otherArray)59 inline bool JSArray::canFastCopy(VM& vm, JSArray* otherArray) 60 60 { 61 61 if (hasAnyArrayStorage(indexingType()) || hasAnyArrayStorage(otherArray->indexingType())) … … 69 69 } 70 70 71 ALWAYS_INLINE unsigned getLength(ExecState* exec, JSObject* obj) 72 { 73 if (isJSArray(obj)) 74 return jsCast<JSArray*>(obj)->length(); 75 76 VM& vm = exec->vm(); 77 JSValue lengthValue = obj->get(exec, vm.propertyNames->length); 78 if (UNLIKELY(vm.exception())) 79 return UINT_MAX; 80 return lengthValue.toUInt32(exec); 81 } 82 83 ALWAYS_INLINE double toLength(ExecState* exec, JSObject* obj) 84 { 85 if (isJSArray(obj)) 86 return jsCast<JSArray*>(obj)->length(); 87 88 VM& vm = exec->vm(); 89 JSValue lengthValue = obj->get(exec, vm.propertyNames->length); 90 if (UNLIKELY(vm.exception())) 91 return PNaN; 92 return lengthValue.toLength(exec); 93 } 94 71 95 } // namespace JSC 72 96 -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSInternalPromise.cpp ¶
r204912 r205324 30 30 #include "JSCJSValueInlines.h" 31 31 #include "JSCellInlines.h" 32 #include "JSObjectInlines.h" 32 33 #include "StructureInlines.h" 33 34 -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSInternalPromiseDeferred.cpp ¶
r204912 r205324 34 34 #include "JSInternalPromise.h" 35 35 #include "JSInternalPromiseConstructor.h" 36 #include "JSObjectInlines.h" 36 37 #include "SlotVisitorInlines.h" 37 38 #include "StructureInlines.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSJob.cpp ¶
r204912 r205324 32 32 #include "JSCellInlines.h" 33 33 #include "JSGlobalObject.h" 34 #include "JSObjectInlines.h" 34 35 #include "Microtask.h" 35 36 #include "SlotVisitorInlines.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSModuleRecord.cpp ¶
r205198 r205324 35 35 #include "JSModuleEnvironment.h" 36 36 #include "JSModuleNamespaceObject.h" 37 #include "JSObjectInlines.h" 37 38 #include "SlotVisitorInlines.h" 38 39 #include "StructureInlines.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSObject.h ¶
r205198 r205324 1291 1291 } 1292 1292 1293 ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)1294 {1295 VM& vm = exec->vm();1296 auto& structureIDTable = vm.heap.structureIDTable();1297 JSObject* object = this;1298 MethodTable::GetPrototypeFunctionPtr defaultGetPrototype = JSObject::getPrototype;1299 while (true) {1300 Structure& structure = *structureIDTable.get(object->structureID());1301 if (structure.classInfo()->methodTable.getOwnPropertySlotByIndex(object, exec, propertyName, slot))1302 return true;1303 if (UNLIKELY(vm.exception()))1304 return false;1305 JSValue prototype;1306 if (LIKELY(structure.classInfo()->methodTable.getPrototype == defaultGetPrototype || slot.internalMethodType() == PropertySlot::InternalMethodType::VMInquiry))1307 prototype = structure.storedPrototype();1308 else {1309 prototype = object->getPrototype(vm, exec);1310 if (vm.exception())1311 return false;1312 }1313 if (!prototype.isObject())1314 return false;1315 object = asObject(prototype);1316 }1317 }1318 1319 ALWAYS_INLINE bool JSObject::getNonIndexPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)1320 {1321 // This method only supports non-index PropertyNames.1322 ASSERT(!parseIndex(propertyName));1323 1324 VM& vm = exec->vm();1325 auto& structureIDTable = vm.heap.structureIDTable();1326 JSObject* object = this;1327 MethodTable::GetPrototypeFunctionPtr defaultGetPrototype = JSObject::getPrototype;1328 while (true) {1329 Structure& structure = *structureIDTable.get(object->structureID());1330 if (LIKELY(!TypeInfo::overridesGetOwnPropertySlot(object->inlineTypeFlags()))) {1331 if (object->getOwnNonIndexPropertySlot(vm, structure, propertyName, slot))1332 return true;1333 } else {1334 if (structure.classInfo()->methodTable.getOwnPropertySlot(object, exec, propertyName, slot))1335 return true;1336 if (UNLIKELY(vm.exception()))1337 return false;1338 }1339 JSValue prototype;1340 if (LIKELY(structure.classInfo()->methodTable.getPrototype == defaultGetPrototype || slot.internalMethodType() == PropertySlot::InternalMethodType::VMInquiry))1341 prototype = structure.storedPrototype();1342 else {1343 prototype = object->getPrototype(vm, exec);1344 if (vm.exception())1345 return false;1346 }1347 if (!prototype.isObject())1348 return false;1349 object = asObject(prototype);1350 }1351 }1352 1353 1293 inline JSValue JSObject::get(ExecState* exec, PropertyName propertyName) const 1354 1294 { … … 1367 1307 1368 1308 return jsUndefined(); 1369 }1370 1371 template<typename CallbackWhenNoException>1372 ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(bool, PropertySlot&)>::type JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, CallbackWhenNoException callback) const1373 {1374 PropertySlot slot(this, PropertySlot::InternalMethodType::Get);1375 return getPropertySlot(exec, propertyName, slot, callback);1376 }1377 1378 template<typename CallbackWhenNoException>1379 ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(bool, PropertySlot&)>::type JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot, CallbackWhenNoException callback) const1380 {1381 bool found = const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot);1382 if (UNLIKELY(exec->hadException()))1383 return { };1384 return callback(found, slot);1385 1309 } 1386 1310 -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h ¶
r205198 r205324 86 86 } 87 87 88 template<typename CallbackWhenNoException> 89 ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(bool, PropertySlot&)>::type JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, CallbackWhenNoException callback) const 90 { 91 PropertySlot slot(this, PropertySlot::InternalMethodType::Get); 92 return getPropertySlot(exec, propertyName, slot, callback); 93 } 94 95 template<typename CallbackWhenNoException> 96 ALWAYS_INLINE typename std::result_of<CallbackWhenNoException(bool, PropertySlot&)>::type JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot, CallbackWhenNoException callback) const 97 { 98 bool found = const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot); 99 if (UNLIKELY(exec->hadException())) 100 return { }; 101 return callback(found, slot); 102 } 103 104 ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) 105 { 106 VM& vm = exec->vm(); 107 auto& structureIDTable = vm.heap.structureIDTable(); 108 JSObject* object = this; 109 MethodTable::GetPrototypeFunctionPtr defaultGetPrototype = JSObject::getPrototype; 110 while (true) { 111 Structure& structure = *structureIDTable.get(object->structureID()); 112 if (structure.classInfo()->methodTable.getOwnPropertySlotByIndex(object, exec, propertyName, slot)) 113 return true; 114 if (UNLIKELY(vm.exception())) 115 return false; 116 JSValue prototype; 117 if (LIKELY(structure.classInfo()->methodTable.getPrototype == defaultGetPrototype || slot.internalMethodType() == PropertySlot::InternalMethodType::VMInquiry)) 118 prototype = structure.storedPrototype(); 119 else { 120 prototype = object->getPrototype(vm, exec); 121 if (vm.exception()) 122 return false; 123 } 124 if (!prototype.isObject()) 125 return false; 126 object = asObject(prototype); 127 } 128 } 129 130 ALWAYS_INLINE bool JSObject::getNonIndexPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) 131 { 132 // This method only supports non-index PropertyNames. 133 ASSERT(!parseIndex(propertyName)); 134 135 VM& vm = exec->vm(); 136 auto& structureIDTable = vm.heap.structureIDTable(); 137 JSObject* object = this; 138 MethodTable::GetPrototypeFunctionPtr defaultGetPrototype = JSObject::getPrototype; 139 while (true) { 140 Structure& structure = *structureIDTable.get(object->structureID()); 141 if (LIKELY(!TypeInfo::overridesGetOwnPropertySlot(object->inlineTypeFlags()))) { 142 if (object->getOwnNonIndexPropertySlot(vm, structure, propertyName, slot)) 143 return true; 144 } else { 145 if (structure.classInfo()->methodTable.getOwnPropertySlot(object, exec, propertyName, slot)) 146 return true; 147 if (UNLIKELY(vm.exception())) 148 return false; 149 } 150 JSValue prototype; 151 if (LIKELY(structure.classInfo()->methodTable.getPrototype == defaultGetPrototype || slot.internalMethodType() == PropertySlot::InternalMethodType::VMInquiry)) 152 prototype = structure.storedPrototype(); 153 else { 154 prototype = object->getPrototype(vm, exec); 155 if (vm.exception()) 156 return false; 157 } 158 if (!prototype.isObject()) 159 return false; 160 object = asObject(prototype); 161 } 162 } 163 88 164 // ECMA 8.6.2.2 89 165 ALWAYS_INLINE bool JSObject::putInline(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSPromiseDeferred.cpp ¶
r204912 r205324 32 32 #include "JSCJSValueInlines.h" 33 33 #include "JSCellInlines.h" 34 #include "JSObjectInlines.h" 34 35 #include "JSPromise.h" 35 36 #include "JSPromiseConstructor.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp ¶
r205198 r205324 33 33 #include "JSFunction.h" 34 34 #include "JSGenericTypedArrayViewPrototypeFunctions.h" 35 #include "JSObjectInlines.h" 35 36 #include "TypedArrayAdaptors.h" 36 37 -
TabularUnified trunk/Source/JavaScriptCore/runtime/MapConstructor.cpp ¶
r205198 r205324 34 34 #include "JSGlobalObject.h" 35 35 #include "JSMap.h" 36 #include "JSObjectInlines.h" 36 37 #include "MapPrototype.h" 37 38 #include "StructureInlines.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp ¶
r204912 r205324 38 38 #include "JSCJSValueInlines.h" 39 39 #include "JSFunction.h" 40 #include "JSObjectInlines.h" 40 41 #include "LLIntPCRanges.h" 41 42 #include "MarkedBlock.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/SetConstructor.cpp ¶
r205198 r205324 33 33 #include "JSCellInlines.h" 34 34 #include "JSGlobalObject.h" 35 #include "JSObjectInlines.h" 35 36 #include "JSSet.h" 36 37 #include "MapData.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/WeakMapConstructor.cpp ¶
r205198 r205324 32 32 #include "JSCellInlines.h" 33 33 #include "JSGlobalObject.h" 34 #include "JSObjectInlines.h" 34 35 #include "JSWeakMap.h" 35 36 #include "StructureInlines.h" -
TabularUnified trunk/Source/JavaScriptCore/runtime/WeakSetConstructor.cpp ¶
r205198 r205324 32 32 #include "JSCellInlines.h" 33 33 #include "JSGlobalObject.h" 34 #include "JSObjectInlines.h" 34 35 #include "JSWeakSet.h" 35 36 #include "StructureInlines.h" -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r205323 r205324 1 2016-09-01 Mark Lam <mark.lam@apple.com> 2 3 Move some JSObject and JSArray inline functions to their respective Inlines.h files. 4 https://bugs.webkit.org/show_bug.cgi?id=161499 5 6 Reviewed by Saam Barati. 7 8 No new tests because there is no behavior change. 9 10 * ForwardingHeaders/runtime/JSObjectInlines.h: Added. 11 * bindings/js/JSDOMBinding.h: 12 * bindings/js/JSSQLTransactionCustom.cpp: 13 * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: 14 * contentextensions/ContentExtensionParser.cpp: 15 1 16 2016-09-01 Michael Catanzaro <mcatanzaro@igalia.com> 2 17 -
TabularUnified trunk/Source/WebCore/bindings/js/JSDOMBinding.h ¶
r205198 r205324 40 40 #include <runtime/JSCJSValueInlines.h> 41 41 #include <runtime/JSCellInlines.h> 42 #include <runtime/JSObjectInlines.h> 42 43 #include <runtime/JSTypedArrays.h> 43 44 #include <runtime/Lookup.h> -
TabularUnified trunk/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp ¶
r200626 r205324 37 37 #include "SQLTransaction.h" 38 38 #include "SQLValue.h" 39 #include <runtime/JSObjectInlines.h> 39 40 40 41 using namespace JSC; -
TabularUnified trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp ¶
r205198 r205324 97 97 #include "WebGLVertexArrayObjectOES.h" 98 98 #include <runtime/Error.h> 99 #include <runtime/JSObjectInlines.h> 99 100 #include <runtime/JSTypedArrays.h> 100 101 #include <runtime/TypedArrayInlines.h> -
TabularUnified trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp ¶
r204912 r205324 40 40 #include <JavaScriptCore/JSGlobalObject.h> 41 41 #include <JavaScriptCore/JSONObject.h> 42 #include <JavaScriptCore/JSObjectInlines.h> 42 43 #include <JavaScriptCore/StructureInlines.h> 43 44 #include <JavaScriptCore/VM.h>
Note:
See TracChangeset
for help on using the changeset viewer.