Changeset 196652 in webkit
- Timestamp:
- Feb 16, 2016 1:12:04 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r196650 r196652 1 2016-02-16 Filip Pizlo <fpizlo@apple.com> 2 3 FTL should support NewTypedArray 4 https://bugs.webkit.org/show_bug.cgi?id=154268 5 6 Reviewed by Saam Barati. 7 8 3% speed-up on pdfjs. This was already covered by many different tests. 9 10 * ftl/FTLCapabilities.cpp: 11 (JSC::FTL::canCompile): 12 * ftl/FTLLowerDFGToLLVM.cpp: 13 (JSC::FTL::DFG::LowerDFGToLLVM::compileNode): 14 (JSC::FTL::DFG::LowerDFGToLLVM::compileNewArrayWithSize): 15 (JSC::FTL::DFG::LowerDFGToLLVM::compileNewTypedArray): 16 (JSC::FTL::DFG::LowerDFGToLLVM::compileAllocatePropertyStorage): 17 (JSC::FTL::DFG::LowerDFGToLLVM::allocateBasicStorageAndGetEnd): 18 (JSC::FTL::DFG::LowerDFGToLLVM::allocateBasicStorage): 19 (JSC::FTL::DFG::LowerDFGToLLVM::allocateObject): 20 1 21 2016-02-16 Saam barati <sbarati@apple.com> 2 22 -
trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp
r196642 r196652 1 1 /* 2 * Copyright (C) 2013-201 5Apple Inc. All rights reserved.2 * Copyright (C) 2013-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 73 73 case NewArray: 74 74 case NewArrayBuffer: 75 case NewTypedArray: 75 76 case GetByOffset: 76 77 case GetGetterSetterByOffset: -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r196642 r196652 845 845 case NewArrayWithSize: 846 846 compileNewArrayWithSize(); 847 break; 848 case NewTypedArray: 849 compileNewTypedArray(); 847 850 break; 848 851 case GetTypedArrayByteOffset: … … 4091 4094 LValue butterfly = m_out.sub(endOfStorage, payloadSize); 4092 4095 4093 LValue object = allocateObject<JSArray>( 4094 structure, butterfly, failCase); 4096 LValue object = allocateObject<JSArray>(structure, butterfly, failCase); 4095 4097 4096 4098 m_out.store32(publicLength, butterfly, m_heaps.Butterfly_publicLength); … … 4159 4161 m_out.constIntPtr(structure)); 4160 4162 setJSValue(vmCall(m_out.int64, m_out.operation(operationNewArrayWithSize), m_callFrame, structureValue, publicLength)); 4163 } 4164 4165 void compileNewTypedArray() 4166 { 4167 JSGlobalObject* globalObject = m_graph.globalObjectFor(m_node->origin.semantic); 4168 TypedArrayType type = m_node->typedArrayType(); 4169 Structure* structure = globalObject->typedArrayStructure(type); 4170 4171 LValue size = lowInt32(m_node->child1()); 4172 4173 LBasicBlock smallEnoughCase = FTL_NEW_BLOCK(m_out, ("NewTypedArray small enough case")); 4174 LBasicBlock nonZeroCase = FTL_NEW_BLOCK(m_out, ("NewTypedArray non-zero case")); 4175 LBasicBlock slowCase = FTL_NEW_BLOCK(m_out, ("NewTypedArray slow case")); 4176 LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("NewTypedArray continuation")); 4177 4178 m_out.branch( 4179 m_out.above(size, m_out.constInt32(JSArrayBufferView::fastSizeLimit)), 4180 rarely(slowCase), usually(smallEnoughCase)); 4181 4182 LBasicBlock lastNext = m_out.appendTo(smallEnoughCase, nonZeroCase); 4183 4184 m_out.branch(m_out.notZero32(size), usually(nonZeroCase), rarely(slowCase)); 4185 4186 m_out.appendTo(nonZeroCase, slowCase); 4187 4188 LValue byteSize = m_out.shl(m_out.zeroExtPtr(size), m_out.constInt32(logElementSize(type))); 4189 if (elementSize(type) < 8) { 4190 byteSize = m_out.bitAnd( 4191 m_out.add(byteSize, m_out.constIntPtr(7)), 4192 m_out.constIntPtr(~static_cast<intptr_t>(7))); 4193 } 4194 4195 LValue storage = allocateBasicStorage(byteSize, slowCase); 4196 4197 LValue fastResultValue = allocateObject<JSArrayBufferView>(structure, storage, slowCase); 4198 4199 m_out.storePtr(storage, fastResultValue, m_heaps.JSArrayBufferView_vector); 4200 m_out.store32(size, fastResultValue, m_heaps.JSArrayBufferView_length); 4201 m_out.store32(m_out.constInt32(FastTypedArray), fastResultValue, m_heaps.JSArrayBufferView_mode); 4202 4203 ValueFromBlock fastResult = m_out.anchor(fastResultValue); 4204 m_out.jump(continuation); 4205 4206 m_out.appendTo(slowCase, continuation); 4207 4208 LValue slowResultValue = lazySlowPath( 4209 [=] (const Vector<Location>& locations) -> RefPtr<LazySlowPath::Generator> { 4210 return createLazyCallGenerator( 4211 operationNewTypedArrayWithSizeForType(type), locations[0].directGPR(), 4212 CCallHelpers::TrustedImmPtr(structure), locations[1].directGPR()); 4213 }, 4214 size); 4215 ValueFromBlock slowResult = m_out.anchor(slowResultValue); 4216 m_out.jump(continuation); 4217 4218 m_out.appendTo(continuation, lastNext); 4219 setJSValue(m_out.phi(m_out.intPtr, fastResult, slowResult)); 4161 4220 } 4162 4221 … … 7932 7991 return m_out.sub( 7933 7992 m_out.loadPtr(m_out.absolute(&allocator.m_currentPayloadEnd)), newRemaining); 7993 } 7994 7995 LValue allocateBasicStorage(LValue size, LBasicBlock slowPath) 7996 { 7997 return m_out.sub(allocateBasicStorageAndGetEnd(size, slowPath), size); 7934 7998 } 7935 7999
Note: See TracChangeset
for help on using the changeset viewer.