|
Lines 25-30
a/Source/JavaScriptCore/jsc.cpp_sec1
|
| 25 |
#include "ArrayBuffer.h" |
25 |
#include "ArrayBuffer.h" |
| 26 |
#include "ArrayPrototype.h" |
26 |
#include "ArrayPrototype.h" |
| 27 |
#include "BuiltinExecutableCreator.h" |
27 |
#include "BuiltinExecutableCreator.h" |
|
|
28 |
#include "BuiltinNames.h" |
| 28 |
#include "ButterflyInlines.h" |
29 |
#include "ButterflyInlines.h" |
| 29 |
#include "CodeBlock.h" |
30 |
#include "CodeBlock.h" |
| 30 |
#include "Completion.h" |
31 |
#include "Completion.h" |
|
Lines 48-53
a/Source/JavaScriptCore/jsc.cpp_sec2
|
| 48 |
#include "JSInternalPromise.h" |
49 |
#include "JSInternalPromise.h" |
| 49 |
#include "JSInternalPromiseDeferred.h" |
50 |
#include "JSInternalPromiseDeferred.h" |
| 50 |
#include "JSLock.h" |
51 |
#include "JSLock.h" |
|
|
52 |
#include "JSModuleLoader.h" |
| 51 |
#include "JSNativeStdFunction.h" |
53 |
#include "JSNativeStdFunction.h" |
| 52 |
#include "JSONObject.h" |
54 |
#include "JSONObject.h" |
| 53 |
#include "JSProxy.h" |
55 |
#include "JSProxy.h" |
|
Lines 1277-1282
class GlobalObject : public JSGlobalObject {
a/Source/JavaScriptCore/jsc.cpp_sec3
|
| 1277 |
putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function, NoIntrinsic, function)); |
1279 |
putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function, NoIntrinsic, function)); |
| 1278 |
} |
1280 |
} |
| 1279 |
|
1281 |
|
|
|
1282 |
static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, ExecState*, JSModuleLoader*, JSString*, const SourceOrigin&); |
| 1280 |
static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); |
1283 |
static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); |
| 1281 |
static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue); |
1284 |
static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue); |
| 1282 |
}; |
1285 |
}; |
|
Lines 1288-1293
const GlobalObjectMethodTable GlobalObject::s_globalObjectMethodTable = {
a/Source/JavaScriptCore/jsc.cpp_sec4
|
| 1288 |
&javaScriptRuntimeFlags, |
1291 |
&javaScriptRuntimeFlags, |
| 1289 |
nullptr, |
1292 |
nullptr, |
| 1290 |
&shouldInterruptScriptBeforeTimeout, |
1293 |
&shouldInterruptScriptBeforeTimeout, |
|
|
1294 |
&moduleLoaderImportModule, |
| 1291 |
&moduleLoaderResolve, |
1295 |
&moduleLoaderResolve, |
| 1292 |
&moduleLoaderFetch, |
1296 |
&moduleLoaderFetch, |
| 1293 |
nullptr, |
1297 |
nullptr, |
|
Lines 1420-1425
static String resolvePath(const DirectoryName& directoryName, const ModuleName&
a/Source/JavaScriptCore/jsc.cpp_sec5
|
| 1420 |
return builder.toString(); |
1424 |
return builder.toString(); |
| 1421 |
} |
1425 |
} |
| 1422 |
|
1426 |
|
|
|
1427 |
static String absolutePath(const String& fileName) |
| 1428 |
{ |
| 1429 |
auto directoryName = currentWorkingDirectory(); |
| 1430 |
if (!directoryName) |
| 1431 |
return fileName; |
| 1432 |
return resolvePath(directoryName.value(), ModuleName(fileName.impl())); |
| 1433 |
} |
| 1434 |
|
| 1435 |
JSInternalPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject*, ExecState* exec, JSModuleLoader* moduleLoader, JSString* moduleName, const SourceOrigin& sourceOrigin) |
| 1436 |
{ |
| 1437 |
auto* function = jsCast<JSObject*>(moduleLoader->get(exec, exec->propertyNames().builtinNames().importModulePublicName())); |
| 1438 |
CallData callData; |
| 1439 |
auto callType = JSC::getCallData(function, callData); |
| 1440 |
ASSERT(callType != CallType::None); |
| 1441 |
|
| 1442 |
MarkedArgumentBuffer arguments; |
| 1443 |
arguments.append(moduleName); |
| 1444 |
arguments.append(jsString(exec, sourceOrigin.string())); |
| 1445 |
arguments.append(jsUndefined()); |
| 1446 |
|
| 1447 |
return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, moduleLoader, arguments)); |
| 1448 |
} |
| 1449 |
|
| 1423 |
JSInternalPromise* GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue) |
1450 |
JSInternalPromise* GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue) |
| 1424 |
{ |
1451 |
{ |
| 1425 |
VM& vm = globalObject->vm(); |
1452 |
VM& vm = globalObject->vm(); |
|
Lines 1924-1930
EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
a/Source/JavaScriptCore/jsc.cpp_sec6
|
| 1924 |
NakedPtr<Exception> exception; |
1951 |
NakedPtr<Exception> exception; |
| 1925 |
StopWatch stopWatch; |
1952 |
StopWatch stopWatch; |
| 1926 |
stopWatch.start(); |
1953 |
stopWatch.start(); |
| 1927 |
evaluate(globalObject->globalExec(), jscSource(script, fileName), JSValue(), exception); |
1954 |
evaluate(globalObject->globalExec(), jscSource(script, absolutePath(fileName)), JSValue(), exception); |
| 1928 |
stopWatch.stop(); |
1955 |
stopWatch.stop(); |
| 1929 |
|
1956 |
|
| 1930 |
if (exception) { |
1957 |
if (exception) { |
|
Lines 1976-1982
EncodedJSValue JSC_HOST_CALL functionLoad(ExecState* exec)
a/Source/JavaScriptCore/jsc.cpp_sec7
|
| 1976 |
JSGlobalObject* globalObject = exec->lexicalGlobalObject(); |
2003 |
JSGlobalObject* globalObject = exec->lexicalGlobalObject(); |
| 1977 |
|
2004 |
|
| 1978 |
NakedPtr<Exception> evaluationException; |
2005 |
NakedPtr<Exception> evaluationException; |
| 1979 |
JSValue result = evaluate(globalObject->globalExec(), jscSource(script, fileName), JSValue(), evaluationException); |
2006 |
JSValue result = evaluate(globalObject->globalExec(), jscSource(script, absolutePath(fileName)), JSValue(), evaluationException); |
| 1980 |
if (evaluationException) |
2007 |
if (evaluationException) |
| 1981 |
throwException(exec, scope, evaluationException); |
2008 |
throwException(exec, scope, evaluationException); |
| 1982 |
return JSValue::encode(result); |
2009 |
return JSValue::encode(result); |
|
Lines 2047-2053
EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
a/Source/JavaScriptCore/jsc.cpp_sec8
|
| 2047 |
stopWatch.start(); |
2074 |
stopWatch.start(); |
| 2048 |
|
2075 |
|
| 2049 |
JSValue syntaxException; |
2076 |
JSValue syntaxException; |
| 2050 |
bool validSyntax = checkSyntax(globalObject->globalExec(), jscSource(script, fileName), &syntaxException); |
2077 |
bool validSyntax = checkSyntax(globalObject->globalExec(), jscSource(script, absolutePath(fileName)), &syntaxException); |
| 2051 |
stopWatch.stop(); |
2078 |
stopWatch.stop(); |
| 2052 |
|
2079 |
|
| 2053 |
if (!validSyntax) |
2080 |
if (!validSyntax) |
|
Lines 2909-2915
static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scr
a/Source/JavaScriptCore/jsc.cpp_sec9
|
| 2909 |
bool isLastFile = i == scripts.size() - 1; |
2936 |
bool isLastFile = i == scripts.size() - 1; |
| 2910 |
if (isModule) { |
2937 |
if (isModule) { |
| 2911 |
if (!promise) |
2938 |
if (!promise) |
| 2912 |
promise = loadAndEvaluateModule(globalObject->globalExec(), jscSource(scriptBuffer, fileName)); |
2939 |
promise = loadAndEvaluateModule(globalObject->globalExec(), jscSource(scriptBuffer, absolutePath(fileName))); |
| 2913 |
scope.clearException(); |
2940 |
scope.clearException(); |
| 2914 |
|
2941 |
|
| 2915 |
JSFunction* fulfillHandler = JSNativeStdFunction::create(vm, globalObject, 1, String(), [&, isLastFile](ExecState* exec) { |
2942 |
JSFunction* fulfillHandler = JSNativeStdFunction::create(vm, globalObject, 1, String(), [&, isLastFile](ExecState* exec) { |
|
Lines 2926-2932
static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scr
a/Source/JavaScriptCore/jsc.cpp_sec10
|
| 2926 |
vm.drainMicrotasks(); |
2953 |
vm.drainMicrotasks(); |
| 2927 |
} else { |
2954 |
} else { |
| 2928 |
NakedPtr<Exception> evaluationException; |
2955 |
NakedPtr<Exception> evaluationException; |
| 2929 |
JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(scriptBuffer, fileName), JSValue(), evaluationException); |
2956 |
JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(scriptBuffer, absolutePath(fileName)), JSValue(), evaluationException); |
| 2930 |
ASSERT(!scope.exception()); |
2957 |
ASSERT(!scope.exception()); |
| 2931 |
if (evaluationException) |
2958 |
if (evaluationException) |
| 2932 |
returnValue = evaluationException->value(); |
2959 |
returnValue = evaluationException->value(); |