Changeset 210522 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Jan 9, 2017, 2:02:47 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r210229 r210522 26 26 #include "ArrayPrototype.h" 27 27 #include "BuiltinExecutableCreator.h" 28 #include "BuiltinNames.h" 28 29 #include "ButterflyInlines.h" 29 30 #include "CodeBlock.h" … … 49 50 #include "JSInternalPromiseDeferred.h" 50 51 #include "JSLock.h" 52 #include "JSModuleLoader.h" 51 53 #include "JSNativeStdFunction.h" 52 54 #include "JSONObject.h" … … 1102 1104 1103 1105 template<typename Vector> 1104 static inline SourceCode jscSource(const Vector& utf8, const S tring& filename)1106 static inline SourceCode jscSource(const Vector& utf8, const SourceOrigin& sourceOrigin, const String& filename) 1105 1107 { 1106 1108 String str = stringFromUTF(utf8); 1107 return makeSource(str, SourceOrigin { filename }, filename);1109 return makeSource(str, sourceOrigin, filename); 1108 1110 } 1109 1111 … … 1278 1280 } 1279 1281 1282 static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, ExecState*, JSModuleLoader*, JSString*, const SourceOrigin&); 1280 1283 static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); 1281 1284 static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue); … … 1289 1292 nullptr, 1290 1293 &shouldInterruptScriptBeforeTimeout, 1294 &moduleLoaderImportModule, 1291 1295 &moduleLoaderResolve, 1292 1296 &moduleLoaderFetch, … … 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 1450 JSInternalPromise* GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue) 1424 1451 { … … 1925 1952 StopWatch stopWatch; 1926 1953 stopWatch.start(); 1927 evaluate(globalObject->globalExec(), jscSource(script, fileName), JSValue(), exception);1954 evaluate(globalObject->globalExec(), jscSource(script, SourceOrigin { absolutePath(fileName) }, fileName), JSValue(), exception); 1928 1955 stopWatch.stop(); 1929 1956 … … 1977 2004 1978 2005 NakedPtr<Exception> evaluationException; 1979 JSValue result = evaluate(globalObject->globalExec(), jscSource(script, fileName), JSValue(), evaluationException);2006 JSValue result = evaluate(globalObject->globalExec(), jscSource(script, SourceOrigin { absolutePath(fileName) }, fileName), JSValue(), evaluationException); 1980 2007 if (evaluationException) 1981 2008 throwException(exec, scope, evaluationException); … … 2048 2075 2049 2076 JSValue syntaxException; 2050 bool validSyntax = checkSyntax(globalObject->globalExec(), jscSource(script, fileName), &syntaxException);2077 bool validSyntax = checkSyntax(globalObject->globalExec(), jscSource(script, SourceOrigin { absolutePath(fileName) }, fileName), &syntaxException); 2051 2078 stopWatch.stop(); 2052 2079 … … 2910 2937 if (isModule) { 2911 2938 if (!promise) 2912 promise = loadAndEvaluateModule(globalObject->globalExec(), jscSource(scriptBuffer, fileName));2939 promise = loadAndEvaluateModule(globalObject->globalExec(), jscSource(scriptBuffer, SourceOrigin { absolutePath(fileName) }, fileName)); 2913 2940 scope.clearException(); 2914 2941 … … 2927 2954 } else { 2928 2955 NakedPtr<Exception> evaluationException; 2929 JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(scriptBuffer, fileName), JSValue(), evaluationException);2956 JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(scriptBuffer, SourceOrigin { absolutePath(fileName) }, fileName), JSValue(), evaluationException); 2930 2957 ASSERT(!scope.exception()); 2931 2958 if (evaluationException) … … 3000 3027 3001 3028 NakedPtr<Exception> evaluationException; 3002 JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(line, sourceOrigin .string()), JSValue(), evaluationException);3029 JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(line, sourceOrigin, sourceOrigin.string()), JSValue(), evaluationException); 3003 3030 #endif 3004 3031 if (evaluationException)
Note:
See TracChangeset
for help on using the changeset viewer.