Diff
Modified: trunk/JSTests/ChangeLog (284158 => 284159)
--- trunk/JSTests/ChangeLog 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/ChangeLog 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,3 +1,16 @@
+2021-10-14 Commit Queue <[email protected]>
+
+ Unreviewed, reverting r284151.
+ https://bugs.webkit.org/show_bug.cgi?id=231740
+
+ WTR
+
+ Reverted changeset:
+
+ "Test coverage for JSC shadow realms implementation"
+ https://bugs.webkit.org/show_bug.cgi?id=230602
+ https://commits.webkit.org/r284151
+
2021-10-14 Phillip Mates <[email protected]>
Test coverage for JSC shadow realms implementation
Modified: trunk/JSTests/modules/import-meta-syntax.js (284158 => 284159)
--- trunk/JSTests/modules/import-meta-syntax.js 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/modules/import-meta-syntax.js 2021-10-14 14:24:50 UTC (rev 284159)
@@ -10,7 +10,7 @@
shouldThrow(() => {
checkModuleSyntax(`(import.cocoa)`);
-}, `SyntaxError: Unexpected identifier 'cocoa'. "import." can only be followed with meta.:1`);
+}, `SyntaxError: Unexpected identifier 'cocoa'. "import." can only followed with meta.:1`);
shouldThrow(() => {
checkModuleSyntax(`(import["Cocoa"])`);
@@ -18,7 +18,7 @@
shouldThrow(() => {
checkModuleSyntax(`import.cocoa`);
-}, `SyntaxError: Unexpected identifier 'cocoa'. "import." can only be followed with meta.:1`);
+}, `SyntaxError: Unexpected identifier 'cocoa'. "import." can only followed with meta.:1`);
shouldThrow(() => {
checkModuleSyntax(`import["Cocoa"]`);
Deleted: trunk/JSTests/stress/eval-indirect.js (284158 => 284159)
--- trunk/JSTests/stress/eval-indirect.js 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/stress/eval-indirect.js 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,34 +0,0 @@
-
-function shouldBe(actual, expected) {
- if (actual !== expected)
- throw new Error(`expected ${expected} but got ${actual}`);
-}
-
-function shouldThrow(func, errorType, assertionFn) {
- let error;
- try {
- func();
- } catch (e) {
- error = e;
- }
-
- if (!(error instanceof errorType))
- throw new Error(`Expected ${errorType.name} but got ${error.name}`);
-
- assertionFn(error);
-}
-
-shouldBe((0, eval)("() => { return 1; }")(), 1);
-
-shouldThrow(
- () => { (0, eval)("..") },
- SyntaxError,
- (err) => {
- shouldBe(String(err), `SyntaxError: Unexpected token '.'`);
- });
-
-// NOTE: more iterations (like 20000) will trigger a GC/OOM issue on 32-bit devices.
-for (var i = 0; i < 1000; ++i) {
- let f = (0, eval)("() => { return 1; }");
- shouldBe(f(), 1);
-}
Modified: trunk/JSTests/stress/import-syntax.js (284158 => 284159)
--- trunk/JSTests/stress/import-syntax.js 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/stress/import-syntax.js 2021-10-14 14:24:50 UTC (rev 284159)
@@ -29,7 +29,7 @@
testSyntaxError(`import)`, `SyntaxError: Unexpected token ')'. import call expects exactly one argument.`);
testSyntaxError(`new import(`, `SyntaxError: Cannot use new with import.`);
-testSyntaxError(`import.hello()`, `SyntaxError: Unexpected identifier 'hello'. "import." can only be followed with meta.`);
+testSyntaxError(`import.hello()`, `SyntaxError: Unexpected identifier 'hello'. "import." can only followed with meta.`);
testSyntaxError(`import[`, `SyntaxError: Unexpected token '['. import call expects exactly one argument.`);
testSyntaxError(`import<`, `SyntaxError: Unexpected token '<'. import call expects exactly one argument.`);
Deleted: trunk/JSTests/stress/resources/shadow-realm-example-module.js (284158 => 284159)
--- trunk/JSTests/stress/resources/shadow-realm-example-module.js 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/stress/resources/shadow-realm-example-module.js 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,25 +0,0 @@
-var callCount = 0;
-
-function putInGlobal(key, val) {
- callCount++;
- globalThis.key = val;
-}
-
-function getFromGlobal(key) {
- callCount++;
- return globalThis.key;
-}
-
-var anObject = new Object();
-
-function getAnObject() {
- callCount++;
- return anObject;
-}
-
-function getCallCount() {
- return callCount;
-}
-
-var answer = 6;
-export { anObject, answer, getCallCount, getFromGlobal, getAnObject, putInGlobal };
Deleted: trunk/JSTests/stress/shadow-realm-evaluate.js (284158 => 284159)
--- trunk/JSTests/stress/shadow-realm-evaluate.js 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/stress/shadow-realm-evaluate.js 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,153 +0,0 @@
-//@ requireOptions("--useShadowRealm=1")
-
-function shouldBe(actual, expected) {
- if (actual !== expected)
- throw new Error(`expected ${expected} but got ${actual}`);
-}
-
-function shouldThrow(func, errorType, assertionFn) {
- let error;
- try {
- func();
- } catch (e) {
- error = e;
- }
-
- if (!(error instanceof errorType))
- throw new Error(`Expected ${errorType.name} but got ${error.name}`);
-
- assertionFn(error);
-}
-
-// basic evaluation and state setting
-{
- let realm = new ShadowRealm();
- let otherRealm = new ShadowRealm();
-
- shouldBe(realm.evaluate("1"), 1);
- var x = 2;
- realm.evaluate("var x = 1");
- shouldBe(realm.evaluate("x"), 1);
- shouldBe(x, 2);
-
- // scope isn't shared across realms
- shouldBe(otherRealm.evaluate("globalThis.x"), undefined);
-}
-
-// accessing `globalThis` within and outside of a shadow realm
-{
- let realm = new ShadowRealm();
- globalThis.hi = 6;
-
- shouldBe(realm.evaluate("globalThis.hi"), undefined);
-
- realm.evaluate("globalThis.hi = 'fala amigo'");
-
- shouldBe(realm.evaluate("globalThis.hi"), "fala amigo");
- shouldBe(globalThis.hi, 6);
-}
-
-// ensure that errors thrown isn't associated with the shadow realm's global object
-{
- let realm = new ShadowRealm();
- shouldThrow(
- () => { realm.evaluate(".."); },
- SyntaxError,
- (err) => {
- shouldBe($.globalObjectFor(err), globalThis);
- shouldBe(String(err), `SyntaxError: Unexpected token '.'`);
- });
-}
-
-// ensure that errors thrown don't carry information from the shadow realm
-{
- let realm = new ShadowRealm();
- shouldThrow(
- () => { realm.evaluate("throw new Error('secret')"); },
- TypeError,
- (err) => {
- shouldBe($.globalObjectFor(err), globalThis);
- shouldBe(String(err), "TypeError: Error encountered during evaluation");
- });
-}
-
-// wrapped functions protect the shadow realm
-{
- let realm = new ShadowRealm();
- let wrappedInvokeAndAdd = realm.evaluate("function invokeAndAdd(xFn, yFn) { return xFn() + yFn(); }; invokeAndAdd");
- shouldBe(wrappedInvokeAndAdd(() => { return 1 }, () => { return 2 }), 3);
- shouldBe($.globalObjectFor(wrappedInvokeAndAdd), globalThis);
-
- // name and length properties from wrapped function are absent
- shouldBe(Object.getOwnPropertyDescriptor(wrappedInvokeAndAdd, "length"), undefined);
- shouldBe(Object.getOwnPropertyDescriptor(wrappedInvokeAndAdd, "name"), undefined);
-
- // can't pass objects into a shadow realm-wrapped function
- let numberObj = { valueOf() { return -1 } };
- shouldThrow(
- () => { wrappedInvokeAndAdd(numberObj, 1); },
- TypeError,
- (err) => {
- shouldBe($.globalObjectFor(err), globalThis);
- shouldBe(String(err), "TypeError: value passing between realms must be callable or primitive");
- });
-}
-
-{
- let realm = new ShadowRealm();
- // can't call `evaluate` on a non shadow realm
- let notRealm = {};
- shouldThrow(
- () => { realm.evaluate.call(notRealm, '1'); },
- TypeError,
- (err) => { shouldBe($.globalObjectFor(err), globalThis); }
- );
-}
-
-// trigger JIT
-{
- function doEval(realm, s)
- {
- return realm.evaluate(s);
- }
-
- noInline(doEval);
-
- let realm = new ShadowRealm();
- realm.evaluate("globalThis.secret = 1;");
- for (var i = 0; i < 10000; ++i)
- shouldBe(doEval(realm, '42'), 42);
-
- for (var i = 0; i < 1000; ++i) {
- let f = doEval(realm, '(x) => { return x() + globalThis.secret; }');
- shouldBe($.globalObjectFor(f), globalThis);
- shouldBe(f(() => { return 41; }), 42);
- }
- // (potential) inlining of wrapped function uses correct global object
- let f = doEval(realm, '(x) => { return x() + globalThis.secret; }');
- for (var i = 0; i < 10000; ++i) {
- shouldBe($.globalObjectFor(f), globalThis);
- shouldBe(f(() => { return 41; }), 42);
- }
- // (potential) inlining inside a realm uses correct global object
- let loopInside = doEval(realm, '(x) => { let acc = 0; for (var i = 0; i < 10000; ++i) { acc += x(); }; return acc; }');
- globalThis.secret = -1;
- shouldBe(loopInside(() => { return globalThis.secret; }), -10000);
-}
-
-// evaluate specs
-{
- shouldBe(typeof ShadowRealm.prototype.evaluate, "function");
-
- let evaluateName = Object.getOwnPropertyDescriptor(ShadowRealm.prototype.evaluate, "name");
- shouldBe(evaluateName.value, "evaluate");
- shouldBe(evaluateName.enumerable, false);
- shouldBe(evaluateName.writable, false);
- shouldBe(evaluateName.configurable, true);
-
- let evaluateLength = Object.getOwnPropertyDescriptor(ShadowRealm.prototype.evaluate, "length");
- shouldBe(evaluateLength.value, 1);
- shouldBe(evaluateLength.enumerable, false);
- shouldBe(evaluateLength.writable, false);
- shouldBe(evaluateLength.configurable, true);
-}
Deleted: trunk/JSTests/stress/shadow-realm-import-value.js (284158 => 284159)
--- trunk/JSTests/stress/shadow-realm-import-value.js 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/stress/shadow-realm-import-value.js 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,148 +0,0 @@
-//@ requireOptions("--useShadowRealm=1")
-
-var abort = $vm.abort;
-
-function shouldBe(actual, expected) {
- if (actual !== expected)
- throw new Error(`expected ${expected} but got ${actual}`);
-}
-
-function shouldThrow(func, errorType) {
- let error;
- try {
- func();
- } catch (e) {
- error = e;
- }
-
- if (!(error instanceof errorType))
- throw new Error(`Expected ${errorType.name}! got ${error.name}`);
-}
-
-async function shouldThrowAsync(func, errorType) {
- let error;
- try {
- await func();
- } catch (e) {
- error = e;
- }
-
- if (!(error instanceof errorType))
- throw new Error(`Expected ${errorType.name}! got ${error.name} with message ${error.message}`);
-}
-
-(async function () {
- const importPath = "./resources/shadow-realm-example-module.js";
- const { answer, getCallCount, putInGlobal, getFromGlobal, getAnObject } = await import(importPath);
- const outerAnswer = answer;
- const outerGetCallCount = getCallCount;
- const outerPutInGlobal = putInGlobal;
- const outerGetFromGlobal = getFromGlobal;
- const outerGetAnObject = getAnObject;
-
- {
- let realm = new ShadowRealm();
-
- // update local module state + check it
- shouldBe(outerGetCallCount(), 0);
- outerGetAnObject();
- shouldBe(outerGetCallCount(), 1);
- // update realm module state + check it
- let innerGetCallCount = await realm.importValue(importPath, "getCallCount");
- let innerPutInGlobal = await realm.importValue(importPath, "putInGlobal");
- shouldBe(innerGetCallCount(), 0);
- innerPutInGlobal("something", "random");
- shouldBe(innerGetCallCount(), 1);
- // re-importing the module into the realm doesn't reload the module
- innerGetCallCount = await realm.importValue(importPath, "getCallCount");
- shouldBe(innerGetCallCount(), 1);
- // the (outer) local module state stays intact
- shouldBe(outerGetCallCount(), 1);
-
- // one can imported primitive/callable variables just fine
- // shouldBe(innerAnswer, outerAnswer);
- let innerAnswer = await realm.importValue(importPath, "answer");
- shouldBe(innerAnswer, outerAnswer);
-
- // imported variables are checked for primtive/callable-ness
- await shouldThrowAsync(async () => { let x = await realm.importValue(importPath, "anObject"); }, TypeError);
-
- // importing non-existent ref fails
- await shouldThrowAsync(async () => { let x = await realm.importValue(importPath, "nothing"); }, TypeError);
-
- // importing from non-existent file fails
- await shouldThrowAsync(async () => { let x = await realm.importValue("random", "nothing"); }, TypeError);
-
- // we can import functions through an inner realm for use in the outer
- let innerGetFromGlobal = await realm.importValue(importPath, "getFromGlobal");
- innerPutInGlobal("salutation", "sarava");
- shouldBe(innerGetFromGlobal("salutation"), "sarava");
-
- // inner global state is unchanged by outer global state change
- outerPutInGlobal("salutation", "hello world!");
- shouldBe(outerGetFromGlobal("salutation"), "hello world!");
- shouldBe(innerGetFromGlobal("salutation"), "sarava");
-
- // wrapped functions check arguments for primitive/callable-ness
- shouldThrow(() => { innerPutInGlobal("treasure", new Object()); }, TypeError);
-
- // imported functions are wrapped with correct return value checks
- let getAnObjectFn = await realm.importValue(importPath, "getAnObject");
- shouldThrow(() => { getAnObjectFn(); }, TypeError);
-
- // thread a function in and out of a realm to wrap it up
- innerPutInGlobal("outer-realm-put", outerPutInGlobal);
- wrappedOuterPutInGlobal = innerGetFromGlobal("outer-realm-put");
-
- // it still manipuates the correct global object state
- wrappedOuterPutInGlobal("treasure", "shiny tin scrap");
- shouldBe(outerGetFromGlobal("treasure"), "shiny tin scrap");
-
- // wrapped functions check arguments for primitive/callable-ness
- shouldThrow(() => { wrappedOuterPutInGlobal("treasure", new Object()); }, TypeError);
- shouldThrow(() => { wrappedOuterPutInGlobal(new Object(), "shiny tin scrap"); }, TypeError);
-
- // must be called on a ShadowRealm
- let notRealm = {};
- shouldThrow(
- () => { realm.importValue.call(notRealm, importPath, "answer"); },
- TypeError,
- (err) => { shouldBe($.globalObjectFor(err), globalThis); }
- );
- }
-
- // trigger JIT
- {
- function doImport(realm, s)
- {
- return realm.importValue(importPath, s);
- }
-
- noInline(doImport);
-
- let realm = new ShadowRealm();
- for (var i = 0; i < 10000; ++i) {
- let result = await doImport(realm, "getCallCount");
- shouldBe(result(), 0);
- }
- }
-}()).catch((error) => {
- print(String(error));
- abort();
-});
-
-{
- shouldBe(typeof ShadowRealm.prototype.importValue, "function");
-
- let importValueName = Object.getOwnPropertyDescriptor(ShadowRealm.prototype.importValue, "name");
- shouldBe(importValueName.value, "importValue");
- shouldBe(importValueName.enumerable, false);
- shouldBe(importValueName.writable, false);
- shouldBe(importValueName.configurable, true);
-
- let importValueLength = Object.getOwnPropertyDescriptor(ShadowRealm.prototype.importValue, "length");
- shouldBe(importValueLength.value, 2);
- shouldBe(importValueLength.enumerable, false);
- shouldBe(importValueLength.writable, false);
- shouldBe(importValueLength.configurable, true);
-}
Deleted: trunk/JSTests/stress/shadow-realm.js (284158 => 284159)
--- trunk/JSTests/stress/shadow-realm.js 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/stress/shadow-realm.js 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,36 +0,0 @@
-//@ requireOptions("--useShadowRealm=1")
-
-function shouldBe(actual, expected) {
- if (actual !== expected)
- throw new Error(`expected ${expected} but got ${actual}`);
-}
-
-// shadow realm specs
-{
- let shadowRealmProp = Object.getOwnPropertyDescriptor(this, "ShadowRealm");
- shouldBe(shadowRealmProp.enumerable, false);
- shouldBe(shadowRealmProp.writable, true);
- shouldBe(shadowRealmProp.configurable, true);
-
- let shadowRealmEvaluate = Object.getOwnPropertyDescriptor(ShadowRealm.prototype, "evaluate");
- shouldBe(shadowRealmEvaluate.enumerable, false);
- shouldBe(shadowRealmEvaluate.writable, true);
- shouldBe(shadowRealmEvaluate.configurable, true);
-
- let shadowRealmImportValue = Object.getOwnPropertyDescriptor(ShadowRealm.prototype, "importValue");
- shouldBe(shadowRealmImportValue.enumerable, false);
- shouldBe(shadowRealmImportValue.writable, true);
- shouldBe(shadowRealmImportValue.configurable, true);
-
- let shadowRealmName = Object.getOwnPropertyDescriptor(ShadowRealm, "name");
- shouldBe(shadowRealmName.value, "ShadowRealm");
- shouldBe(shadowRealmName.enumerable, false);
- shouldBe(shadowRealmName.writable, false);
- shouldBe(shadowRealmName.configurable, true);
-
- let shadowRealmLength = Object.getOwnPropertyDescriptor(ShadowRealm, "length");
- shouldBe(shadowRealmLength.value, 0);
- shouldBe(shadowRealmLength.enumerable, false);
- shouldBe(shadowRealmLength.writable, false);
- shouldBe(shadowRealmLength.configurable, true);
-}
Modified: trunk/JSTests/test262/config.yaml (284158 => 284159)
--- trunk/JSTests/test262/config.yaml 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/JSTests/test262/config.yaml 2021-10-14 14:24:50 UTC (rev 284159)
@@ -9,7 +9,6 @@
Temporal: useTemporal
array-find-from-last: useArrayFindLastMethod
Object.hasOwn: useHasOwn
- ShadowRealm: useShadowRealm
skip:
features:
- Atomics.waitAsync
@@ -21,6 +20,7 @@
- json-modules
- class-static-block
- callable-boundary-realms
+ - ShadowRealm
paths:
- test/built-ins/Temporal/Calendar
- test/built-ins/Temporal/Instant
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (284158 => 284159)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2021-10-14 14:24:50 UTC (rev 284159)
@@ -103,8 +103,6 @@
runtime/RegExpPrototype.cpp
runtime/RegExpStringIteratorPrototype.cpp
runtime/SetPrototype.cpp
- runtime/ShadowRealmObject.cpp
- runtime/ShadowRealmPrototype.cpp
runtime/StringConstructor.cpp
runtime/StringPrototype.cpp
runtime/SymbolConstructor.cpp
@@ -375,7 +373,6 @@
${_javascript_CORE_DIR}/builtins/RegExpStringIteratorPrototype.js
${_javascript_CORE_DIR}/builtins/SetIteratorPrototype.js
${_javascript_CORE_DIR}/builtins/SetPrototype.js
- ${_javascript_CORE_DIR}/builtins/ShadowRealmPrototype.js
${_javascript_CORE_DIR}/builtins/StringConstructor.js
${_javascript_CORE_DIR}/builtins/StringIteratorPrototype.js
${_javascript_CORE_DIR}/builtins/StringPrototype.js
@@ -1160,7 +1157,6 @@
runtime/ScriptExecutable.h
runtime/ScriptFetchParameters.h
runtime/ScriptFetcher.h
- runtime/ShadowRealmObject.h
runtime/SlowPathFunction.h
runtime/SlowPathReturnType.h
runtime/SmallStrings.h
Modified: trunk/Source/_javascript_Core/ChangeLog (284158 => 284159)
--- trunk/Source/_javascript_Core/ChangeLog 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,3 +1,16 @@
+2021-10-14 Commit Queue <[email protected]>
+
+ Unreviewed, reverting r284151.
+ https://bugs.webkit.org/show_bug.cgi?id=231740
+
+ WTR
+
+ Reverted changeset:
+
+ "Test coverage for JSC shadow realms implementation"
+ https://bugs.webkit.org/show_bug.cgi?id=230602
+ https://commits.webkit.org/r284151
+
2021-10-14 Phillip Mates <[email protected]>
shadow realms implementation
Modified: trunk/Source/_javascript_Core/DerivedSources-input.xcfilelist (284158 => 284159)
--- trunk/Source/_javascript_Core/DerivedSources-input.xcfilelist 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/DerivedSources-input.xcfilelist 2021-10-14 14:24:50 UTC (rev 284159)
@@ -50,7 +50,6 @@
$(PROJECT_DIR)/builtins/RegExpStringIteratorPrototype.js
$(PROJECT_DIR)/builtins/SetIteratorPrototype.js
$(PROJECT_DIR)/builtins/SetPrototype.js
-$(PROJECT_DIR)/builtins/ShadowRealmPrototype.js
$(PROJECT_DIR)/builtins/StringConstructor.js
$(PROJECT_DIR)/builtins/StringIteratorPrototype.js
$(PROJECT_DIR)/builtins/StringPrototype.js
Modified: trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist (284158 => 284159)
--- trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist 2021-10-14 14:24:50 UTC (rev 284159)
@@ -62,8 +62,6 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/RegExpConstructor.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/RegExpJitTables.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/SetPrototype.lut.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/ShadowRealmObject.lut.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/ShadowRealmPrototype.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/StringConstructor.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/StringPrototype.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/SymbolConstructor.lut.h
Modified: trunk/Source/_javascript_Core/DerivedSources.make (284158 => 284159)
--- trunk/Source/_javascript_Core/DerivedSources.make 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/DerivedSources.make 2021-10-14 14:24:50 UTC (rev 284159)
@@ -122,7 +122,6 @@
${_javascript_Core}/builtins/RegExpStringIteratorPrototype.js \
$(_javascript_Core)/builtins/SetIteratorPrototype.js \
$(_javascript_Core)/builtins/SetPrototype.js \
- $(_javascript_Core)/builtins/ShadowRealmPrototype.js \
$(_javascript_Core)/builtins/StringConstructor.js \
$(_javascript_Core)/builtins/StringIteratorPrototype.js \
$(_javascript_Core)/builtins/StringPrototype.js \
@@ -188,7 +187,6 @@
ReflectObject.lut.h \
RegExpConstructor.lut.h \
SetPrototype.lut.h \
- ShadowRealmPrototype.lut.h \
StringConstructor.lut.h \
StringPrototype.lut.h \
SymbolConstructor.lut.h \
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (284158 => 284159)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1263,9 +1263,6 @@
860161E30F3A83C100F84710 /* AbstractMacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161DF0F3A83C100F84710 /* AbstractMacroAssembler.h */; settings = {ATTRIBUTES = (Private, ); }; };
860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */; settings = {ATTRIBUTES = (Private, ); }; };
860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 8602960226FB552D0078EB62 /* ShadowRealmConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 860295FC26FB552C0078EB62 /* ShadowRealmConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 8602960426FB552D0078EB62 /* ShadowRealmObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 860295FE26FB552D0078EB62 /* ShadowRealmObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 8602960526FB552D0078EB62 /* ShadowRealmPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 860295FF26FB552D0078EB62 /* ShadowRealmPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
8606DDEA18DA44AB00A383D0 /* IdentifierInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 8606DDE918DA44AB00A383D0 /* IdentifierInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
860BD801148EA6F200112B2F /* Intrinsic.h in Headers */ = {isa = PBXBuildFile; fileRef = 86BF642A148DB2B5004DE36A /* Intrinsic.h */; settings = {ATTRIBUTES = (Private, ); }; };
8612E4CD152389EC00C836BE /* MatchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 8612E4CB1522918400C836BE /* MatchResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4245,12 +4242,6 @@
860161DF0F3A83C100F84710 /* AbstractMacroAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractMacroAssembler.h; sourceTree = "<group>"; };
860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86_64.h; sourceTree = "<group>"; };
860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86Common.h; sourceTree = "<group>"; };
- 860295FA26FB552C0078EB62 /* ShadowRealmPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowRealmPrototype.cpp; sourceTree = "<group>"; };
- 860295FB26FB552C0078EB62 /* ShadowRealmObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowRealmObject.cpp; sourceTree = "<group>"; };
- 860295FC26FB552C0078EB62 /* ShadowRealmConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowRealmConstructor.h; sourceTree = "<group>"; };
- 860295FD26FB552D0078EB62 /* ShadowRealmConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowRealmConstructor.cpp; sourceTree = "<group>"; };
- 860295FE26FB552D0078EB62 /* ShadowRealmObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowRealmObject.h; sourceTree = "<group>"; };
- 860295FF26FB552D0078EB62 /* ShadowRealmPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowRealmPrototype.h; sourceTree = "<group>"; };
8604F4F2143A6C4400B295F5 /* ChangeLog */ = {isa = PBXFileReference; lastKnownFileType = text; lineEnding = 0; path = ChangeLog; sourceTree = "<group>"; };
8606DDE918DA44AB00A383D0 /* IdentifierInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdentifierInlines.h; sourceTree = "<group>"; };
8612E4CB1522918400C836BE /* MatchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatchResult.h; sourceTree = "<group>"; };
@@ -8002,12 +7993,6 @@
A790DD68182F499700588807 /* SetIteratorPrototype.h */,
A7299D9F17D12848005F5FF9 /* SetPrototype.cpp */,
A7299DA017D12848005F5FF9 /* SetPrototype.h */,
- 860295FD26FB552D0078EB62 /* ShadowRealmConstructor.cpp */,
- 860295FC26FB552C0078EB62 /* ShadowRealmConstructor.h */,
- 860295FB26FB552C0078EB62 /* ShadowRealmObject.cpp */,
- 860295FE26FB552D0078EB62 /* ShadowRealmObject.h */,
- 860295FA26FB552C0078EB62 /* ShadowRealmPrototype.cpp */,
- 860295FF26FB552D0078EB62 /* ShadowRealmPrototype.h */,
0F2B66D617B6B5AB00A7AE3F /* SimpleTypedArrayController.cpp */,
0F2B66D717B6B5AB00A7AE3F /* SimpleTypedArrayController.h */,
FE8C0311264A6910001A44AD /* SlowPathFunction.h */,
@@ -10730,9 +10715,6 @@
0FEE98411A8865B700754E93 /* SetupVarargsFrame.h in Headers */,
DC17E8181C9C91D9008A6AB3 /* ShadowChicken.h in Headers */,
DC17E8191C9C91DB008A6AB3 /* ShadowChickenInlines.h in Headers */,
- 8602960226FB552D0078EB62 /* ShadowRealmConstructor.h in Headers */,
- 8602960426FB552D0078EB62 /* ShadowRealmObject.h in Headers */,
- 8602960526FB552D0078EB62 /* ShadowRealmPrototype.h in Headers */,
FE3022D31E3D73A500BAC493 /* SigillCrashAnalyzer.h in Headers */,
0F4D8C781FCA3CFA001D32AC /* SimpleMarkingConstraint.h in Headers */,
0F2B670517B6B5AB00A7AE3F /* SimpleTypedArrayController.h in Headers */,
Modified: trunk/Source/_javascript_Core/Sources.txt (284158 => 284159)
--- trunk/Source/_javascript_Core/Sources.txt 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/Sources.txt 2021-10-14 14:24:50 UTC (rev 284159)
@@ -970,9 +970,6 @@
runtime/ProxyObject.cpp
runtime/ProxyRevoke.cpp
runtime/RandomizingFuzzerAgent.cpp
-runtime/ShadowRealmObject.cpp
-runtime/ShadowRealmConstructor.cpp
-runtime/ShadowRealmPrototype.cpp
runtime/ReflectObject.cpp
runtime/RegExp.cpp
runtime/RegExpCache.cpp
Modified: trunk/Source/_javascript_Core/builtins/BuiltinNames.h (284158 => 284159)
--- trunk/Source/_javascript_Core/builtins/BuiltinNames.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/builtins/BuiltinNames.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -62,7 +62,6 @@
macro(Number) \
macro(Array) \
macro(ArrayBuffer) \
- macro(ShadowRealm) \
macro(RegExp) \
macro(min) \
macro(trunc) \
@@ -116,8 +115,6 @@
macro(asyncGeneratorQueueItemNext) \
macro(dateTimeFormat) \
macro(this) \
- macro(importInRealm) \
- macro(evalInRealm) \
macro(thisTimeValue) \
macro(newTargetLocal) \
macro(derivedConstructor) \
Deleted: trunk/Source/_javascript_Core/builtins/ShadowRealmPrototype.js (284158 => 284159)
--- trunk/Source/_javascript_Core/builtins/ShadowRealmPrototype.js 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/builtins/ShadowRealmPrototype.js 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2021 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-@globalPrivate
-function wrap(target)
-{
- "use strict";
-
- if (@isCallable(target)) {
- var wrapped = function(/* args... */) {
- var length = arguments.length;
- var wrappedArgs = @newArrayWithSize(length);
- for (var index = 0; index < length; ++index)
- @putByValDirect(wrappedArgs, index, @wrap(arguments[index]));
-
- var result = target.@apply(@undefined, wrappedArgs);
- return @wrap(result);
- };
- delete wrapped['name'];
- delete wrapped['length'];
- return wrapped;
- } else if (@isObject(target)) {
- @throwTypeError("value passing between realms must be callable or primitive");
- }
- return target;
-}
-
-function evaluate(sourceText)
-{
- "use strict";
-
- if (!@isShadowRealm(this))
- @throwTypeError("`%ShadowRealm%.evaluate requires that |this| be a ShadowRealm instance");
-
- if (typeof sourceText !== 'string')
- @throwTypeError("`%ShadowRealm%.evaluate requires that the |sourceText| argument be a string");
-
- var result = @evalInRealm(this, sourceText)
- return @wrap(result);
-}
-
-function importValue(specifier, exportName)
-{
- "use strict";
-
- if (!@isShadowRealm(this))
- @throwTypeError("`%ShadowRealm%.importValue requires that |this| be a ShadowRealm instance");
-
- var exportNameString = @toString(exportName);
- var specifierString = @toString(specifier);
-
- var lookupBinding = (module) => {
- var lookup = module[exportNameString]
- if (lookup === @undefined)
- @throwTypeError("%ShadowRealm%.importValue requires |exportName| to exist in the |specifier|");
-
- return @wrap(lookup);
- };
-
- var crossRealmThrow = (error) => {
- // re-throw because import issues raise errors using the realm's global object
- @throwTypeError(@toString(error));
- };
-
- return @importInRealm(this, specifierString).@then(lookupBinding, crossRealmThrow);
-}
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeIntrinsicRegistry.h (284158 => 284159)
--- trunk/Source/_javascript_Core/bytecode/BytecodeIntrinsicRegistry.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeIntrinsicRegistry.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -66,7 +66,6 @@
macro(isRegExpObject) \
macro(isMap) \
macro(isSet) \
- macro(isShadowRealm) \
macro(isStringIterator) \
macro(isArrayIterator) \
macro(isMapIterator) \
Modified: trunk/Source/_javascript_Core/bytecode/LinkTimeConstant.h (284158 => 284159)
--- trunk/Source/_javascript_Core/bytecode/LinkTimeConstant.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/bytecode/LinkTimeConstant.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -78,8 +78,6 @@
v(hostPromiseRejectionTracker, nullptr) \
v(Set, nullptr) \
v(thisTimeValue, nullptr) \
- v(importInRealm, nullptr) \
- v(evalInRealm, nullptr) \
v(isConstructor, nullptr) \
v(sameValue, nullptr) \
v(regExpProtoFlagsGetter, nullptr) \
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (284158 => 284159)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -885,7 +885,6 @@
RegisterID* emitIsRegExpObject(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, RegExpObjectType); }
RegisterID* emitIsMap(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSMapType); }
RegisterID* emitIsSet(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSSetType); }
- RegisterID* emitIsShadowRealm(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, ShadowRealmType); }
RegisterID* emitIsStringIterator(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSStringIteratorType); }
RegisterID* emitIsArrayIterator(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSArrayIteratorType); }
RegisterID* emitIsMapIterator(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSMapIteratorType); }
Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1894,7 +1894,6 @@
CREATE_INTRINSIC_FOR_BRAND_CHECK(isRegExpObject, IsRegExpObject)
CREATE_INTRINSIC_FOR_BRAND_CHECK(isMap, IsMap)
CREATE_INTRINSIC_FOR_BRAND_CHECK(isSet, IsSet)
-CREATE_INTRINSIC_FOR_BRAND_CHECK(isShadowRealm, IsShadowRealm)
CREATE_INTRINSIC_FOR_BRAND_CHECK(isStringIterator, IsStringIterator)
CREATE_INTRINSIC_FOR_BRAND_CHECK(isArrayIterator, IsArrayIterator)
CREATE_INTRINSIC_FOR_BRAND_CHECK(isMapIterator, IsMapIterator)
Modified: trunk/Source/_javascript_Core/jsc.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/jsc.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/jsc.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -364,7 +364,6 @@
static JSC_DECLARE_HOST_FUNCTION(functionDollarEvalScript);
static JSC_DECLARE_HOST_FUNCTION(functionDollarGC);
static JSC_DECLARE_HOST_FUNCTION(functionDollarClearKeptObjects);
-static JSC_DECLARE_HOST_FUNCTION(functionDollarGlobalObjectFor);
static JSC_DECLARE_HOST_FUNCTION(functionDollarAgentStart);
static JSC_DECLARE_HOST_FUNCTION(functionDollarAgentReceiveBroadcast);
static JSC_DECLARE_HOST_FUNCTION(functionDollarAgentReport);
@@ -647,7 +646,6 @@
addFunction(vm, dollar, "evalScript", functionDollarEvalScript, 1, static_cast<unsigned>(PropertyAttribute::None));
addFunction(vm, dollar, "gc", functionDollarGC, 0, static_cast<unsigned>(PropertyAttribute::None));
addFunction(vm, dollar, "clearKeptObjects", functionDollarClearKeptObjects, 0, static_cast<unsigned>(PropertyAttribute::None));
- addFunction(vm, dollar, "globalObjectFor", functionDollarGlobalObjectFor, 1, static_cast<unsigned>(PropertyAttribute::None));
dollar->putDirect(vm, Identifier::fromString(vm, "global"), globalThis());
dollar->putDirectCustomAccessor(vm, Identifier::fromString(vm, "IsHTMLDDA"),
@@ -2068,20 +2066,6 @@
return JSValue::encode(jsUndefined());
}
-JSC_DEFINE_HOST_FUNCTION(functionDollarGlobalObjectFor, (JSGlobalObject* globalObject, CallFrame* callFrame))
-{
- VM& vm = globalObject->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (callFrame->argumentCount() < 1)
- return JSValue::encode(throwException(globalObject, scope, createError(globalObject, "Not enough arguments"_s)));
- JSValue arg = callFrame->argument(0);
- if (arg.isCell())
- return JSValue::encode(arg.asCell()->structure(vm)->globalObject()->globalThis());
-
- return JSValue::encode(jsUndefined());
-}
-
JSC_DEFINE_HOST_FUNCTION(functionDollarAgentStart, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
VM& vm = globalObject->vm();
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -5096,7 +5096,7 @@
newCount--;
next();
} else {
- failIfTrue(match(IDENT), "\"new.\" can only be followed with target");
+ failIfTrue(match(IDENT), "\"new.\" can only followed with target");
failDueToUnexpectedToken();
}
}
@@ -5131,7 +5131,7 @@
base = context.createImportMetaExpr(location, createResolveAndUseVariable(context, &m_vm.propertyNames->metaPrivateName, false, expressionStart, location));
next();
} else {
- failIfTrue(match(IDENT), "\"import.\" can only be followed with meta");
+ failIfTrue(match(IDENT), "\"import.\" can only followed with meta");
failDueToUnexpectedToken();
}
} else {
Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -52,7 +52,6 @@
macro(Object) \
macro(PluralRules) \
macro(Promise) \
- macro(ShadowRealm) \
macro(Reflect) \
macro(RegExp) \
macro(RelativeTimeFormat) \
Modified: trunk/Source/_javascript_Core/runtime/IndirectEvalExecutable.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/IndirectEvalExecutable.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/IndirectEvalExecutable.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -34,9 +34,7 @@
namespace JSC {
-
-template<typename ErrorHandlerFunctor>
-inline IndirectEvalExecutable* IndirectEvalExecutable::createImpl(JSGlobalObject* globalObject, const SourceCode& source, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType, ErrorHandlerFunctor errorHandler)
+IndirectEvalExecutable* IndirectEvalExecutable::create(JSGlobalObject* globalObject, const SourceCode& source, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType)
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
@@ -52,7 +50,7 @@
ParserError error;
OptionSet<CodeGenerationMode> codeGenerationMode = globalObject->defaultCodeGenerationMode();
-
+
UnlinkedEvalCodeBlock* unlinkedEvalCode = vm.codeCache()->getUnlinkedEvalCodeBlock(
vm, executable, executable->source(), JSParserStrictMode::NotStrict, codeGenerationMode, error, evalContextType);
@@ -60,8 +58,7 @@
globalObject->debugger()->sourceParsed(globalObject, executable->source().provider(), error.line(), error.message());
if (error.isValid()) {
- errorHandler(executable->source(), &error);
- scope.release();
+ throwVMError(globalObject, scope, error.toErrorObject(globalObject, executable->source()));
return nullptr;
}
@@ -70,24 +67,6 @@
return executable;
}
-IndirectEvalExecutable* IndirectEvalExecutable::create(JSGlobalObject* globalObject, const SourceCode& source, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType, NakedPtr<JSObject>& resultingError)
-{
- auto handleError = [&](const SourceCode& source, ParserError* error) {
- resultingError = error->toErrorObject(globalObject, source);
- };
- return createImpl(globalObject, source, derivedContextType, isArrowFunctionContext, evalContextType, handleError);
-}
-
-IndirectEvalExecutable* IndirectEvalExecutable::tryCreate(JSGlobalObject* globalObject, const SourceCode& source, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType)
-{
- VM& vm = globalObject->vm();
- auto handleError = [&](const SourceCode& source, ParserError* error) {
- auto scope = DECLARE_THROW_SCOPE(vm);
- throwVMError(globalObject, scope, error->toErrorObject(globalObject, source));
- };
- return createImpl(globalObject, source, derivedContextType, isArrowFunctionContext, evalContextType, handleError);
-}
-
constexpr bool inStrictContext = false;
constexpr bool insideOrdinaryFunction = false;
IndirectEvalExecutable::IndirectEvalExecutable(JSGlobalObject* globalObject, const SourceCode& source, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType)
Modified: trunk/Source/_javascript_Core/runtime/IndirectEvalExecutable.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/IndirectEvalExecutable.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/IndirectEvalExecutable.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -31,12 +31,8 @@
class IndirectEvalExecutable final : public EvalExecutable {
public:
- static IndirectEvalExecutable* tryCreate(JSGlobalObject*, const SourceCode&, DerivedContextType, bool isArrowFunctionContext, EvalContextType);
- static IndirectEvalExecutable* create(JSGlobalObject*, const SourceCode&, DerivedContextType, bool isArrowFunctionContext, EvalContextType, NakedPtr<JSObject>&);
+ static IndirectEvalExecutable* create(JSGlobalObject*, const SourceCode&, DerivedContextType, bool isArrowFunctionContext, EvalContextType);
private:
- template<typename ErrorHandlerFunctor>
- inline static IndirectEvalExecutable* createImpl(JSGlobalObject*, const SourceCode&, DerivedContextType, bool isArrowFunctionContext, EvalContextType, ErrorHandlerFunctor);
-
IndirectEvalExecutable(JSGlobalObject*, const SourceCode&, DerivedContextType, bool isArrowFunctionContext, EvalContextType);
};
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -196,9 +196,6 @@
#include "SetConstructor.h"
#include "SetIteratorPrototype.h"
#include "SetPrototype.h"
-#include "ShadowRealmConstructor.h"
-#include "ShadowRealmObject.h"
-#include "ShadowRealmPrototype.h"
#include "StrictEvalActivation.h"
#include "StringConstructor.h"
#include "StringIteratorPrototype.h"
@@ -927,9 +924,6 @@
for (unsigned i = 0; i < NumberOfArrayIndexingModes; ++i)
m_arrayStructureForIndexingShapeDuringAllocation[i] = m_originalArrayStructureForIndexingShape[i];
- m_shadowRealmPrototype.set(vm, this, ShadowRealmPrototype::create(vm, ShadowRealmPrototype::createStructure(vm, this, m_objectPrototype.get())));
- m_shadowRealmObjectStructure.set(vm, this, ShadowRealmObject::createStructure(vm, this, m_shadowRealmPrototype.get()));
-
m_regExpPrototype.set(vm, this, RegExpPrototype::create(vm, this, RegExpPrototype::createStructure(vm, this, m_objectPrototype.get())));
m_regExpStructure.set(vm, this, RegExpObject::createStructure(vm, this, m_regExpPrototype.get()));
m_regExpMatchesArrayStructure.set(vm, this, createRegExpMatchesArrayStructure(vm, this));
@@ -1036,10 +1030,7 @@
ArrayConstructor* arrayConstructor = ArrayConstructor::create(vm, this, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get(), m_speciesGetterSetter.get());
m_arrayConstructor.set(vm, this, arrayConstructor);
m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::Array)].set(vm, this, arrayConstructor);
-
- ShadowRealmConstructor* shadowRealmConstructor = ShadowRealmConstructor::create(vm, ShadowRealmConstructor::createStructure(vm, this, m_functionPrototype.get()), m_shadowRealmPrototype.get(), m_speciesGetterSetter.get());
- m_shadowRealmConstructor.set(vm, this, shadowRealmConstructor);
-
+
RegExpConstructor* regExpConstructor = RegExpConstructor::create(vm, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get(), m_speciesGetterSetter.get());
m_regExpConstructor.set(vm, this, regExpConstructor);
m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::RegExp)].set(vm, this, regExpConstructor);
@@ -1119,7 +1110,6 @@
m_functionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, functionConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
m_arrayPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, arrayConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
m_regExpPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, regExpConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
- m_shadowRealmPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, shadowRealmConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
putDirectWithoutTransition(vm, vm.propertyNames->Object, objectConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
putDirectWithoutTransition(vm, vm.propertyNames->Function, functionConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
@@ -1271,8 +1261,6 @@
TemporalObject* temporal = TemporalObject::create(vm, TemporalObject::createStructure(vm, this));
putDirectWithoutTransition(vm, vm.propertyNames->Temporal, temporal, static_cast<unsigned>(PropertyAttribute::DontEnum));
}
- if (Options::useShadowRealm())
- putDirectWithoutTransition(vm, vm.propertyNames->ShadowRealm, shadowRealmConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
m_moduleLoader.initLater(
[] (const Initializer<JSModuleLoader>& init) {
@@ -1445,12 +1433,6 @@
m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::hostPromiseRejectionTracker)].initLater([] (const Initializer<JSCell>& init) {
init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 2, String(), globalFuncHostPromiseRejectionTracker));
});
- m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::importInRealm)].initLater([] (const Initializer<JSCell>& init) {
- init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), importInRealm));
- });
- m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::evalInRealm)].initLater([] (const Initializer<JSCell>& init) {
- init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), evalInRealm));
- });
m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::thisTimeValue)].initLater([] (const Initializer<JSCell>& init) {
init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), dateProtoFuncGetTime, DatePrototypeGetTimeIntrinsic));
});
@@ -2135,7 +2117,6 @@
thisObject->m_URIErrorStructure.visit(visitor);
thisObject->m_aggregateErrorStructure.visit(visitor);
visitor.append(thisObject->m_arrayConstructor);
- visitor.append(thisObject->m_shadowRealmConstructor);
visitor.append(thisObject->m_regExpConstructor);
visitor.append(thisObject->m_objectConstructor);
visitor.append(thisObject->m_functionConstructor);
@@ -2233,7 +2214,6 @@
thisObject->m_customSetterFunctionStructure.visit(visitor);
thisObject->m_boundFunctionStructure.visit(visitor);
thisObject->m_nativeStdFunctionStructure.visit(visitor);
- visitor.append(thisObject->m_shadowRealmObjectStructure);
visitor.append(thisObject->m_regExpStructure);
visitor.append(thisObject->m_generatorFunctionStructure);
visitor.append(thisObject->m_asyncFunctionStructure);
@@ -2590,13 +2570,6 @@
return globalObject;
}
-JSGlobalObject* JSGlobalObject::createWithCustomMethodTable(VM& vm, Structure* structure, const GlobalObjectMethodTable* methodTable)
-{
- JSGlobalObject* globalObject = new (NotNull, allocateCell<JSGlobalObject>(vm.heap)) JSGlobalObject(vm, structure, methodTable);
- globalObject->finishCreation(vm);
- return globalObject;
-}
-
void JSGlobalObject::finishCreation(VM& vm)
{
DeferTermination deferTermination(vm);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -115,8 +115,6 @@
class ObjectConstructor;
class ProgramCodeBlock;
class ProgramExecutable;
-class ShadowRealmConstructor;
-class ShadowRealmPrototype;
class RegExpConstructor;
class RegExpPrototype;
class SetIteratorPrototype;
@@ -313,7 +311,6 @@
WriteBarrier<ObjectConstructor> m_objectConstructor;
WriteBarrier<ArrayConstructor> m_arrayConstructor;
- WriteBarrier<ShadowRealmConstructor> m_shadowRealmConstructor;
WriteBarrier<RegExpConstructor> m_regExpConstructor;
WriteBarrier<FunctionConstructor> m_functionConstructor;
WriteBarrier<JSPromiseConstructor> m_promiseConstructor;
@@ -361,7 +358,6 @@
WriteBarrier<ObjectPrototype> m_objectPrototype;
WriteBarrier<FunctionPrototype> m_functionPrototype;
WriteBarrier<ArrayPrototype> m_arrayPrototype;
- WriteBarrier<ShadowRealmPrototype> m_shadowRealmPrototype;
WriteBarrier<RegExpPrototype> m_regExpPrototype;
WriteBarrier<IteratorPrototype> m_iteratorPrototype;
WriteBarrier<AsyncIteratorPrototype> m_asyncIteratorPrototype;
@@ -418,7 +414,6 @@
LazyProperty<JSGlobalObject, Structure> m_customSetterFunctionStructure;
LazyProperty<JSGlobalObject, Structure> m_nativeStdFunctionStructure;
PropertyOffset m_functionNameOffset;
- WriteBarrier<Structure> m_shadowRealmObjectStructure;
WriteBarrier<Structure> m_regExpStructure;
WriteBarrier<AsyncFunctionPrototype> m_asyncFunctionPrototype;
WriteBarrier<AsyncGeneratorFunctionPrototype> m_asyncGeneratorFunctionPrototype;
@@ -621,7 +616,6 @@
}
JS_EXPORT_PRIVATE static JSGlobalObject* create(VM&, Structure*);
- JS_EXPORT_PRIVATE static JSGlobalObject* createWithCustomMethodTable(VM&, Structure*, const GlobalObjectMethodTable*);
DECLARE_EXPORT_INFO;
@@ -726,7 +720,6 @@
BigIntPrototype* bigIntPrototype() const { return m_bigIntPrototype.get(); }
JSObject* datePrototype() const { return m_dateStructure.prototype(this); }
JSObject* symbolPrototype() const { return m_symbolObjectStructure.prototypeInitializedOnMainThread(this); }
- ShadowRealmPrototype* shadowRealmPrototype() const { return m_shadowRealmPrototype.get(); }
RegExpPrototype* regExpPrototype() const { return m_regExpPrototype.get(); }
JSObject* errorPrototype() const { return m_errorStructure.prototype(this); }
IteratorPrototype* iteratorPrototype() const { return m_iteratorPrototype.get(); }
@@ -844,7 +837,6 @@
PropertyOffset functionNameOffset() const { return m_functionNameOffset; }
Structure* numberObjectStructure() const { return m_numberObjectStructure.get(this); }
Structure* regExpStructure() const { return m_regExpStructure.get(); }
- Structure* shadowRealmStructure() const { return m_shadowRealmObjectStructure.get(); }
Structure* generatorStructure() const { return m_generatorStructure.get(); }
Structure* asyncGeneratorStructure() const { return m_asyncGeneratorStructure.get(); }
Structure* generatorFunctionStructure() const { return m_generatorFunctionStructure.get(); }
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -492,7 +492,7 @@
return JSValue::encode(parsedObject);
SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
- EvalExecutable* eval = IndirectEvalExecutable::tryCreate(globalObject, makeSource(s, sourceOrigin), DerivedContextType::None, false, EvalContextType::None);
+ EvalExecutable* eval = IndirectEvalExecutable::create(globalObject, makeSource(s, sourceOrigin), DerivedContextType::None, false, EvalContextType::None);
EXCEPTION_ASSERT(!!scope.exception() == !eval);
if (!eval)
return encodedJSValue();
Modified: trunk/Source/_javascript_Core/runtime/JSType.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/JSType.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/JSType.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -96,7 +96,6 @@
CASE(StrictEvalActivationType)
CASE(WithScopeType)
CASE(ModuleNamespaceObjectType)
- CASE(ShadowRealmType)
CASE(RegExpObjectType)
CASE(JSDateType)
CASE(ProxyObjectType)
Modified: trunk/Source/_javascript_Core/runtime/JSType.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/JSType.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/JSType.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -110,7 +110,6 @@
// End JSScope types.
ModuleNamespaceObjectType,
- ShadowRealmType,
RegExpObjectType,
JSDateType,
ProxyObjectType,
Modified: trunk/Source/_javascript_Core/runtime/OptionsList.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/OptionsList.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/OptionsList.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -540,8 +540,6 @@
v(Bool, useHasOwn, true, Normal, "Expose the Object.hasOwn method") \
v(Bool, useIntlEnumeration, true, Normal, "Expose the Intl enumeration APIs.") \
v(Bool, useSharedArrayBuffer, false, Normal, nullptr) \
- /* FIXME: ShadownRealm can be enabled once WebCore's JSGlobalObject == JSDOMGlobalObject assumption is removed, https://bugs.webkit.org/show_bug.cgi?id=231506 */\
- v(Bool, useShadowRealm, false, Normal, "Expose the ShadowRealm object.") \
v(Bool, useTemporal, false, Normal, "Expose the Temporal object.") \
v(Bool, useWebAssemblyThreading, true, Normal, "Allow instructions from the wasm threading spec.") \
v(Bool, useWebAssemblyTypedFunctionReferences, false, Normal, "Allow function types from the wasm typed function references spec.") \
Deleted: trunk/Source/_javascript_Core/runtime/ShadowRealmConstructor.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/ShadowRealmConstructor.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/ShadowRealmConstructor.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2021 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ShadowRealmConstructor.h"
-
-#include "JSCInlines.h"
-#include "ShadowRealmObject.h"
-
-namespace JSC {
-
-const ClassInfo ShadowRealmConstructor::s_info = { "Function", &InternalFunction::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ShadowRealmConstructor) };
-
-STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ShadowRealmConstructor);
-
-static JSC_DECLARE_HOST_FUNCTION(callShadowRealm);
-static JSC_DECLARE_HOST_FUNCTION(constructWithShadowRealmConstructor);
-
-ShadowRealmConstructor::ShadowRealmConstructor(VM& vm, Structure* structure)
- : InternalFunction(vm, structure, callShadowRealm, constructWithShadowRealmConstructor)
-{
-}
-
-void ShadowRealmConstructor::finishCreation(VM& vm, ShadowRealmPrototype* shadowRealmPrototype)
-{
- Base::finishCreation(vm, 0, vm.propertyNames->ShadowRealm.string(), PropertyAdditionMode::WithoutStructureTransition);
- putDirectWithoutTransition(vm, vm.propertyNames->prototype, shadowRealmPrototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
-}
-
-JSC_DEFINE_HOST_FUNCTION(constructWithShadowRealmConstructor, (JSGlobalObject* globalObject, CallFrame*))
-{
- VM& vm = globalObject->vm();
- Structure* shadowRealmStructure = ShadowRealmObject::createStructure(vm, globalObject, globalObject->shadowRealmPrototype());
- JSObject* shadowRealmObject = ShadowRealmObject::create(vm, shadowRealmStructure, globalObject->globalObjectMethodTable());
- return JSValue::encode(shadowRealmObject);
-}
-
-JSC_DEFINE_HOST_FUNCTION(callShadowRealm, (JSGlobalObject* globalObject, CallFrame*))
-{
- auto scope = DECLARE_THROW_SCOPE(globalObject->vm());
- return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(globalObject, scope, "ShadowRealm"));
-}
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/runtime/ShadowRealmConstructor.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/ShadowRealmConstructor.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/ShadowRealmConstructor.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2021 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "InternalFunction.h"
-#include "ShadowRealmPrototype.h"
-
-namespace JSC {
-
-class GetterSetter;
-
-class ShadowRealmConstructor final : public InternalFunction {
-public:
- typedef InternalFunction Base;
- static constexpr unsigned StructureFlags = Base::StructureFlags;
-
- static ShadowRealmConstructor* create(VM& vm, Structure* structure, ShadowRealmPrototype* shadowRealmPrototype, GetterSetter*)
- {
- ShadowRealmConstructor* constructor = new (NotNull, allocateCell<ShadowRealmConstructor>(vm.heap)) ShadowRealmConstructor(vm, structure);
- constructor->finishCreation(vm, shadowRealmPrototype);
- return constructor;
- }
-
- DECLARE_INFO;
-
- static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
- {
- return Structure::create(vm, globalObject, prototype, TypeInfo(InternalFunctionType, StructureFlags), info());
- }
-
-private:
- ShadowRealmConstructor(VM&, Structure*);
- void finishCreation(VM&, ShadowRealmPrototype*);
-};
-STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(ShadowRealmConstructor, InternalFunction);
-
-} // namespace JSC
-
Deleted: trunk/Source/_javascript_Core/runtime/ShadowRealmObject.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/ShadowRealmObject.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/ShadowRealmObject.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2021 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ShadowRealmObject.h"
-
-namespace JSC {
-
-STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ShadowRealmObject);
-
-} // namespace JSC
-
-namespace JSC {
-
-const ClassInfo ShadowRealmObject::s_info = { "ShadowRealm", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ShadowRealmObject) };
-
-ShadowRealmObject::ShadowRealmObject(VM& vm, Structure* structure)
- : Base(vm, structure)
-{
-}
-
-template<typename Visitor>
-void ShadowRealmObject::visitChildrenImpl(JSCell* cell, Visitor& visitor)
-{
- ShadowRealmObject* thisObject = jsCast<ShadowRealmObject*>(cell);
- ASSERT_GC_OBJECT_INHERITS(thisObject, info());
- Base::visitChildren(thisObject, visitor);
-
- visitor.append(thisObject->m_globalObject);
-}
-
-DEFINE_VISIT_CHILDREN(ShadowRealmObject);
-
-ShadowRealmObject* ShadowRealmObject::create(VM& vm, Structure* structure, const GlobalObjectMethodTable* methodTable)
-{
- ShadowRealmObject* object = new (NotNull, allocateCell<ShadowRealmObject>(vm.heap)) ShadowRealmObject(vm, structure);
- object->finishCreation(vm);
- JSGlobalObject* globalObject = JSGlobalObject::createWithCustomMethodTable(vm, JSGlobalObject::createStructure(vm, jsNull()), methodTable);
- object->m_globalObject.set(vm, object, globalObject);
- return object;
-}
-
-void ShadowRealmObject::finishCreation(VM& vm)
-{
- Base::finishCreation(vm);
- ASSERT(inherits(vm, info()));
- JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
-}
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/runtime/ShadowRealmObject.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/ShadowRealmObject.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/ShadowRealmObject.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2021 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "JSCJSValueInlines.h"
-#include "JSObject.h"
-
-namespace JSC {
-
-class ShadowRealmObject final : public JSNonFinalObject {
-public:
- using Base = JSNonFinalObject;
- static constexpr unsigned StructureFlags = Base::StructureFlags;
-
- template<typename CellType, SubspaceAccess mode>
- static IsoSubspace* subspaceFor(VM& vm)
- {
- return vm.shadowRealmSpace<mode>();
- }
-
- static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
- {
- return Structure::create(vm, globalObject, prototype, TypeInfo(ShadowRealmType, StructureFlags), info());
- }
-
- DECLARE_INFO;
-
- static ShadowRealmObject* create(VM&, Structure*, const GlobalObjectMethodTable*);
-
- JSGlobalObject* globalObject() { return m_globalObject.get(); }
-
-private:
- ShadowRealmObject(VM&, Structure*);
- void finishCreation(VM&);
- DECLARE_VISIT_CHILDREN;
-
- WriteBarrier<JSGlobalObject> m_globalObject;
-};
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/runtime/ShadowRealmPrototype.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/ShadowRealmPrototype.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/ShadowRealmPrototype.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2021 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ShadowRealmPrototype.h"
-
-#include "IndirectEvalExecutable.h"
-#include "Interpreter.h"
-#include "JSGlobalObject.h"
-#include "JSInternalPromise.h"
-#include "JSModuleLoader.h"
-#include "ShadowRealmObject.h"
-
-#include "ShadowRealmPrototype.lut.h"
-
-namespace JSC {
-
-/* Source for ShadowRealmPrototype.lut.h
-@begin shadowRealmPrototypeTable
- evaluate JSBuiltin DontEnum|Function 1
- importValue JSBuiltin DontEnum|Function 2
-@end
-*/
-
-const ClassInfo ShadowRealmPrototype::s_info = { "ShadowRealm", &Base::s_info, &shadowRealmPrototypeTable, nullptr, CREATE_METHOD_TABLE(ShadowRealmPrototype) };
-
-ShadowRealmPrototype::ShadowRealmPrototype(VM& vm, Structure* structure)
- : JSNonFinalObject(vm, structure)
-{
-}
-
-void ShadowRealmPrototype::finishCreation(VM& vm)
-{
- Base::finishCreation(vm);
- ASSERT(inherits(vm, info()));
- JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
-}
-
-JSC_DEFINE_HOST_FUNCTION(importInRealm, (JSGlobalObject* globalObject, CallFrame* callFrame))
-{
- VM& vm = globalObject->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- JSValue thisValue = callFrame->uncheckedArgument(0);
- ShadowRealmObject* thisRealm = jsDynamicCast<ShadowRealmObject*>(vm, thisValue);
- ASSERT(thisRealm);
-
- auto* promise = JSPromise::create(vm, globalObject->promiseStructure());
-
- auto sourceOrigin = callFrame->callerSourceOrigin(vm);
- auto* specifier = callFrame->uncheckedArgument(1).toString(globalObject);
- RETURN_IF_EXCEPTION(scope, { });
-
- JSGlobalObject* realmGlobalObject = thisRealm->globalObject();
- auto* internalPromise = realmGlobalObject->moduleLoader()->importModule(realmGlobalObject, specifier, jsUndefined(), sourceOrigin);
- RETURN_IF_EXCEPTION(scope, JSValue::encode(promise->rejectWithCaughtException(realmGlobalObject, scope)));
-
- scope.release();
- promise->resolve(globalObject, internalPromise);
- return JSValue::encode(promise);
-}
-
-JSC_DEFINE_HOST_FUNCTION(evalInRealm, (JSGlobalObject* globalObject, CallFrame* callFrame))
-{
- VM& vm = globalObject->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- JSValue thisValue = callFrame->argument(0);
- ShadowRealmObject* thisRealm = jsDynamicCast<ShadowRealmObject*>(vm, thisValue);
- ASSERT(thisRealm);
- JSGlobalObject* realmGlobalObject = thisRealm->globalObject();
-
- JSValue evalArg = callFrame->argument(1);
- // eval code adapted from JSGlobalObjecFunctions::globalFuncEval
- String script = asString(evalArg)->value(globalObject);
- RETURN_IF_EXCEPTION(scope, { });
-
- NakedPtr<JSObject> executableError;
- SourceCode source = makeSource(script, callFrame->callerSourceOrigin(vm));
- EvalExecutable* eval = IndirectEvalExecutable::create(realmGlobalObject, source, DerivedContextType::None, false, EvalContextType::None, executableError);
- if (executableError) {
- ErrorInstance* error = jsDynamicCast<ErrorInstance*>(vm, JSValue(executableError.get()));
- if (error != nullptr && error->errorType() == ErrorType::SyntaxError) {
- scope.clearException();
- const String syntaxErrorMessage = error->sanitizedMessageString(globalObject);
- RETURN_IF_EXCEPTION(scope, { });
- throwVMError(globalObject, scope, createSyntaxError(globalObject, syntaxErrorMessage));
- } else
- throwVMError(globalObject, scope, createTypeError(globalObject, "Error encountered during evaluation"_s));
- return JSValue::encode(jsUndefined());
- }
- RETURN_IF_EXCEPTION(scope, { });
-
- JSValue result = vm.interpreter->execute(eval, realmGlobalObject, realmGlobalObject->globalThis(), realmGlobalObject->globalScope());
- if (UNLIKELY(scope.exception())) {
- scope.clearException();
- return throwVMError(globalObject, scope, createTypeError(globalObject, "Error encountered during evaluation"_s));
- }
-
- RELEASE_AND_RETURN(scope, JSValue::encode(result));
-}
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/runtime/ShadowRealmPrototype.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/ShadowRealmPrototype.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/ShadowRealmPrototype.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2021 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "JSObject.h"
-
-namespace JSC {
-
-class ShadowRealmPrototype final : public JSNonFinalObject {
-public:
- using Base = JSNonFinalObject;
- static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
-
- template<typename CellType, SubspaceAccess>
- static IsoSubspace* subspaceFor(VM& vm)
- {
- STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(ShadowRealmPrototype, Base);
- return &vm.plainObjectSpace;
- }
-
- static ShadowRealmPrototype* create(VM& vm, Structure* structure)
- {
- ShadowRealmPrototype* prototype = new (NotNull, allocateCell<ShadowRealmPrototype>(vm.heap)) ShadowRealmPrototype(vm, structure);
- prototype->finishCreation(vm);
- return prototype;
- }
-
- DECLARE_INFO;
-
- static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
- {
- return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
- }
-
-private:
- ShadowRealmPrototype(VM&, Structure*);
- void finishCreation(VM&);
-};
-
-JSC_DECLARE_HOST_FUNCTION(importInRealm);
-JSC_DECLARE_HOST_FUNCTION(evalInRealm);
-
-} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2021-10-14 14:24:50 UTC (rev 284159)
@@ -156,7 +156,6 @@
#include "SamplingProfiler.h"
#include "ScopedArguments.h"
#include "ShadowChicken.h"
-#include "ShadowRealmObject.h"
#include "SimpleTypedArrayController.h"
#include "SourceProviderCache.h"
#include "StrictEvalActivation.h"
@@ -1588,7 +1587,6 @@
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(setBucketSpace, cellHeapCellType.get(), JSSet::BucketType)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(setIteratorSpace, cellHeapCellType.get(), JSSetIterator)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(setSpace, cellHeapCellType.get(), JSSet)
-DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(shadowRealmSpace, cellHeapCellType.get(), ShadowRealmObject)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(strictEvalActivationSpace, cellHeapCellType.get(), StrictEvalActivation)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(stringIteratorSpace, cellHeapCellType.get(), JSStringIterator)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(sourceCodeSpace, destructibleCellHeapCellType.get(), JSSourceCode)
Modified: trunk/Source/_javascript_Core/runtime/VM.h (284158 => 284159)
--- trunk/Source/_javascript_Core/runtime/VM.h 2021-10-14 13:54:11 UTC (rev 284158)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2021-10-14 14:24:50 UTC (rev 284159)
@@ -592,7 +592,6 @@
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(setBucketSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(setIteratorSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(setSpace)
- DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(shadowRealmSpace);
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(strictEvalActivationSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(stringIteratorSpace)
DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER(sourceCodeSpace)