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);