Changeset 155090 in webkit for trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp
- Timestamp:
- Sep 4, 2013, 8:09:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCTestRunnerUtils.cpp
r153286 r155090 28 28 29 29 #include "APICast.h" 30 #include "CodeBlock.h"31 30 #include "Operations.h" 31 #include "TestRunnerUtils.h" 32 32 33 33 namespace JSC { 34 34 35 static FunctionExecutable* getExecutable(JSContextRef context, JSValueRef theFunctionValueRef)36 {37 ExecState* exec = toJS(context);38 JSValue theFunctionValue = toJS(exec, theFunctionValueRef);39 40 JSFunction* theFunction = jsDynamicCast<JSFunction*>(theFunctionValue);41 if (!theFunction)42 return 0;43 44 FunctionExecutable* executable = jsDynamicCast<FunctionExecutable*>(45 theFunction->executable());46 return executable;47 }48 49 35 JSValueRef numberOfDFGCompiles(JSContextRef context, JSValueRef theFunctionValueRef) 50 36 { 51 bool pretendToHaveManyCompiles = false; 52 #if ENABLE(DFG_JIT) 53 if (!Options::useJIT() || !Options::useDFGJIT()) 54 pretendToHaveManyCompiles = true; 55 #else 56 pretendToHaveManyCompiles = true; 57 #endif 58 59 if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef)) { 60 CodeBlock* baselineCodeBlock = executable->baselineCodeBlockFor(CodeForCall); 61 62 if (!baselineCodeBlock) 63 return JSValueMakeNumber(context, 0); 64 65 if (pretendToHaveManyCompiles) 66 return JSValueMakeNumber(context, 1000000.0); 67 return JSValueMakeNumber(context, baselineCodeBlock->numberOfDFGCompiles()); 68 } 69 70 return JSValueMakeUndefined(context); 37 ExecState* exec= toJS(context); 38 return toRef(exec, numberOfDFGCompiles(toJS(exec, theFunctionValueRef))); 71 39 } 72 40 73 41 JSValueRef setNeverInline(JSContextRef context, JSValueRef theFunctionValueRef) 74 42 { 75 if (FunctionExecutable* executable = getExecutable(context, theFunctionValueRef)) 76 executable->setNeverInline(true); 77 78 return JSValueMakeUndefined(context); 43 ExecState* exec= toJS(context); 44 return toRef(exec, setNeverInline(toJS(exec, theFunctionValueRef))); 79 45 } 80 46
Note:
See TracChangeset
for help on using the changeset viewer.