Changeset 254152 in webkit
- Timestamp:
- Jan 7, 2020, 1:13:23 PM (7 years ago)
- Location:
- trunk/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
-
trunk/Source/JavaScriptCore/API/JSScript.mm
r247542 r254152 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 } -
trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm
r249885 r254152 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 -
trunk/Source/JavaScriptCore/API/JSVirtualMachineInternal.h
r247346 r254152 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 -
trunk/Source/JavaScriptCore/ChangeLog
r254143 r254152 1 2020-01-07 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Remove vm accessor in JSVirtualMachine to reduce binary size 4 https://bugs.webkit.org/show_bug.cgi?id=205880 5 6 Reviewed by Mark Lam. 7 8 Objective-C has reflection mechanism. This means that fields, methods, and their types 9 need to hold its string representations in binary even if we are using release build. 10 While typical Objective-C class does not have large size of type names, C++ struct / class 11 has very large one, and putting them in Objective-C method names, parameter types, or fields 12 makes binary size very large. 13 14 By analyzing JavaScriptCore binary, I found that Objective-C method type symbols are taking 200~KB 15 binary size. (Section __objc_methtype: 235081 (addr 0x105e9a3 offset 17164707)). And it is due to 16 JSC::VM type included in `[JSVirtualMachine vm]` accessor. 17 18 This patch removes this accessor and gets 200KB binary size reduction. 19 20 * API/JSScript.mm: 21 (-[JSScript readCache]): 22 (-[JSScript sourceCode]): 23 (-[JSScript jsSourceCode]): 24 (-[JSScript writeCache:]): 25 * API/JSVirtualMachine.mm: 26 (-[JSVirtualMachine JSContextGroupRef]): 27 (-[JSVirtualMachine isWebThreadAware]): 28 (-[JSVirtualMachine vm]): Deleted. 29 * API/JSVirtualMachineInternal.h: 30 1 31 2020-01-07 Keith Miller <keith_miller@apple.com> 2 32
Note:
See TracChangeset
for help on using the changeset viewer.