Changeset 266251 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Aug 27, 2020, 1:11:57 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/tests/JSWrapperMapTests.mm
r251425 r266251 58 58 JSGlobalContextRef contextRef = JSGlobalContextRetain(context.JSGlobalContextRef); 59 59 JSC::JSGlobalObject* globalObject = toJS(contextRef); 60 JSC::VM& vm = globalObject->vm(); 60 61 61 62 context[@"TestClass"] = [TestClass class]; … … 64 65 JSC::JSValue aValue = toJS(globalObject, aWrapper.JSValueRef); 65 66 JSC::JSValue bValue = toJS(globalObject, bWrapper.JSValueRef); 66 JSC::Structure* aStructure = aValue.structureOrNull( );67 JSC::Structure* bStructure = bValue.structureOrNull( );67 JSC::Structure* aStructure = aValue.structureOrNull(vm); 68 JSC::Structure* bStructure = bValue.structureOrNull(vm); 68 69 checkResult(@"structure should not be null", !!aStructure); 69 70 checkResult(@"both wrappers should share the same structure", aStructure == bStructure); -
trunk/Source/JavaScriptCore/ChangeLog
r266250 r266251 1 2020-08-27 Keith Miller <[email protected]> 2 3 structureOrNull should take VM instead of getting it from the marked block 4 https://bugs.webkit.org/show_bug.cgi?id=215899 5 6 Reviewed by Yusuke Suzuki. 7 8 It's slightly faster use an existing VM over recomputing the address. It probably doesn't 9 happen to matter here for performance but it's good hygiene. 10 11 * API/tests/JSWrapperMapTests.mm: 12 (+[JSWrapperMapTests testStructureIdentity]): 13 * jit/JITOperations.cpp: 14 * runtime/JSCJSValue.h: 15 * runtime/JSCJSValueInlines.h: 16 (JSC::JSValue::structureOrNull const): 17 (JSC::JSValue::structureOrUndefined const): Deleted. 18 1 19 2020-08-27 Yusuke Suzuki <[email protected]> 2 20 -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r265600 r266251 213 213 214 214 CodeBlock* codeBlock = callFrame->codeBlock(); 215 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull( ), identifier) && !slot.isTaintedByOpaqueObject() && (slot.isCacheableValue() || slot.isCacheableGetter() || slot.isUnset()))215 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull(vm), identifier) && !slot.isTaintedByOpaqueObject() && (slot.isCacheableValue() || slot.isCacheableGetter() || slot.isUnset())) 216 216 repatchGetBy(globalObject, codeBlock, baseValue, identifier, slot, *stubInfo, GetByKind::Try); 217 217 … … 272 272 273 273 CodeBlock* codeBlock = callFrame->codeBlock(); 274 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull( ), identifier))274 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull(vm), identifier)) 275 275 repatchGetBy(globalObject, codeBlock, baseValue, identifier, slot, *stubInfo, GetByKind::Direct); 276 276 … … 335 335 336 336 CodeBlock* codeBlock = callFrame->codeBlock(); 337 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull( ), identifier))337 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull(vm), identifier)) 338 338 repatchGetBy(globalObject, codeBlock, baseValue, identifier, slot, *stubInfo, GetByKind::Normal); 339 339 return found ? slot.getValue(globalObject, ident) : jsUndefined(); … … 395 395 396 396 CodeBlock* codeBlock = callFrame->codeBlock(); 397 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull( ), identifier))397 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull(vm), identifier)) 398 398 repatchGetBy(globalObject, codeBlock, baseValue, identifier, slot, *stubInfo, GetByKind::WithThis); 399 399 return found ? slot.getValue(globalObject, ident) : jsUndefined(); … … 2147 2147 2148 2148 CacheableIdentifier identifier = CacheableIdentifier::createFromCell(subscript.asCell()); 2149 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull( ), identifier))2149 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull(vm), identifier)) 2150 2150 repatchGetBy(globalObject, codeBlock, baseValue, identifier, slot, *stubInfo, GetByKind::NormalByVal); 2151 2151 return found ? slot.getValue(globalObject, propertyName) : jsUndefined(); … … 2244 2244 2245 2245 CacheableIdentifier identifier = CacheableIdentifier::createFromCell(fieldNameValue.asCell()); 2246 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull( ), identifier))2246 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull(vm), identifier)) 2247 2247 repatchGetBy(globalObject, codeBlock, baseValue, identifier, slot, *stubInfo, GetByKind::PrivateName); 2248 2248 return JSValue::encode(slot.getValue(globalObject, fieldName)); … … 2359 2359 2360 2360 DeletePropertySlot slot; 2361 Structure* oldStructure = baseValue.structureOrNull( );2361 Structure* oldStructure = baseValue.structureOrNull(vm); 2362 2362 2363 2363 CacheableIdentifier identifier = CacheableIdentifier::createFromRawBits(rawCacheableIdentifier); … … 2370 2370 if (!parseIndex(ident)) { 2371 2371 CodeBlock* codeBlock = callFrame->codeBlock(); 2372 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull( ), identifier))2372 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull(vm), identifier)) 2373 2373 repatchDeleteBy(globalObject, codeBlock, slot, baseValue, oldStructure, identifier, *stubInfo, DelByKind::Normal, ecmaMode); 2374 2374 } … … 2423 2423 2424 2424 DeletePropertySlot slot; 2425 Structure* oldStructure = baseValue.structureOrNull( );2425 Structure* oldStructure = baseValue.structureOrNull(vm); 2426 2426 2427 2427 bool result = deleteByVal(globalObject, vm, slot, baseValue, subscript, ecmaMode); … … 2435 2435 CodeBlock* codeBlock = callFrame->codeBlock(); 2436 2436 CacheableIdentifier identifier = CacheableIdentifier::createFromCell(subscript.asCell()); 2437 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull( ), identifier))2437 if (stubInfo->considerCachingBy(vm, codeBlock, baseValue.structureOrNull(vm), identifier)) 2438 2438 repatchDeleteBy(globalObject, codeBlock, slot, baseValue, oldStructure, identifier, *stubInfo, DelByKind::NormalByVal, ecmaMode); 2439 2439 } … … 2515 2515 2516 2516 CodeBlock* codeBlock = callFrame->codeBlock(); 2517 if (stubInfo->considerCachingGeneric(vm, codeBlock, value.structureOrNull( )))2517 if (stubInfo->considerCachingGeneric(vm, codeBlock, value.structureOrNull(vm))) 2518 2518 repatchInstanceOf(globalObject, codeBlock, value, proto, *stubInfo, result); 2519 2519 -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.h
r266107 r266251 339 339 JS_EXPORT_PRIVATE bool isValidCallee(); 340 340 341 Structure* structureOrNull() const; 342 JSValue structureOrUndefined() const; 341 Structure* structureOrNull(VM&) const; 343 342 344 343 JS_EXPORT_PRIVATE void dump(PrintStream&) const; -
trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
r266107 r266251 1106 1106 } 1107 1107 1108 inline Structure* JSValue::structureOrNull( ) const1108 inline Structure* JSValue::structureOrNull(VM& vm) const 1109 1109 { 1110 1110 if (isCell()) 1111 return asCell()->structure( );1111 return asCell()->structure(vm); 1112 1112 return nullptr; 1113 }1114 1115 inline JSValue JSValue::structureOrUndefined() const1116 {1117 if (isCell())1118 return JSValue(asCell()->structure());1119 return jsUndefined();1120 1113 } 1121 1114
Note:
See TracChangeset
for help on using the changeset viewer.