Changeset 95310 in webkit
- Timestamp:
- Sep 16, 2011 11:50:04 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95308 r95310 1 2011-09-16 Filip Pizlo <fpizlo@apple.com> 2 3 DFG JIT should inline Math.abs 4 https://bugs.webkit.org/show_bug.cgi?id=68227 5 6 Reviewed by Oliver Hunt. 7 8 This adds the ability to track intrinsic functions throughout the 9 host function infrastructure, so that the DFG can easily query 10 whether or not a call's target is intrinsic, and if so, which 11 intrinsic it is. 12 13 On top of this, it adds Math.abs intrinsics to DFG. Call(Math.abs) 14 is transformed into ValueToNumber<-ArithAbs nodes. These nodes 15 then get optimized using the usual tricks. 16 17 Also had to make a completely unrelated change to 18 DateInstanceCache.h in order to fix a preexisting alphabetical 19 sorting problem in JSGlobalData.h 20 21 This results in a big win in imaging-gaussian-blur: 61% faster 22 than before. The net win on Kraken is around 13%. 23 24 * JavaScriptCore.xcodeproj/project.pbxproj: 25 * create_hash_table: 26 * dfg/DFGByteCodeParser.cpp: 27 (JSC::DFG::ByteCodeParser::parseBlock): 28 * dfg/DFGGraph.h: 29 (JSC::DFG::Graph::isFunctionConstant): 30 (JSC::DFG::Graph::valueOfFunctionConstant): 31 * dfg/DFGIntrinsic.h: Added. 32 * dfg/DFGJITCodeGenerator.h: 33 (JSC::DFG::JITCodeGenerator::isFunctionConstant): 34 (JSC::DFG::JITCodeGenerator::valueOfFunctionConstant): 35 * dfg/DFGJITCompiler.h: 36 (JSC::DFG::JITCompiler::isFunctionConstant): 37 (JSC::DFG::JITCompiler::valueOfFunctionConstant): 38 * dfg/DFGNode.h: 39 * dfg/DFGPropagator.cpp: 40 (JSC::DFG::Propagator::propagateNode): 41 * dfg/DFGSpeculativeJIT.cpp: 42 (JSC::DFG::SpeculativeJIT::compile): 43 * jit/JITStubs.cpp: 44 (JSC::JITThunks::hostFunctionStub): 45 * jit/JITStubs.h: 46 * runtime/DateInstanceCache.h: 47 * runtime/Executable.cpp: 48 (JSC::ExecutableBase::intrinsic): 49 (JSC::NativeExecutable::intrinsic): 50 * runtime/Executable.h: 51 (JSC::NativeExecutable::create): 52 (JSC::NativeExecutable::finishCreation): 53 * runtime/JSGlobalData.cpp: 54 (JSC::JSGlobalData::getHostFunction): 55 * runtime/JSGlobalData.h: 56 * runtime/Lookup.cpp: 57 (JSC::HashTable::createTable): 58 (JSC::setUpStaticFunctionSlot): 59 * runtime/Lookup.h: 60 (JSC::HashEntry::initialize): 61 (JSC::HashEntry::intrinsic): 62 1 63 2011-09-16 Filip Pizlo <fpizlo@apple.com> 2 64 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r95240 r95310 74 74 0FD82E86141F3FF100179C94 /* PredictedType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD82E84141F3FDA00179C94 /* PredictedType.cpp */; }; 75 75 0FD82E9014207A5F00179C94 /* ValueProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD82E8E14207A5100179C94 /* ValueProfile.cpp */; }; 76 0FD82EF51423075B00179C94 /* DFGIntrinsic.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD82EF31423073900179C94 /* DFGIntrinsic.h */; settings = {ATTRIBUTES = (Private, ); }; }; 76 77 1400067712A6F7830064D123 /* OSAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1400067612A6F7830064D123 /* OSAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 77 78 1400069312A6F9E10064D123 /* OSAllocatorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */; }; … … 814 815 0FD82E84141F3FDA00179C94 /* PredictedType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredictedType.cpp; sourceTree = "<group>"; }; 815 816 0FD82E8E14207A5100179C94 /* ValueProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValueProfile.cpp; sourceTree = "<group>"; }; 817 0FD82EF31423073900179C94 /* DFGIntrinsic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGIntrinsic.h; path = dfg/DFGIntrinsic.h; sourceTree = "<group>"; }; 816 818 1400067612A6F7830064D123 /* OSAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSAllocator.h; sourceTree = "<group>"; }; 817 819 1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSAllocatorPosix.cpp; sourceTree = "<group>"; }; … … 2228 2230 isa = PBXGroup; 2229 2231 children = ( 2232 0FD82EF31423073900179C94 /* DFGIntrinsic.h */, 2230 2233 0FD82E52141DAEDE00179C94 /* DFGOSREntry.cpp */, 2231 2234 0FD82E53141DAEDE00179C94 /* DFGOSREntry.h */, … … 2427 2430 86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */, 2428 2431 86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */, 2432 0FD82EF51423075B00179C94 /* DFGIntrinsic.h in Headers */, 2429 2433 0FD82E85141F3FE300179C94 /* BoundsCheckedPointer.h in Headers */, 2430 2434 0FD82E57141DAF1000179C94 /* DFGOSREntry.h in Headers */, -
trunk/Source/JavaScriptCore/create_hash_table
r90237 r95310 253 253 print "#define THUNK_GENERATOR(generator)\n"; 254 254 print "#endif\n"; 255 print "#if ENABLE(DFG_JIT)\n"; 256 print "#define INTRINSIC(intrinsic) , intrinsic\n"; 257 print "#else\n"; 258 print "#define INTRINSIC(intrinsic)\n"; 259 print "#endif\n"; 255 260 print "\nstatic const struct HashTableValue ${nameEntries}\[$count\] = {\n"; 256 261 my $i = 0; … … 273 278 } 274 279 my $thunkGenerator = "0"; 280 my $intrinsic = "DFG::NoIntrinsic"; 275 281 if ($key eq "charCodeAt") { 276 282 $thunkGenerator = "charCodeAtThunkGenerator"; … … 291 297 if ($key eq "abs") { 292 298 $thunkGenerator = "absThunkGenerator"; 299 $intrinsic = "DFG::AbsIntrinsic"; 293 300 } 294 301 if ($key eq "floor") { … … 308 315 } 309 316 } 310 print " { \"$key\", $attrs[$i], (intptr_t)" . $castStr . "($firstValue), (intptr_t)$secondValue THUNK_GENERATOR($thunkGenerator) },\n";317 print " { \"$key\", $attrs[$i], (intptr_t)" . $castStr . "($firstValue), (intptr_t)$secondValue THUNK_GENERATOR($thunkGenerator) INTRINSIC($intrinsic) },\n"; 311 318 $i++; 312 319 } 313 print " { 0, 0, 0, 0 THUNK_GENERATOR(0) }\n";320 print " { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }\n"; 314 321 print "};\n\n"; 315 322 print "#undef THUNK_GENERATOR\n"; -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r95273 r95310 33 33 #include "DFGScoreBoard.h" 34 34 #include "CodeBlock.h" 35 #include <wtf/MathExtras.h> 35 36 36 37 namespace JSC { namespace DFG { … … 50 51 , m_constantUndefined(UINT_MAX) 51 52 , m_constantNull(UINT_MAX) 53 , m_constantNaN(UINT_MAX) 52 54 , m_constant1(UINT_MAX) 53 55 , m_constants(codeBlock->numberOfConstantRegisters()) … … 65 67 66 68 private: 69 // Handle intrinsic functions. 70 bool handleIntrinsic(bool usesResult, int resultOperand, Intrinsic, int firstArg, int lastArg); 67 71 // Parse a single basic block of bytecode instructions. 68 72 bool parseBlock(unsigned limit); … … 357 361 } 358 362 363 // This method returns a DoubleConstant with the value NaN. 364 NodeIndex constantNaN() 365 { 366 JSValue nan = jsNaN(); 367 368 // Has m_constantNaN been set up yet? 369 if (m_constantNaN == UINT_MAX) { 370 // Search the constant pool for the value NaN, if we find it, we can just reuse this! 371 unsigned numberOfConstants = m_codeBlock->numberOfConstantRegisters(); 372 for (m_constantNaN = 0; m_constantNaN < numberOfConstants; ++m_constantNaN) { 373 JSValue testMe = m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantNaN); 374 if (JSValue::encode(testMe) == JSValue::encode(nan)) 375 return getJSConstant(m_constantNaN); 376 } 377 378 // Add the value nan to the CodeBlock's constants, and add a corresponding slot in m_constants. 379 ASSERT(m_constants.size() == numberOfConstants); 380 m_codeBlock->addConstant(nan); 381 m_constants.append(ConstantRecord()); 382 ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters()); 383 } 384 385 // m_constantNaN must refer to an entry in the CodeBlock's constant pool that has the value nan. 386 ASSERT(m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantNaN).isDouble()); 387 ASSERT(isnan(m_codeBlock->getConstant(FirstConstantRegisterIndex + m_constantNaN).asDouble())); 388 return getJSConstant(m_constantNaN); 389 } 390 359 391 CodeOrigin currentCodeOrigin() 360 392 { … … 507 539 unsigned m_constantUndefined; 508 540 unsigned m_constantNull; 541 unsigned m_constantNaN; 509 542 unsigned m_constant1; 510 543 … … 569 602 m_currentIndex += OPCODE_LENGTH(name); \ 570 603 return !m_parseFailed 604 605 bool ByteCodeParser::handleIntrinsic(bool usesResult, int resultOperand, Intrinsic intrinsic, int firstArg, int lastArg) 606 { 607 switch (intrinsic) { 608 case AbsIntrinsic: { 609 if (!usesResult) { 610 // There is no such thing as executing abs for effect, so this 611 // is dead code. 612 return true; 613 } 614 615 // We don't care about the this argument. If we don't have a first 616 // argument then make this JSConstant(NaN). 617 int absArg = firstArg + 1; 618 if (absArg > lastArg) 619 set(resultOperand, constantNaN()); 620 else 621 set(resultOperand, addToGraph(ArithAbs, getToNumber(absArg))); 622 return true; 623 } 624 625 default: 626 ASSERT(intrinsic == NoIntrinsic); 627 return false; 628 } 629 } 571 630 572 631 bool ByteCodeParser::parseBlock(unsigned limit) … … 1170 1229 1171 1230 case op_call: { 1231 NodeIndex callTarget = get(currentInstruction[1].u.operand); 1232 if (m_graph.isFunctionConstant(m_codeBlock, *m_globalData, callTarget)) { 1233 int argCount = currentInstruction[2].u.operand; 1234 int registerOffset = currentInstruction[3].u.operand; 1235 int firstArg = registerOffset - argCount - RegisterFile::CallFrameHeaderSize; 1236 int lastArg = firstArg + argCount - 1; 1237 1238 // Do we have a result? 1239 bool usesResult = false; 1240 int resultOperand = 0; // make compiler happy 1241 Instruction* putInstruction = currentInstruction + OPCODE_LENGTH(op_call); 1242 if (interpreter->getOpcodeID(putInstruction->u.opcode) == op_call_put_result) { 1243 resultOperand = putInstruction[1].u.operand; 1244 usesResult = true; 1245 } 1246 1247 DFG::Intrinsic intrinsic = m_graph.valueOfFunctionConstant(m_codeBlock, *m_globalData, callTarget)->executable()->intrinsic(); 1248 1249 if (handleIntrinsic(usesResult, resultOperand, intrinsic, firstArg, lastArg)) { 1250 // NEXT_OPCODE() has to be inside braces. 1251 NEXT_OPCODE(op_call); 1252 } 1253 } 1254 1172 1255 NodeIndex call = addCall(interpreter, currentInstruction, Call); 1173 1256 aliases.recordCall(call); -
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r95273 r95310 239 239 return at(nodeIndex).isBooleanConstant(codeBlock); 240 240 } 241 bool isFunctionConstant(CodeBlock* codeBlock, JSGlobalData& globalData, NodeIndex nodeIndex) 242 { 243 if (!isJSConstant(nodeIndex)) 244 return false; 245 if (!getJSFunction(globalData, valueOfJSConstant(codeBlock, nodeIndex))) 246 return false; 247 return true; 248 } 241 249 // Helper methods get constant values from nodes. 242 250 JSValue valueOfJSConstant(CodeBlock* codeBlock, NodeIndex nodeIndex) … … 257 265 { 258 266 return valueOfJSConstantNode(codeBlock, nodeIndex).getBoolean(); 267 } 268 JSFunction* valueOfFunctionConstant(CodeBlock* codeBlock, JSGlobalData& globalData, NodeIndex nodeIndex) 269 { 270 JSCell* function = getJSFunction(globalData, valueOfJSConstant(codeBlock, nodeIndex)); 271 ASSERT(function); 272 return asFunction(function); 259 273 } 260 274 -
trunk/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h
r95273 r95310 427 427 bool isNumberConstant(NodeIndex nodeIndex) { return m_jit.isNumberConstant(nodeIndex); } 428 428 bool isBooleanConstant(NodeIndex nodeIndex) { return m_jit.isBooleanConstant(nodeIndex); } 429 bool isFunctionConstant(NodeIndex nodeIndex) { return m_jit.isFunctionConstant(nodeIndex); } 429 430 int32_t valueOfInt32Constant(NodeIndex nodeIndex) { return m_jit.valueOfInt32Constant(nodeIndex); } 430 431 double valueOfNumberConstant(NodeIndex nodeIndex) { return m_jit.valueOfNumberConstant(nodeIndex); } 431 432 JSValue valueOfJSConstant(NodeIndex nodeIndex) { return m_jit.valueOfJSConstant(nodeIndex); } 432 433 bool valueOfBooleanConstant(NodeIndex nodeIndex) { return m_jit.valueOfBooleanConstant(nodeIndex); } 434 JSFunction* valueOfFunctionConstant(NodeIndex nodeIndex) { return m_jit.valueOfFunctionConstant(nodeIndex); } 433 435 bool isNullConstant(NodeIndex nodeIndex) 434 436 { -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.h
r95240 r95310 252 252 bool isNumberConstant(NodeIndex nodeIndex) { return graph().isNumberConstant(codeBlock(), nodeIndex); } 253 253 bool isBooleanConstant(NodeIndex nodeIndex) { return graph().isBooleanConstant(codeBlock(), nodeIndex); } 254 bool isFunctionConstant(NodeIndex nodeIndex) { return graph().isFunctionConstant(codeBlock(), *globalData(), nodeIndex); } 254 255 // Helper methods get constant values from nodes. 255 256 JSValue valueOfJSConstant(NodeIndex nodeIndex) { return graph().valueOfJSConstant(codeBlock(), nodeIndex); } … … 257 258 double valueOfNumberConstant(NodeIndex nodeIndex) { return graph().valueOfNumberConstant(codeBlock(), nodeIndex); } 258 259 bool valueOfBooleanConstant(NodeIndex nodeIndex) { return graph().valueOfBooleanConstant(codeBlock(), nodeIndex); } 260 JSFunction* valueOfFunctionConstant(NodeIndex nodeIndex) { return graph().valueOfFunctionConstant(codeBlock(), *globalData(), nodeIndex); } 259 261 260 262 // These methods JIT generate dynamic, debug-only checks - akin to ASSERTs. -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r95273 r95310 152 152 macro(ArithDiv, NodeResultNumber) \ 153 153 macro(ArithMod, NodeResultNumber) \ 154 macro(ArithAbs, NodeResultNumber) \ 154 155 /* Arithmetic operators call ToNumber on their operands. */\ 155 156 macro(ValueToNumber, NodeResultNumber | NodeMustGenerate) \ -
trunk/Source/JavaScriptCore/dfg/DFGPropagator.cpp
r95273 r95310 216 216 } 217 217 218 case ArithAbs: { 219 PredictedType child = m_predictions[node.child1()]; 220 if (isStrongPrediction(child)) 221 changed |= mergePrediction(child); 222 break; 223 } 224 218 225 case LogicalNot: 219 226 case CompareLess: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r95273 r95310 1058 1058 break; 1059 1059 } 1060 1061 case ArithAbs: { 1062 if (shouldSpeculateInteger(node.child1())) { 1063 SpeculateIntegerOperand op1(this, node.child1()); 1064 GPRTemporary result(this, op1); 1065 GPRTemporary scratch(this); 1066 1067 m_jit.zeroExtend32ToPtr(op1.gpr(), result.gpr()); 1068 m_jit.rshift32(result.gpr(), MacroAssembler::TrustedImm32(31), scratch.gpr()); 1069 m_jit.add32(scratch.gpr(), result.gpr()); 1070 m_jit.xor32(scratch.gpr(), result.gpr()); 1071 speculationCheck(m_jit.branch32(MacroAssembler::Equal, result.gpr(), MacroAssembler::TrustedImm32(1 << 31))); 1072 integerResult(result.gpr(), m_compileIndex); 1073 break; 1074 } 1075 1076 SpeculateDoubleOperand op1(this, node.child1()); 1077 FPRTemporary result(this); 1078 1079 static const double negativeZeroConstant = -0.0; 1080 1081 m_jit.loadDouble(&negativeZeroConstant, result.fpr()); 1082 m_jit.andnotDouble(op1.fpr(), result.fpr()); 1083 doubleResult(result.fpr(), m_compileIndex); 1084 break; 1085 } 1060 1086 1061 1087 case LogicalNot: { -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r95134 r95310 3687 3687 std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Weak<NativeExecutable>()); 3688 3688 if (!*entry.first->second) 3689 entry.first->second.set(*globalData, NativeExecutable::create(*globalData, JIT::compileCTINativeCall(globalData, function), function, MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct()), callHostFunctionAsConstructor ));3689 entry.first->second.set(*globalData, NativeExecutable::create(*globalData, JIT::compileCTINativeCall(globalData, function), function, MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct()), callHostFunctionAsConstructor, DFG::NoIntrinsic)); 3690 3690 return entry.first->second.get(); 3691 3691 } 3692 3692 3693 NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator )3693 NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator, DFG::Intrinsic intrinsic) 3694 3694 { 3695 3695 std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Weak<NativeExecutable>()); 3696 3696 if (!*entry.first->second) { 3697 3697 MacroAssemblerCodeRef code = globalData->canUseJIT() ? generator(globalData) : MacroAssemblerCodeRef(); 3698 entry.first->second.set(*globalData, NativeExecutable::create(*globalData, code, function, MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct()), callHostFunctionAsConstructor ));3698 entry.first->second.set(*globalData, NativeExecutable::create(*globalData, code, function, MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct()), callHostFunctionAsConstructor, intrinsic)); 3699 3699 } 3700 3700 return entry.first->second.get(); -
trunk/Source/JavaScriptCore/jit/JITStubs.h
r94920 r95310 32 32 33 33 #include "CallData.h" 34 #include "DFGIntrinsic.h" 34 35 #include "MacroAssemblerCodeRef.h" 35 36 #include "Register.h" … … 298 299 299 300 NativeExecutable* hostFunctionStub(JSGlobalData*, NativeFunction); 300 NativeExecutable* hostFunctionStub(JSGlobalData*, NativeFunction, ThunkGenerator );301 NativeExecutable* hostFunctionStub(JSGlobalData*, NativeFunction, ThunkGenerator, DFG::Intrinsic); 301 302 302 303 void clearHostFunctionStubs(); -
trunk/Source/JavaScriptCore/runtime/DateInstanceCache.h
r88587 r95310 28 28 29 29 #include <wtf/DateMath.h> 30 #include <wtf/FixedArray.h> 30 31 #include <wtf/HashFunctions.h> 31 32 #include <wtf/PassRefPtr.h> -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r95016 r95310 51 51 } 52 52 53 #if ENABLE(DFG_JIT) 54 DFG::Intrinsic ExecutableBase::intrinsic() const 55 { 56 return DFG::NoIntrinsic; 57 } 58 #endif 59 53 60 class ExecutableFinalizer : public WeakHandleOwner { 54 61 virtual void finalize(Handle<Unknown> handle, void*) … … 70 77 { 71 78 } 79 80 #if ENABLE(DFG_JIT) 81 DFG::Intrinsic NativeExecutable::intrinsic() const 82 { 83 return m_intrinsic; 84 } 85 #endif 72 86 73 87 const ClassInfo ScriptExecutable::s_info = { "ScriptExecutable", &ExecutableBase::s_info, 0, 0 }; -
trunk/Source/JavaScriptCore/runtime/Executable.h
r94929 r95310 157 157 } 158 158 159 #if ENABLE(DFG_JIT) 160 virtual DFG::Intrinsic intrinsic() const; 161 #endif 162 159 163 protected: 160 164 JITCode m_jitCodeForCall; … … 174 178 175 179 #if ENABLE(JIT) 176 static NativeExecutable* create(JSGlobalData& globalData, MacroAssemblerCodeRef callThunk, NativeFunction function, MacroAssemblerCodeRef constructThunk, NativeFunction constructor )180 static NativeExecutable* create(JSGlobalData& globalData, MacroAssemblerCodeRef callThunk, NativeFunction function, MacroAssemblerCodeRef constructThunk, NativeFunction constructor, DFG::Intrinsic intrinsic) 177 181 { 178 182 NativeExecutable* executable; 179 183 if (!callThunk) { 180 184 executable = new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor); 181 executable->finishCreation(globalData, JITCode(), JITCode() );185 executable->finishCreation(globalData, JITCode(), JITCode(), intrinsic); 182 186 } else { 183 187 executable = new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor); 184 executable->finishCreation(globalData, JITCode::HostFunction(callThunk), JITCode::HostFunction(constructThunk) );188 executable->finishCreation(globalData, JITCode::HostFunction(callThunk), JITCode::HostFunction(constructThunk), intrinsic); 185 189 } 186 190 return executable; … … 205 209 protected: 206 210 #if ENABLE(JIT) 207 void finishCreation(JSGlobalData& globalData, JITCode callThunk, JITCode constructThunk )211 void finishCreation(JSGlobalData& globalData, JITCode callThunk, JITCode constructThunk, DFG::Intrinsic intrinsic) 208 212 { 209 213 Base::finishCreation(globalData); … … 212 216 m_jitCodeForCallWithArityCheck = callThunk.addressForCall(); 213 217 m_jitCodeForConstructWithArityCheck = constructThunk.addressForCall(); 214 } 218 #if ENABLE(DFG_JIT) 219 m_intrinsic = intrinsic; 220 #endif 221 } 222 #endif 223 224 #if ENABLE(DFG_JIT) 225 virtual DFG::Intrinsic intrinsic() const; 215 226 #endif 216 227 … … 236 247 // trampoline. It may be easier to make NativeFunction be passed 'this' as a part of the ArgList. 237 248 NativeFunction m_constructor; 249 250 DFG::Intrinsic m_intrinsic; 238 251 }; 239 252 -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r95240 r95310 411 411 return jitStubs->hostFunctionStub(this, function); 412 412 } 413 NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function, ThunkGenerator generator )414 { 415 return jitStubs->hostFunctionStub(this, function, generator );413 NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function, ThunkGenerator generator, DFG::Intrinsic intrinsic) 414 { 415 return jitStubs->hostFunctionStub(this, function, generator, intrinsic); 416 416 } 417 417 #else -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.h
r95240 r95310 31 31 32 32 #include "CachedTranscendentalFunction.h" 33 #include " Heap.h"33 #include "DFGIntrinsic.h" 34 34 #include "DateInstanceCache.h" 35 35 #include "ExecutableAllocator.h" 36 #include "Heap.h" 36 37 #include "Strong.h" 37 38 #include "JITStubs.h" … … 220 221 return jitStubs->ctiStub(this, generator); 221 222 } 222 NativeExecutable* getHostFunction(NativeFunction, ThunkGenerator );223 NativeExecutable* getHostFunction(NativeFunction, ThunkGenerator, DFG::Intrinsic); 223 224 #endif 224 225 NativeExecutable* getHostFunction(NativeFunction); -
trunk/Source/JavaScriptCore/runtime/Lookup.cpp
r94701 r95310 50 50 #if ENABLE(JIT) 51 51 , values[i].generator 52 #if ENABLE(DFG_JIT) 53 , values[i].intrinsic 54 #endif 52 55 #endif 53 56 ); … … 80 83 #if ENABLE(JIT) 81 84 if (entry->generator()) 82 function = JSFunction::create(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, exec->globalData().getHostFunction(entry->function(), entry->generator() ));85 function = JSFunction::create(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, exec->globalData().getHostFunction(entry->function(), entry->generator(), entry->intrinsic())); 83 86 else 84 87 #endif -
trunk/Source/JavaScriptCore/runtime/Lookup.h
r94701 r95310 23 23 24 24 #include "CallFrame.h" 25 #include "DFGIntrinsic.h" 25 26 #include "Identifier.h" 26 27 #include "JSGlobalObject.h" … … 45 46 #if ENABLE(JIT) 46 47 ThunkGenerator generator; 48 #if ENABLE(DFG_JIT) 49 DFG::Intrinsic intrinsic; 50 #endif 47 51 #endif 48 52 }; … … 59 63 #if ENABLE(JIT) 60 64 , ThunkGenerator generator = 0 65 #if ENABLE(DFG_JIT) 66 , DFG::Intrinsic intrinsic = DFG::NoIntrinsic 67 #endif 61 68 #endif 62 69 ) … … 68 75 #if ENABLE(JIT) 69 76 m_u.function.generator = generator; 77 #if ENABLE(DFG_JIT) 78 m_u.function.intrinsic = intrinsic; 79 #endif 70 80 #endif 71 81 m_next = 0; … … 79 89 #if ENABLE(JIT) 80 90 ThunkGenerator generator() const { ASSERT(m_attributes & Function); return m_u.function.generator; } 91 DFG::Intrinsic intrinsic() const 92 { 93 ASSERT(m_attributes & Function); 94 #if ENABLE(DFG_JIT) 95 return m_u.function.intrinsic; 96 #else 97 return DFG::NoIntrinsic; 98 #endif 99 } 81 100 #endif 82 101 NativeFunction function() const { ASSERT(m_attributes & Function); return m_u.function.functionValue; } … … 105 124 #if ENABLE(JIT) 106 125 ThunkGenerator generator; 126 #if ENABLE(DFG_JIT) 127 DFG::Intrinsic intrinsic; 128 #endif 107 129 #endif 108 130 } function; -
trunk/Source/WebCore/CMakeLists.txt
r95271 r95310 70 70 "${JAVASCRIPTCORE_DIR}/bytecode" 71 71 "${JAVASCRIPTCORE_DIR}/bytecompiler" 72 "${JAVASCRIPTCORE_DIR}/dfg" 72 73 "${JAVASCRIPTCORE_DIR}/heap" 73 74 "${JAVASCRIPTCORE_DIR}/debugger" -
trunk/Source/WebCore/ChangeLog
r95309 r95310 1 2011-09-16 Filip Pizlo <fpizlo@apple.com> 2 3 DFG JIT should inline Math.abs 4 https://bugs.webkit.org/show_bug.cgi?id=68227 5 6 Reviewed by Oliver Hunt. 7 8 Added JavaScriptCore/dfg to include path path. Changed the bindings 9 scripts to handle the presence of intrinsics. 10 11 * CMakeLists.txt: 12 * bindings/scripts/CodeGeneratorJS.pm: 13 (GenerateHashTable): 14 1 15 2011-09-16 Iain Merrick <husky@google.com> 2 16 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r95250 r95310 2937 2937 push(@implContent, "#define THUNK_GENERATOR(generator)\n"); 2938 2938 push(@implContent, "#endif\n"); 2939 push(@implContent, "#if ENABLE(DFG_JIT)\n"); 2940 push(@implContent, "#define INTRINSIC(intrinsic) , intrinsic\n"); 2941 push(@implContent, "#else\n"); 2942 push(@implContent, "#define INTRINSIC(intrinsic)\n"); 2943 push(@implContent, "#endif\n"); 2939 2944 push(@implContent, "\nstatic const HashTableValue $nameEntries\[\] =\n\{\n"); 2940 2945 $i = 0; … … 2956 2961 $targetType = "static_cast<PropertySlot::GetValueFunc>"; 2957 2962 } 2958 push(@implContent, " { \"$key\", @$specials[$i], (intptr_t)" . $targetType . "(@$value1[$i]), (intptr_t)@$value2[$i] THUNK_GENERATOR(0) },\n");2963 push(@implContent, " { \"$key\", @$specials[$i], (intptr_t)" . $targetType . "(@$value1[$i]), (intptr_t)@$value2[$i] THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },\n"); 2959 2964 if ($conditional) { 2960 2965 push(@implContent, "#endif\n"); … … 2962 2967 ++$i; 2963 2968 } 2964 push(@implContent, " { 0, 0, 0, 0 THUNK_GENERATOR(0) }\n");2969 push(@implContent, " { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }\n"); 2965 2970 push(@implContent, "};\n\n"); 2966 2971 push(@implContent, "#undef THUNK_GENERATOR\n"); -
trunk/Source/WebKit/CMakeLists.txt
r93637 r95310 38 38 "${JAVASCRIPTCORE_DIR}/bytecode" 39 39 "${JAVASCRIPTCORE_DIR}/bytecompiler" 40 "${JAVASCRIPTCORE_DIR}/dfg" 40 41 "${JAVASCRIPTCORE_DIR}/heap" 41 42 "${JAVASCRIPTCORE_DIR}/debugger" -
trunk/Source/WebKit/ChangeLog
r95130 r95310 1 2011-09-16 Filip Pizlo <fpizlo@apple.com> 2 3 DFG JIT should inline Math.abs 4 https://bugs.webkit.org/show_bug.cgi?id=68227 5 6 Reviewed by Oliver Hunt. 7 8 Added JavaScriptCore/dfg to include path path. 9 10 * CMakeLists.txt: 11 1 12 2011-09-14 Anders Carlsson <andersca@apple.com> 2 13 -
trunk/Source/WebKit2/CMakeLists.txt
r95303 r95310 76 76 "${JAVASCRIPTCORE_DIR}/bytecode" 77 77 "${JAVASCRIPTCORE_DIR}/bytecompiler" 78 "${JAVASCRIPTCORE_DIR}/dfg" 78 79 "${JAVASCRIPTCORE_DIR}/collector/handles" 79 80 "${JAVASCRIPTCORE_DIR}/heap" -
trunk/Source/WebKit2/ChangeLog
r95303 r95310 1 2011-09-16 Filip Pizlo <fpizlo@apple.com> 2 3 DFG JIT should inline Math.abs 4 https://bugs.webkit.org/show_bug.cgi?id=68227 5 6 Reviewed by Oliver Hunt. 7 8 Added JavaScriptCore/dfg to include path path. 9 10 * CMakeLists.txt: 11 1 12 2011-09-16 Igor Oliveira <igor.oliveira@openbossa.org> 2 13
Note: See TracChangeset
for help on using the changeset viewer.