Changeset 173225 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Sep 3, 2014, 2:01:43 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r173120 r173225 38 38 #include "JSFunction.h" 39 39 #include "JSLock.h" 40 #include "JSONObject.h" 40 41 #include "JSProxy.h" 41 42 #include "JSString.h" … … 46 47 #include "StructureRareDataInlines.h" 47 48 #include "TestRunnerUtils.h" 49 #include "TypeProfilerLog.h" 48 50 #include <math.h> 49 51 #include <stdio.h> … … 477 479 static EncodedJSValue JSC_HOST_CALL functionMakeMasquerader(ExecState*); 478 480 static EncodedJSValue JSC_HOST_CALL functionHasCustomProperties(ExecState*); 479 static EncodedJSValue JSC_HOST_CALL functionDumpTypesForAllVariables (ExecState*); 481 static EncodedJSValue JSC_HOST_CALL functionDumpTypesForAllVariables(ExecState*); 482 static EncodedJSValue JSC_HOST_CALL functionFindTypeForExpression(ExecState*); 483 static EncodedJSValue JSC_HOST_CALL functionReturnTypeFor(ExecState*); 480 484 481 485 #if ENABLE(SAMPLING_FLAGS) … … 628 632 addFunction(vm, "createImpureGetter", functionCreateImpureGetter, 1); 629 633 addFunction(vm, "setImpureGetterDelegate", functionSetImpureGetterDelegate, 2); 630 addFunction(vm, "dumpTypesForAllVariables", functionDumpTypesForAllVariables , 4); 634 635 addFunction(vm, "dumpTypesForAllVariables", functionDumpTypesForAllVariables , 0); 636 addFunction(vm, "findTypeForExpression", functionFindTypeForExpression, 2); 637 addFunction(vm, "returnTypeFor", functionReturnTypeFor, 1); 631 638 632 639 JSArray* array = constructEmptyArray(globalExec(), 0); … … 1064 1071 exec->vm().dumpTypeProfilerData(); 1065 1072 return JSValue::encode(jsUndefined()); 1073 } 1074 1075 EncodedJSValue JSC_HOST_CALL functionFindTypeForExpression(ExecState* exec) 1076 { 1077 RELEASE_ASSERT(exec->vm().typeProfiler()); 1078 exec->vm().typeProfilerLog()->processLogEntries(ASCIILiteral("jsc Testing API: functionFindTypeForExpression")); 1079 1080 JSValue functionValue = exec->argument(0); 1081 RELEASE_ASSERT(functionValue.isFunction()); 1082 FunctionExecutable* executable = (jsDynamicCast<JSFunction*>(functionValue.asCell()->getObject()))->jsExecutable(); 1083 1084 RELEASE_ASSERT(exec->argument(1).isString()); 1085 String substring = exec->argument(1).getString(exec); 1086 String sourceCodeText = executable->source().toString(); 1087 unsigned offset = static_cast<unsigned>(sourceCodeText.find(substring) + executable->source().startOffset()); 1088 1089 String jsonString = exec->vm().typeProfiler()->typeInformationForExpressionAtOffset(TypeProfilerSearchDescriptorNormal, offset, executable->sourceID()); 1090 return JSValue::encode(JSONParse(exec, jsonString)); 1091 } 1092 1093 EncodedJSValue JSC_HOST_CALL functionReturnTypeFor(ExecState* exec) 1094 { 1095 RELEASE_ASSERT(exec->vm().typeProfiler()); 1096 exec->vm().typeProfilerLog()->processLogEntries(ASCIILiteral("jsc Testing API: functionReturnTypeFor")); 1097 1098 JSValue functionValue = exec->argument(0); 1099 RELEASE_ASSERT(functionValue.isFunction()); 1100 FunctionExecutable* executable = (jsDynamicCast<JSFunction*>(functionValue.asCell()->getObject()))->jsExecutable(); 1101 1102 unsigned offset = executable->source().startOffset(); 1103 String jsonString = exec->vm().typeProfiler()->typeInformationForExpressionAtOffset(TypeProfilerSearchDescriptorFunctionReturn, offset, executable->sourceID()); 1104 return JSValue::encode(JSONParse(exec, jsonString)); 1066 1105 } 1067 1106
Note:
See TracChangeset
for help on using the changeset viewer.