Changeset 153165 in webkit for trunk/Source/JavaScriptCore/jit/JITDriver.h
- Timestamp:
- Jul 24, 2013, 9:00:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITDriver.h
r153147 r153165 32 32 33 33 #include "BytecodeGenerator.h" 34 #include "CompilationResult.h" 34 35 #include "DFGDriver.h" 35 36 #include "JIT.h" … … 39 40 40 41 template<typename CodeBlockType> 41 inline bool jitCompileIfAppropriate(ExecState* exec, CodeBlockType* codeBlock, RefPtr<JITCode>& jitCode, JITCode::JITType jitType, unsigned bytecodeIndex, JITCompilationEffort effort) 42 inline CompilationResult jitCompileIfAppropriateImpl( 43 ExecState* exec, CodeBlockType* codeBlock, RefPtr<JITCode>& jitCode, 44 JITCode::JITType jitType, unsigned bytecodeIndex, JITCompilationEffort effort) 42 45 { 43 46 VM& vm = exec->vm(); 44 47 45 48 if (jitType == codeBlock->getJITType()) 46 return true;49 return CompilationNotNeeded; 47 50 48 51 if (!vm.canUseJIT()) 49 return true;52 return CompilationNotNeeded; // FIXME: Investigate if this is right. https://bugs.webkit.org/show_bug.cgi?id=116246 50 53 51 54 codeBlock->unlinkIncomingCalls(); … … 54 57 55 58 if (JITCode::isOptimizingJIT(jitType)) { 56 if (DFG::tryCompile(exec, codeBlock, jitCode, bytecodeIndex)) 59 CompilationResult result = 60 DFG::tryCompile(exec, codeBlock, jitCode, bytecodeIndex); 61 if (result == CompilationSuccessful) 57 62 codeBlock->alternative()->unlinkIncomingCalls(); 58 63 else { 59 64 ASSERT(oldJITCode == jitCode); 60 return false;65 return result; 61 66 } 62 67 } else { … … 65 70 jitCode = result; 66 71 else 67 return false;72 return CompilationFailed; 68 73 } 69 74 70 codeBlock->setJITCode(jitCode, MacroAssemblerCodePtr()); 71 72 return true; 75 return CompilationSuccessful; 73 76 } 74 77 75 inline bool jitCompileFunctionIfAppropriate(ExecState* exec, FunctionCodeBlock* codeBlock, RefPtr<JITCode>& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck, JITCode::JITType jitType, unsigned bytecodeIndex, JITCompilationEffort effort) 78 inline CompilationResult jitCompileFunctionIfAppropriateImpl( 79 ExecState* exec, FunctionCodeBlock* codeBlock, RefPtr<JITCode>& jitCode, 80 MacroAssemblerCodePtr& jitCodeWithArityCheck, JITCode::JITType jitType, 81 unsigned bytecodeIndex, JITCompilationEffort effort) 76 82 { 77 83 VM& vm = exec->vm(); 78 84 79 85 if (jitType == codeBlock->getJITType()) 80 return true;86 return CompilationNotNeeded; 81 87 82 88 if (!vm.canUseJIT()) 83 return true;89 return CompilationNotNeeded; // FIXME: Investigate if this is right. https://bugs.webkit.org/show_bug.cgi?id=116246 84 90 85 91 codeBlock->unlinkIncomingCalls(); … … 89 95 90 96 if (JITCode::isOptimizingJIT(jitType)) { 91 if (DFG::tryCompileFunction(exec, codeBlock, jitCode, jitCodeWithArityCheck, bytecodeIndex)) 97 CompilationResult result = DFG::tryCompileFunction( 98 exec, codeBlock, jitCode, jitCodeWithArityCheck, bytecodeIndex); 99 if (result == CompilationSuccessful) 92 100 codeBlock->alternative()->unlinkIncomingCalls(); 93 101 else { 94 102 ASSERT(oldJITCode == jitCode); 95 103 ASSERT_UNUSED(oldJITCodeWithArityCheck, oldJITCodeWithArityCheck == jitCodeWithArityCheck); 96 return false;104 return result; 97 105 } 98 106 } else { … … 103 111 else { 104 112 ASSERT_UNUSED(oldJITCodeWithArityCheck, oldJITCodeWithArityCheck == jitCodeWithArityCheck); 105 return false;113 return CompilationFailed; 106 114 } 107 115 } 108 116 109 codeBlock->setJITCode(jitCode, jitCodeWithArityCheck); 110 111 return true; 117 return CompilationSuccessful; 118 } 119 120 template<typename CodeBlockType> 121 inline CompilationResult jitCompileIfAppropriate( 122 ExecState* exec, CodeBlockType* codeBlock, RefPtr<JITCode>& jitCode, 123 JITCode::JITType jitType, unsigned bytecodeIndex, JITCompilationEffort effort) 124 { 125 CompilationResult result = jitCompileIfAppropriateImpl( 126 exec, codeBlock, jitCode, jitType, bytecodeIndex, effort); 127 if (result == CompilationSuccessful) { 128 codeBlock->setJITCode(jitCode, MacroAssemblerCodePtr()); 129 codeBlock->vm()->heap.reportExtraMemoryCost(jitCode->size()); 130 } 131 return result; 132 } 133 134 inline CompilationResult jitCompileFunctionIfAppropriate( 135 ExecState* exec, FunctionCodeBlock* codeBlock, RefPtr<JITCode>& jitCode, 136 MacroAssemblerCodePtr& jitCodeWithArityCheck, JITCode::JITType jitType, 137 unsigned bytecodeIndex, JITCompilationEffort effort) 138 { 139 CompilationResult result = jitCompileFunctionIfAppropriateImpl( 140 exec, codeBlock, jitCode, jitCodeWithArityCheck, jitType, bytecodeIndex, effort); 141 if (result == CompilationSuccessful) { 142 codeBlock->setJITCode(jitCode, jitCodeWithArityCheck); 143 codeBlock->vm()->heap.reportExtraMemoryCost(jitCode->size()); 144 } 145 return result; 112 146 } 113 147
Note:
See TracChangeset
for help on using the changeset viewer.