Improve arguments object (#4145)

- Enhancement: Arguments object properties are now lazy instantiated
 - Bugfix: Mapped arguments object instantiated properties cannot be lcached
 - Bugfix: Mapped arguments should be constructed even if 0 formal parameters or arguments are provided
 - Update: remove 'caller' property of unmapped arguments object

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-09-28 15:57:58 +02:00
committed by GitHub
parent 32de38198a
commit 75385a6045
14 changed files with 943 additions and 591 deletions
-1
View File
@@ -120,7 +120,6 @@ fn_expr = function (a, b, c)
}
}
check_type_error_for_property (arguments, 'caller');
check_type_error_for_property (arguments, 'callee');
}
+21
View File
@@ -0,0 +1,21 @@
// Copyright JS Foundation and other contributors, http://js.foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function f(a, b, c)
{
'use strict';
assert(!Object.hasOwnProperty(arguments,'caller'));
}
f(1, 2, 3);
+26
View File
@@ -0,0 +1,26 @@
// Copyright JS Foundation and other contributors, http://js.foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function f(a, b, c)
{
'use strict';
try {
arguments['caller'];
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
}
f(1, 2, 3);
+7 -8
View File
@@ -243,14 +243,6 @@
<test id="intl402/String/prototype/toLocaleUpperCase/special_casing_Turkish.js"><reason></reason></test>
<test id="language/arguments-object/10.6-13-a-2.js"><reason></reason></test>
<test id="language/arguments-object/10.6-13-a-3.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js"><reason></reason></test>
<test id="language/asi/S7.9_A5.7_T1.js"><reason></reason></test>
<test id="language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js"><reason>No longer a SyntaxError in ES11</reason></test>
<test id="language/default-parameters/function-length.js"><reason></reason></test>
@@ -344,4 +336,11 @@
<test id="built-ins/RegExp/prototype/ignoreCase/15.10.7.3-1.js"><reason>RegExp accessors should no longer throw when called on the RegExp prototype</reason></test>
<test id="built-ins/RegExp/prototype/multiline/15.10.7.4-1.js"><reason>RegExp accessors should no longer throw when called on the RegExp prototype</reason></test>
<test id="built-ins/RegExp/prototype/source/15.10.7.1-1.js"><reason>RegExp accessors should no longer throw when called on the RegExp prototype</reason></test>
<test id="language/arguments-object/10.6-13-b-1-s.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="language/arguments-object/10.6-13-b-2-s.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="language/arguments-object/10.6-13-b-3-s.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="language/arguments-object/10.6-14-1-s.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="language/arguments-object/10.6-14-b-1-s.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="language/arguments-object/10.6-14-b-4-s.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="language/statements/class/strict-mode/arguments-caller.js"><reason>ES11: arguments object no longer has caller property</reason></test>
</excludeList>
-18
View File
@@ -1583,7 +1583,6 @@
<test id="built-ins/Symbol/unscopables/cross-realm.js"><reason></reason></test>
<test id="built-ins/ThrowTypeError/distinct-cross-realm.js"><reason></reason></test>
<test id="built-ins/ThrowTypeError/name.js"><reason></reason></test>
<test id="built-ins/ThrowTypeError/unique-per-realm-non-simple.js"><reason></reason></test>
<test id="built-ins/TypedArray/from/arylk-get-length-error.js"><reason></reason></test>
<test id="built-ins/TypedArray/from/arylk-to-length-error.js"><reason></reason></test>
<test id="built-ins/TypedArray/from/iter-access-error.js"><reason></reason></test>
@@ -2867,23 +2866,6 @@
<test id="intl402/supportedLocalesOf-unicode-extensions-ignored.js"><reason></reason></test>
<test id="language/arguments-object/10.6-13-a-2.js"><reason></reason></test>
<test id="language/arguments-object/10.6-13-a-3.js"><reason></reason></test>
<test id="language/arguments-object/arguments-caller.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-2.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-4.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-2.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-delete-4.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-3.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-nonwritable-4.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-2.js"><reason></reason></test>
<test id="language/arguments-object/mapped/mapped-arguments-nonconfigurable-strict-delete-4.js"><reason></reason></test>
<test id="language/arguments-object/mapped/nonconfigurable-descriptors-basic.js"><reason></reason></test>
<test id="language/arguments-object/mapped/nonconfigurable-descriptors-set-value-by-arguments.js"><reason></reason></test>
<test id="language/arguments-object/mapped/nonconfigurable-descriptors-set-value-with-define-property.js"><reason></reason></test>
<test id="language/arguments-object/mapped/nonconfigurable-descriptors-with-param-assign.js"><reason></reason></test>
<test id="language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js"><reason></reason></test>
<test id="language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js"><reason></reason></test>
<test id="language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js"><reason></reason></test>
<test id="language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js"><reason></reason></test>
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js"><reason></reason></test>
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js"><reason></reason></test>