Changeset 189431 in webkit
- Timestamp:
- Sep 5, 2015, 12:44:35 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 156 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r189429 r189431 1 2015-09-05 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [ES6] Enable ES6 Module in JSC shell by default 4 https://bugs.webkit.org/show_bug.cgi?id=148689 5 6 Reviewed by Geoffrey Garen. 7 8 Enable ES6 Modules in JSC shell by default. Compile time flag is left for WebCore. 9 Since the entry point to evaluate the modules are completely separated from the usual 10 entry point to evaluate the script, we can safely enable ES6 modules in JSC shell. 11 12 And add bunch of tests for ES6 Modules. 13 14 * jsc.cpp: 15 (GlobalObject::finishCreation): 16 (functionLoadModule): 17 (runWithScripts): 18 (printUsageStatement): Deleted. 19 (CommandLine::parseArguments): Deleted. 20 * parser/Parser.cpp: 21 (JSC::Parser<LexerType>::parseInner): Deleted. 22 * tests/modules.yaml: Added. 23 * tests/modules/aliasing.js: Added. 24 * tests/modules/aliasing/drink-2.js: Added. 25 (export.let.Cappuccino.string_appeared_here.export.changeCappuccino): 26 * tests/modules/aliasing/drink.js: Added. 27 (export.changeCocoa): 28 * tests/modules/cyclic-may-produce-tdz.js: Added. 29 * tests/modules/cyclic-may-produce-tdz/1.js: Added. 30 * tests/modules/cyclic-may-produce-tdz/2.js: Added. 31 * tests/modules/default-error/main.js: Added. 32 * tests/modules/default-value-case-should-be-copied.js: Added. 33 * tests/modules/default-value-case-should-be-copied/module.js: Added. 34 (export.changeValue): 35 * tests/modules/defaults.js: Added. 36 * tests/modules/defaults/Cappuccino.js: Added. 37 * tests/modules/defaults/Cocoa.js: Added. 38 (export.default.Cocoa): 39 * tests/modules/defaults/Matcha.js: Added. 40 * tests/modules/destructuring-export.js: Added. 41 * tests/modules/destructuring-export/array.js: Added. 42 * tests/modules/destructuring-export/main.js: Added. 43 * tests/modules/execution-order-cyclic.js: Added. 44 * tests/modules/execution-order-cyclic/1.js: Added. 45 * tests/modules/execution-order-cyclic/10.js: Added. 46 * tests/modules/execution-order-cyclic/11.js: Added. 47 * tests/modules/execution-order-cyclic/2.js: Added. 48 * tests/modules/execution-order-cyclic/3.js: Added. 49 * tests/modules/execution-order-cyclic/4.js: Added. 50 * tests/modules/execution-order-cyclic/5.js: Added. 51 * tests/modules/execution-order-cyclic/6.js: Added. 52 * tests/modules/execution-order-cyclic/7.js: Added. 53 * tests/modules/execution-order-cyclic/8.js: Added. 54 * tests/modules/execution-order-cyclic/9.js: Added. 55 * tests/modules/execution-order-dag.js: Added. 56 * tests/modules/execution-order-dag/1.js: Added. 57 * tests/modules/execution-order-dag/10.js: Added. 58 * tests/modules/execution-order-dag/2.js: Added. 59 * tests/modules/execution-order-dag/3.js: Added. 60 * tests/modules/execution-order-dag/4.js: Added. 61 * tests/modules/execution-order-dag/5.js: Added. 62 * tests/modules/execution-order-dag/6.js: Added. 63 * tests/modules/execution-order-dag/7.js: Added. 64 * tests/modules/execution-order-dag/8.js: Added. 65 * tests/modules/execution-order-dag/9.js: Added. 66 * tests/modules/execution-order-depth.js: Added. 67 * tests/modules/execution-order-depth/1.js: Added. 68 * tests/modules/execution-order-depth/2.js: Added. 69 * tests/modules/execution-order-depth/3.js: Added. 70 * tests/modules/execution-order-self.js: Added. 71 * tests/modules/execution-order-sibling.js: Added. 72 * tests/modules/execution-order-sibling/1.js: Added. 73 * tests/modules/execution-order-sibling/2.js: Added. 74 * tests/modules/execution-order-sibling/3.js: Added. 75 * tests/modules/execution-order-tree.js: Added. 76 * tests/modules/execution-order-tree/1.js: Added. 77 * tests/modules/execution-order-tree/10.js: Added. 78 * tests/modules/execution-order-tree/11.js: Added. 79 * tests/modules/execution-order-tree/2.js: Added. 80 * tests/modules/execution-order-tree/3.js: Added. 81 * tests/modules/execution-order-tree/4.js: Added. 82 * tests/modules/execution-order-tree/5.js: Added. 83 * tests/modules/execution-order-tree/6.js: Added. 84 * tests/modules/execution-order-tree/7.js: Added. 85 * tests/modules/execution-order-tree/8.js: Added. 86 * tests/modules/execution-order-tree/9.js: Added. 87 * tests/modules/export-conflict-ok.js: Added. 88 * tests/modules/export-conflict-ok/A.js: Added. 89 * tests/modules/export-conflict-ok/B.js: Added. 90 * tests/modules/export-conflict-ok/main.js: Added. 91 * tests/modules/export-from.js: Added. 92 * tests/modules/export-from/main.js: Added. 93 * tests/modules/export-from/second.js: Added. 94 * tests/modules/export-with-declarations-list.js: Added. 95 * tests/modules/export-with-declarations-list/main.js: Added. 96 * tests/modules/exported-function-may-be-called-before-module-is-executed.js: Added. 97 * tests/modules/exported-function-may-be-called-before-module-is-executed/1.js: Added. 98 * tests/modules/exported-function-may-be-called-before-module-is-executed/2.js: Added. 99 (export.add): 100 (export.raise): 101 * tests/modules/import-error.js: Added. 102 * tests/modules/import-error/export-ambiguous-1.js: Added. 103 * tests/modules/import-error/export-ambiguous-2.js: Added. 104 * tests/modules/import-error/export-ambiguous.js: Added. 105 * tests/modules/import-error/export-default-from-star-2.js: Added. 106 (export.default.Cocoa): 107 * tests/modules/import-error/export-default-from-star.js: Added. 108 * tests/modules/import-error/export-not-found.js: Added. 109 * tests/modules/import-error/import-ambiguous.js: Added. 110 * tests/modules/import-error/import-default-from-star.js: Added. 111 * tests/modules/import-error/import-not-found.js: Added. 112 * tests/modules/imported-bindings-are-immutable.js: Added. 113 * tests/modules/imported-bindings-are-immutable/bindings.js: Added. 114 (export.functionDeclaration): 115 (export.classDeclaration): 116 * tests/modules/imported-bindings-can-be-changed-in-original-module.js: Added. 117 * tests/modules/imported-bindings-can-be-changed-in-original-module/bindings.js: Added. 118 * tests/modules/indirect-export-error.js: Added. 119 * tests/modules/indirect-export-error/indirect-export-ambiguous-2.js: Added. 120 * tests/modules/indirect-export-error/indirect-export-ambiguous-3.js: Added. 121 * tests/modules/indirect-export-error/indirect-export-ambiguous-4.js: Added. 122 * tests/modules/indirect-export-error/indirect-export-ambiguous.js: Added. 123 * tests/modules/indirect-export-error/indirect-export-default-2.js: Added. 124 * tests/modules/indirect-export-error/indirect-export-default-3.js: Added. 125 (export.default.Cocoa): 126 * tests/modules/indirect-export-error/indirect-export-default.js: Added. 127 * tests/modules/indirect-export-error/indirect-export-not-found-2.js: Added. 128 * tests/modules/indirect-export-error/indirect-export-not-found.js: Added. 129 * tests/modules/module-eval.js: Added. 130 * tests/modules/module-eval/A.js: Added. 131 * tests/modules/module-eval/B.js: Added. 132 * tests/modules/module-eval/drink.js: Added. 133 * tests/modules/module-is-strict-code.js: Added. 134 * tests/modules/namespace-ambiguous.js: Added. 135 * tests/modules/namespace-ambiguous/ambiguous-2.js: Added. 136 * tests/modules/namespace-ambiguous/ambiguous-3.js: Added. 137 * tests/modules/namespace-ambiguous/ambiguous-4.js: Added. 138 * tests/modules/namespace-ambiguous/ambiguous.js: Added. 139 * tests/modules/namespace-error.js: Added. 140 * tests/modules/namespace-error/namespace-local-error-should-hide-global-ambiguity-2.js: Added. 141 * tests/modules/namespace-error/namespace-local-error-should-hide-global-ambiguity-3.js: Added. 142 * tests/modules/namespace-error/namespace-local-error-should-hide-global-ambiguity-4.js: Added. 143 * tests/modules/namespace-error/namespace-local-error-should-hide-global-ambiguity-5.js: Added. 144 * tests/modules/namespace-error/namespace-local-error-should-hide-global-ambiguity-6.js: Added. 145 * tests/modules/namespace-error/namespace-local-error-should-hide-global-ambiguity-7.js: Added. 146 * tests/modules/namespace-error/namespace-local-error-should-hide-global-ambiguity.js: Added. 147 * tests/modules/namespace-tdz.js: Added. 148 * tests/modules/namespace-tdz/A.js: Added. 149 * tests/modules/namespace-tdz/B.js: Added. 150 (export.later): 151 * tests/modules/namespace-tdz/main.js: Added. 152 * tests/modules/namespace.js: Added. 153 * tests/modules/namespace/additional-drink.js: Added. 154 * tests/modules/namespace/drink.js: Added. 155 (export.default.changeCappuccino): 156 * tests/modules/namespace/more-additional-drink.js: Added. 157 * tests/modules/resources/assert.js: Added. 158 (export.shouldBe): 159 (export.shouldThrow): 160 * tests/modules/scopes.js: Added. 161 * tests/modules/scopes/additional-drink.js: Added. 162 * tests/modules/scopes/drink.js: Added. 163 (export.default.changeCappuccino): 164 * tests/modules/scopes/more-additional-drink.js: Added. 165 * tests/modules/this-should-be-undefined.js: Added. 166 * tests/stress/modules-syntax-error-with-names.js: 167 * tests/stress/modules-syntax-error.js: 168 * tests/stress/modules-syntax.js: 169 1 170 2015-09-05 Yusuke Suzuki <utatane.tea@gmail.com> 2 171 -
trunk/Source/JavaScriptCore/jsc.cpp
r189160 r189431 500 500 static EncodedJSValue JSC_HOST_CALL functionLoadWebAssembly(ExecState*); 501 501 #endif 502 #if ENABLE(ES6_MODULES) 502 static EncodedJSValue JSC_HOST_CALL functionLoadModule(ExecState*); 503 503 static EncodedJSValue JSC_HOST_CALL functionCheckModuleSyntax(ExecState*); 504 #endif505 504 506 505 #if ENABLE(SAMPLING_FLAGS) … … 679 678 addFunction(vm, "loadWebAssembly", functionLoadWebAssembly, 1); 680 679 #endif 681 #if ENABLE(ES6_MODULES) 680 addFunction(vm, "loadModule", functionLoadModule, 1); 682 681 addFunction(vm, "checkModuleSyntax", functionCheckModuleSyntax, 1); 683 #endif684 682 685 683 JSArray* array = constructEmptyArray(globalExec(), 0); … … 1361 1359 #endif 1362 1360 1363 #if ENABLE(ES6_MODULES) 1361 EncodedJSValue JSC_HOST_CALL functionLoadModule(ExecState* exec) 1362 { 1363 String fileName = exec->argument(0).toString(exec)->value(exec); 1364 Vector<char> script; 1365 if (!fillBufferWithContentsOfFile(fileName, script)) 1366 return JSValue::encode(exec->vm().throwException(exec, createError(exec, ASCIILiteral("Could not open file.")))); 1367 1368 JSInternalPromise* promise = evaluateModule(exec, fileName); 1369 if (exec->hadException()) 1370 return JSValue::encode(jsUndefined()); 1371 1372 JSValue error; 1373 JSFunction* errorHandler = JSNativeStdFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, String(), [&](ExecState* exec) { 1374 error = exec->argument(0); 1375 return JSValue::encode(jsUndefined()); 1376 }); 1377 1378 promise->then(exec, nullptr, errorHandler); 1379 exec->vm().drainMicrotasks(); 1380 if (error) 1381 return JSValue::encode(exec->vm().throwException(exec, error)); 1382 return JSValue::encode(jsUndefined()); 1383 } 1384 1364 1385 EncodedJSValue JSC_HOST_CALL functionCheckModuleSyntax(ExecState* exec) 1365 1386 { … … 1377 1398 return JSValue::encode(jsNumber(stopWatch.getElapsedMS())); 1378 1399 } 1379 #endif1380 1400 1381 1401 // Use SEH for Release builds only to get rid of the crash report dialog … … 1505 1525 bool success = true; 1506 1526 1507 #if ENABLE(ES6_MODULES)1508 1527 JSFunction* errorHandler = JSNativeStdFunction::create(vm, globalObject, 1, String(), [&](ExecState* exec) { 1509 1528 success = false; … … 1511 1530 return JSValue::encode(jsUndefined()); 1512 1531 }); 1513 #endif1514 1532 1515 1533 #if ENABLE(SAMPLING_FLAGS) … … 1518 1536 1519 1537 for (size_t i = 0; i < scripts.size(); i++) { 1520 #if ENABLE(ES6_MODULES)1521 1538 JSInternalPromise* promise = nullptr; 1522 #endif1523 1539 if (scripts[i].isFile) { 1524 1540 fileName = scripts[i].argument; 1525 if (module) { 1526 #if ENABLE(ES6_MODULES) 1541 if (module) 1527 1542 promise = evaluateModule(globalObject->globalExec(), fileName); 1528 #else 1529 RELEASE_ASSERT_NOT_REACHED(); 1530 #endif 1531 } else { 1543 else { 1532 1544 if (!fillBufferWithContentsOfFile(fileName, scriptBuffer)) 1533 1545 return false; // fail early so we can catch missing files … … 1542 1554 1543 1555 if (module) { 1544 #if ENABLE(ES6_MODULES)1545 1556 if (!promise) 1546 1557 promise = evaluateModule(globalObject->globalExec(), jscSource(script, fileName)); … … 1548 1559 promise->then(globalObject->globalExec(), nullptr, errorHandler); 1549 1560 globalObject->vm().drainMicrotasks(); 1550 #else1551 RELEASE_ASSERT_NOT_REACHED();1552 #endif1553 1561 } else { 1554 1562 NakedPtr<Exception> evaluationException; … … 1649 1657 fprintf(stderr, " -h|--help Prints this help message\n"); 1650 1658 fprintf(stderr, " -i Enables interactive mode (default if no files are specified)\n"); 1651 #if ENABLE(ES6_MODULES)1652 1659 fprintf(stderr, " -m Execute as a module\n"); 1653 #endif1654 1660 #if HAVE(SIGNAL_H) 1655 1661 fprintf(stderr, " -s Installs signal handlers that exit on a crash (Unix platforms only)\n"); … … 1703 1709 continue; 1704 1710 } 1705 #if ENABLE(ES6_MODULES)1706 1711 if (!strcmp(arg, "-m")) { 1707 1712 m_module = true; 1708 1713 continue; 1709 1714 } 1710 #endif1711 1715 if (!strcmp(arg, "-s")) { 1712 1716 #if HAVE(SIGNAL_H) -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r189371 r189431 270 270 if (isArrowFunctionBodyExpression) 271 271 sourceElements = parseArrowFunctionSingleExpressionBodySourceElements(context); 272 #if ENABLE(ES6_MODULES)273 272 else if (isModuleParseMode(parseMode)) 274 273 sourceElements = parseModuleSourceElements(context, parseMode); 275 #endif276 274 else 277 275 sourceElements = parseSourceElements(context, CheckForStrictMode); -
trunk/Source/JavaScriptCore/tests/stress/modules-syntax-error-with-names.js
r188417 r189431 1 //@ skip2 3 1 function shouldThrow(func, errorMessage) { 4 2 var errorThrown = false; -
trunk/Source/JavaScriptCore/tests/stress/modules-syntax-error.js
r187890 r189431 1 //@ skip2 3 1 function shouldThrow(func, errorMessage) { 4 2 var errorThrown = false; -
trunk/Source/JavaScriptCore/tests/stress/modules-syntax.js
r187890 r189431 1 //@ skip2 3 1 checkModuleSyntax(String.raw` 4 2 import "Cocoa"; -
trunk/Tools/ChangeLog
r189409 r189431 1 2015-09-05 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [ES6] Enable ES6 Module in JSC shell by default 4 https://bugs.webkit.org/show_bug.cgi?id=148689 5 6 Reviewed by Geoffrey Garen. 7 8 * Scripts/run-javascriptcore-tests: 9 (runJSCStressTests): 10 * Scripts/run-jsc-stress-tests: 11 1 12 2015-09-04 Basile Clement <basile_clement@apple.com> 2 13 -
trunk/Tools/Scripts/run-javascriptcore-tests
r189333 r189431 286 286 "Source/JavaScriptCore/tests/controlFlowProfiler.yaml", 287 287 "Source/JavaScriptCore/tests/es6.yaml", 288 "Source/JavaScriptCore/tests/modules.yaml", 288 289 ); 289 290 if (isWindows() && !isCygwin()) { -
trunk/Tools/Scripts/run-jsc-stress-tests
r189333 r189431 900 900 end 901 901 902 def runModules 903 run("default-modules", "-m") 904 run("always-trigger-copy-phase-modules", "-m", "--minHeapUtilization=2.0", "--minCopiedBlockUtilization=2.0") 905 906 if !$jitTests 907 return 908 end 909 910 run("no-llint-modules", "-m", "--useLLInt=false") 911 run("no-cjit-validate-phases-modules", "-m", "--validateBytecode=true", "--validateGraphAtEachPhase=true", *NO_CJIT_OPTIONS) 912 run("dfg-eager-modules", "-m", *EAGER_OPTIONS) 913 run("dfg-eager-no-cjit-validate-modules", "-m", "--validateGraph=true", *(NO_CJIT_OPTIONS + EAGER_OPTIONS)) 914 if $enableFTL 915 run("default-ftl-modules", "-m", *FTL_OPTIONS) 916 run("ftl-no-cjit-validate-modules", "-m", "--validateGraph=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS)) 917 run("ftl-no-cjit-no-inline-validate-modules", "-m", "--validateGraph=true", "--maximumInliningDepth=1", *(FTL_OPTIONS + NO_CJIT_OPTIONS)) 918 run("ftl-eager-modules", "-m", *(FTL_OPTIONS + EAGER_OPTIONS)) 919 run("ftl-eager-no-cjit-modules", "-m", "--validateGraph=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS + EAGER_OPTIONS)) 920 run("ftl-no-cjit-small-pool-modules", "-m", "--jitMemoryReservationSize=50000", *(FTL_OPTIONS + NO_CJIT_OPTIONS)) 921 end 922 end 923 902 924 def runLayoutTest(kind, *options) 903 925 raise unless $benchmark.to_s =~ /\.js$/
Note:
See TracChangeset
for help on using the changeset viewer.