Diff
Modified: trunk/JSTests/ChangeLog (259586 => 259587)
--- trunk/JSTests/ChangeLog 2020-04-06 18:55:14 UTC (rev 259586)
+++ trunk/JSTests/ChangeLog 2020-04-06 19:01:57 UTC (rev 259587)
@@ -1,3 +1,12 @@
+2020-04-06 Rick Waldron <waldron.r...@gmail.com> and Alexey Shvayka <shvaikal...@gmail.com>
+
+ Remove unnecessary Test262 harness file and implement $262.IsHTMLDDA
+ https://bugs.webkit.org/show_bug.cgi?id=187526
+
+ Reviewed by Darin Adler.
+
+ * stress/optional-chaining.js: Adjust test for callable masquerader.
+
2020-04-06 Justin Michaud <justin_mich...@apple.com>
Allow deleteById to be cached in the DFG
Modified: trunk/JSTests/stress/optional-chaining.js (259586 => 259587)
--- trunk/JSTests/stress/optional-chaining.js 2020-04-06 18:55:14 UTC (rev 259586)
+++ trunk/JSTests/stress/optional-chaining.js 2020-04-06 19:01:57 UTC (rev 259587)
@@ -79,7 +79,6 @@
shouldThrowTypeError(() => ({ x: 'hi' })?.(), '({ x: \'hi\' }) is not a function');
shouldThrowTypeError(() => []?.(), '[] is not a function');
shouldThrowTypeError(() => ['hi']?.(), '[\'hi\'] is not a function');
- shouldThrowTypeError(() => masquerader?.(), 'masquerader is not a function');
}
noInline(testBasicFailureCases);
@@ -105,6 +104,7 @@
shouldThrowTypeError(() => (() => {})?.()(), '(() => {})?.() is not a function');
shouldBe((() => {})?.()?.(), undefined);
shouldBe(null?.()().a['b'], undefined);
+shouldBe(masquerader?.(), null);
const o0 = { a: { b() { return this._b.bind(this); }, _b() { return this.__b; }, __b: { c: 42 } } };
shouldBe(o0?.a?.['b']?.()?.()?.c, 42);
Modified: trunk/Source/_javascript_Core/ChangeLog (259586 => 259587)
--- trunk/Source/_javascript_Core/ChangeLog 2020-04-06 18:55:14 UTC (rev 259586)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-04-06 19:01:57 UTC (rev 259587)
@@ -1,3 +1,30 @@
+2020-04-06 Rick Waldron <waldron.r...@gmail.com> and Alexey Shvayka <shvaikal...@gmail.com>
+
+ Remove unnecessary Test262 harness file and implement $262.IsHTMLDDA
+ https://bugs.webkit.org/show_bug.cgi?id=187526
+
+ Reviewed by Darin Adler.
+
+ Test262 harness requires [1] $262.IsHTMLDDA to be an object with [[IsHTMLDDA]] slot [2],
+ much like `document.all`. It is used in a few tests to make sure that runtimes strictly
+ compare values with `null` and `undefined`.
+
+ With this change, `makeMasquerader` returns callable masquerader to mimic `document.all`
+ in the wild. In order to avoid `masqueradesAsUndefinedWatchpoint` being fired during
+ initialization of JSC shell, $262.IsHTMLDDA is a getter.
+
+ [1]: https://github.com/tc39/test262/blob/master/INTERPRETING.md#host-defined-functions
+ [2]: https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
+
+ * jsc.cpp:
+ (functionMakeMasquerader):
+ (functionCallMasquerader):
+ (JSC::Masquerader::Masquerader): Deleted.
+ (JSC::Masquerader::subspaceFor): Deleted.
+ (JSC::Masquerader::create): Deleted.
+ (JSC::Masquerader::createStructure): Deleted.
+ * runtime/JSObject.h:
+
2020-04-06 Justin Michaud <justin_mich...@apple.com>
Allow deleteById to be cached in the DFG
Modified: trunk/Source/_javascript_Core/jsc.cpp (259586 => 259587)
--- trunk/Source/_javascript_Core/jsc.cpp 2020-04-06 18:55:14 UTC (rev 259586)
+++ trunk/Source/_javascript_Core/jsc.cpp 2020-04-06 19:01:57 UTC (rev 259587)
@@ -196,40 +196,6 @@
exit(status);
}
-class Masquerader : public JSNonFinalObject {
-public:
- Masquerader(VM& vm, Structure* structure)
- : Base(vm, structure)
- {
- }
-
- typedef JSNonFinalObject Base;
- static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::MasqueradesAsUndefined;
-
- template<typename CellType, SubspaceAccess>
- static CompleteSubspace* subspaceFor(VM& vm)
- {
- return &vm.cellSpace;
- }
-
- static Masquerader* create(VM& vm, JSGlobalObject* globalObject)
- {
- globalObject->masqueradesAsUndefinedWatchpoint()->fireAll(vm, "Masquerading object allocated");
- Structure* structure = createStructure(vm, globalObject, jsNull());
- Masquerader* result = new (NotNull, allocateCell<Masquerader>(vm.heap)) Masquerader(vm, structure);
- result->finishCreation(vm);
- return result;
- }
-
- static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
- {
- return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
- }
-
- DECLARE_INFO;
-};
-
-const ClassInfo Masquerader::s_info = { "Masquerader", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(Masquerader) };
static unsigned asyncTestPasses { 0 };
static unsigned asyncTestExpectedPasses { 0 };
@@ -348,6 +314,7 @@
static EncodedJSValue JSC_HOST_CALL functionEffectful42(JSGlobalObject*, CallFrame*);
static EncodedJSValue JSC_HOST_CALL functionIdentity(JSGlobalObject*, CallFrame*);
static EncodedJSValue JSC_HOST_CALL functionMakeMasquerader(JSGlobalObject*, CallFrame*);
+static EncodedJSValue JSC_HOST_CALL functionCallMasquerader(JSGlobalObject*, CallFrame*);
static EncodedJSValue JSC_HOST_CALL functionHasCustomProperties(JSGlobalObject*, CallFrame*);
static EncodedJSValue JSC_HOST_CALL functionDumpTypesForAllVariables(JSGlobalObject*, CallFrame*);
static EncodedJSValue JSC_HOST_CALL functionDrainMicrotasks(JSGlobalObject*, CallFrame*);
@@ -629,6 +596,9 @@
addFunction(vm, dollar, "evalScript", functionDollarEvalScript, 1);
dollar->putDirect(vm, Identifier::fromString(vm, "global"), this);
+
+ JSFunction* IsHTMLDDAGetter = JSFunction::create(vm, this, 0, "IsHTMLDDA"_s, functionMakeMasquerader);
+ dollar->putGetter(this, Identifier::fromString(vm, "IsHTMLDDA"), IsHTMLDDAGetter, static_cast<unsigned>(PropertyAttribute::Accessor));
JSObject* agent = JSFinalObject::create(vm, plainObjectStructure);
dollar->putDirect(vm, Identifier::fromString(vm, "agent"), agent);
@@ -2219,9 +2189,14 @@
EncodedJSValue JSC_HOST_CALL functionMakeMasquerader(JSGlobalObject* globalObject, CallFrame*)
{
VM& vm = globalObject->vm();
- return JSValue::encode(Masquerader::create(vm, globalObject));
+ return JSValue::encode(JSFunction::createFunctionThatMasqueradesAsUndefined(vm, globalObject, 0, "IsHTMLDDA"_s, functionCallMasquerader));
}
+EncodedJSValue JSC_HOST_CALL functionCallMasquerader(JSGlobalObject*, CallFrame*)
+{
+ return JSValue::encode(jsNull());
+}
+
EncodedJSValue JSC_HOST_CALL functionHasCustomProperties(JSGlobalObject* globalObject, CallFrame* callFrame)
{
JSValue value = callFrame->argument(0);
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (259586 => 259587)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2020-04-06 18:55:14 UTC (rev 259586)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2020-04-06 19:01:57 UTC (rev 259587)
@@ -607,7 +607,7 @@
bool putDirectAccessor(JSGlobalObject*, PropertyName, GetterSetter*, unsigned attributes);
JS_EXPORT_PRIVATE bool putDirectCustomAccessor(VM&, PropertyName, JSValue, unsigned attributes);
- bool putGetter(JSGlobalObject*, PropertyName, JSValue, unsigned attributes);
+ JS_EXPORT_PRIVATE bool putGetter(JSGlobalObject*, PropertyName, JSValue, unsigned attributes);
bool putSetter(JSGlobalObject*, PropertyName, JSValue, unsigned attributes);
JS_EXPORT_PRIVATE bool hasProperty(JSGlobalObject*, PropertyName) const;
Modified: trunk/Tools/ChangeLog (259586 => 259587)
--- trunk/Tools/ChangeLog 2020-04-06 18:55:14 UTC (rev 259586)
+++ trunk/Tools/ChangeLog 2020-04-06 19:01:57 UTC (rev 259587)
@@ -1,3 +1,15 @@
+2020-04-06 Rick Waldron <waldron.r...@gmail.com> and Alexey Shvayka <shvaikal...@gmail.com>
+
+ Remove unnecessary Test262 harness file and implement $262.IsHTMLDDA
+ https://bugs.webkit.org/show_bug.cgi?id=187526
+
+ Reviewed by Darin Adler.
+
+ Removed file duplicates functionality of jsc.cpp's GlobalObject::finishCreation.
+
+ * Scripts/test262/Runner.pm:
+ * Scripts/test262/agent.js: Removed.
+
2020-04-06 Saam Barati <sbar...@apple.com>
Implement 1GB of executable memory on arm64
Modified: trunk/Tools/Scripts/test262/Runner.pm (259586 => 259587)
--- trunk/Tools/Scripts/test262/Runner.pm 2020-04-06 18:55:14 UTC (rev 259586)
+++ trunk/Tools/Scripts/test262/Runner.pm 2020-04-06 19:01:57 UTC (rev 259587)
@@ -327,7 +327,6 @@
"$harnessDir/sta.js",
"$harnessDir/assert.js",
"$harnessDir/doneprintHandle.js",
- "$Bin/agent.js"
);
print $deffh getHarness(\@defaultHarnessFiles);
Deleted: trunk/Tools/Scripts/test262/agent.js (259586 => 259587)
--- trunk/Tools/Scripts/test262/agent.js 2020-04-06 18:55:14 UTC (rev 259586)
+++ trunk/Tools/Scripts/test262/agent.js 2020-04-06 19:01:57 UTC (rev 259587)
@@ -1,60 +0,0 @@
-/*
-From https://raw.githubusercontent.com/bterlson/eshost/master/runtimes/jsc.js
-
-Copyright 2018 Brian Terlson.
-
-This software consists of voluntary contributions made by many
-individuals. For exact contribution history, see the revision history
-available at https://github.com/bterlson/eshost.
-
-The following license applies to all parts of this software except as
-documented below:
-
-====
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-====
-
-All files located in the node_modules and external directories are
-externally maintained libraries used by this software which have their
-own licenses; we recommend you read them, as their terms may differ from
-the terms above.
-
-*/
-
-/* _javascript_Core exposes a "$" object to its runtime */
-/* Using this["\x24"]; prevents overwrite by ConsoleAgent */
-var jsc = this["\x24"];
-var $262 = {
- agent: jsc.agent,
- global: jsc.global,
- createRealm: jsc.createRealm,
- detachArrayBuffer: jsc.detachArrayBuffer,
- evalScript: jsc.evalScript,
- getGlobal(name) {
- return this.global[name];
- },
- setGlobal(name, value) {
- this.global[name] = value;
- },
- destroy() { /* noop */ },
- IsHTMLDDA() { return {}; },
-};