Changeset 254593 in webkit
- Timestamp:
- Jan 15, 2020, 11:14:55 AM (7 years ago)
- Location:
- branches/safari-609-branch/Source/JavaScriptCore
- Files:
-
- 4 edited
-
API/JSScript.mm (modified) (4 diffs)
-
API/JSVirtualMachine.mm (modified) (1 diff)
-
API/JSVirtualMachineInternal.h (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-609-branch/Source/JavaScriptCore/API/JSScript.mm
r247542 r254593 168 168 Ref<JSC::CachedBytecode> cachedBytecode = JSC::CachedBytecode::create(WTFMove(mappedFile)); 169 169 170 JSC::VM& vm = [m_virtualMachine vm];170 JSC::VM& vm = *toJS([m_virtualMachine JSContextGroupRef]); 171 171 JSC::SourceCode sourceCode = [self sourceCode]; 172 172 JSC::SourceCodeKey key = m_type == kJSScriptTypeProgram ? sourceCodeKeyForSerializedProgram(vm, sourceCode) : sourceCodeKeyForSerializedModule(vm, sourceCode); … … 236 236 - (JSC::SourceCode)sourceCode 237 237 { 238 JSC::VM& vm = [m_virtualMachine vm];238 JSC::VM& vm = *toJS([m_virtualMachine JSContextGroupRef]); 239 239 JSC::JSLockHolder locker(vm); 240 240 … … 249 249 - (JSC::JSSourceCode*)jsSourceCode 250 250 { 251 JSC::VM& vm = [m_virtualMachine vm];251 JSC::VM& vm = *toJS([m_virtualMachine JSContextGroupRef]); 252 252 JSC::JSLockHolder locker(vm); 253 253 JSC::JSSourceCode* jsSourceCode = JSC::JSSourceCode::create(vm, [self sourceCode]); … … 278 278 JSC::BytecodeCacheError cacheError; 279 279 JSC::SourceCode sourceCode = [self sourceCode]; 280 JSC::VM& vm = *toJS([m_virtualMachine JSContextGroupRef]); 280 281 switch (m_type) { 281 282 case kJSScriptTypeModule: 282 m_cachedBytecode = JSC::generateModuleBytecode( [m_virtualMachine vm], sourceCode, fd, cacheError);283 m_cachedBytecode = JSC::generateModuleBytecode(vm, sourceCode, fd, cacheError); 283 284 break; 284 285 case kJSScriptTypeProgram: 285 m_cachedBytecode = JSC::generateProgramBytecode( [m_virtualMachine vm], sourceCode, fd, cacheError);286 m_cachedBytecode = JSC::generateProgramBytecode(vm, sourceCode, fd, cacheError); 286 287 break; 287 288 } -
branches/safari-609-branch/Source/JavaScriptCore/API/JSVirtualMachine.mm
r249885 r254593 299 299 #endif // ENABLE(DFG_JIT) 300 300 301 - (JSC ::VM&)vm302 { 303 return *toJS(m_group);301 - (JSContextGroupRef)JSContextGroupRef 302 { 303 return m_group; 304 304 } 305 305 306 306 - (BOOL)isWebThreadAware 307 307 { 308 return [self vm].apiLock().isWebThreadAware(); 308 JSC::VM* vm = toJS(m_group); 309 return vm->apiLock().isWebThreadAware(); 309 310 } 310 311 -
branches/safari-609-branch/Source/JavaScriptCore/API/JSVirtualMachineInternal.h
r247346 r254593 47 47 - (JSContext *)contextForGlobalContextRef:(JSGlobalContextRef)globalContext; 48 48 - (void)addContext:(JSContext *)wrapper forGlobalContextRef:(JSGlobalContextRef)globalContext; 49 - ( JSC::VM&)vm;49 - (BOOL)isWebThreadAware; 50 50 51 - (BOOL)isWebThreadAware;51 @property (readonly) JSContextGroupRef JSContextGroupRef; 52 52 53 53 @end -
branches/safari-609-branch/Source/JavaScriptCore/ChangeLog
r254477 r254593 1 2020-01-14 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r254152. rdar://problem/58552854 4 5 [JSC] Remove vm accessor in JSVirtualMachine to reduce binary size 6 https://bugs.webkit.org/show_bug.cgi?id=205880 7 8 Reviewed by Mark Lam. 9 10 Objective-C has reflection mechanism. This means that fields, methods, and their types 11 need to hold its string representations in binary even if we are using release build. 12 While typical Objective-C class does not have large size of type names, C++ struct / class 13 has very large one, and putting them in Objective-C method names, parameter types, or fields 14 makes binary size very large. 15 16 By analyzing JavaScriptCore binary, I found that Objective-C method type symbols are taking 200~KB 17 binary size. (Section __objc_methtype: 235081 (addr 0x105e9a3 offset 17164707)). And it is due to 18 JSC::VM type included in `[JSVirtualMachine vm]` accessor. 19 20 This patch removes this accessor and gets 200KB binary size reduction. 21 22 * API/JSScript.mm: 23 (-[JSScript readCache]): 24 (-[JSScript sourceCode]): 25 (-[JSScript jsSourceCode]): 26 (-[JSScript writeCache:]): 27 * API/JSVirtualMachine.mm: 28 (-[JSVirtualMachine JSContextGroupRef]): 29 (-[JSVirtualMachine isWebThreadAware]): 30 (-[JSVirtualMachine vm]): Deleted. 31 * API/JSVirtualMachineInternal.h: 32 33 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254152 268f45cc-cd09-0410-ab3c-d52691b4dbfc 34 35 2020-01-07 Yusuke Suzuki <ysuzuki@apple.com> 36 37 [JSC] Remove vm accessor in JSVirtualMachine to reduce binary size 38 https://bugs.webkit.org/show_bug.cgi?id=205880 39 40 Reviewed by Mark Lam. 41 42 Objective-C has reflection mechanism. This means that fields, methods, and their types 43 need to hold its string representations in binary even if we are using release build. 44 While typical Objective-C class does not have large size of type names, C++ struct / class 45 has very large one, and putting them in Objective-C method names, parameter types, or fields 46 makes binary size very large. 47 48 By analyzing JavaScriptCore binary, I found that Objective-C method type symbols are taking 200~KB 49 binary size. (Section __objc_methtype: 235081 (addr 0x105e9a3 offset 17164707)). And it is due to 50 JSC::VM type included in `[JSVirtualMachine vm]` accessor. 51 52 This patch removes this accessor and gets 200KB binary size reduction. 53 54 * API/JSScript.mm: 55 (-[JSScript readCache]): 56 (-[JSScript sourceCode]): 57 (-[JSScript jsSourceCode]): 58 (-[JSScript writeCache:]): 59 * API/JSVirtualMachine.mm: 60 (-[JSVirtualMachine JSContextGroupRef]): 61 (-[JSVirtualMachine isWebThreadAware]): 62 (-[JSVirtualMachine vm]): Deleted. 63 * API/JSVirtualMachineInternal.h: 64 1 65 2020-01-13 Alan Coon <alancoon@apple.com> 2 66
Note:
See TracChangeset
for help on using the changeset viewer.