Commit 5f4a0d69 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

Revert "[runtime] Make all built-in functions strict."

This reverts commit 72b88fda.

Reason for revert: Changes a layout test:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/16595

Original change's description:
> [runtime] Make all built-in functions strict.
> 
> According to ES#sec-built-in-function-objects all built-in functions
> must be strict.
> 
> This is a preliminary CL before changing the way we define built-in
> functions in native JS files.
> 
> Bug: v8:6459
> Change-Id: I8e60b342f04ea1b0843fe1990334cbb9b26ebac4
> Reviewed-on: https://chromium-review.googlesource.com/546215
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Commit-Queue: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#46237}

TBR=adamk@chromium.org,ishell@chromium.org,verwaest@chromium.org

Change-Id: Ic458b478b2dd23aae7ea2a51aa6052c1f5931c56
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6459
Reviewed-on: https://chromium-review.googlesource.com/549322Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46242}
parent 3e9797f7
This diff is collapsed.
......@@ -1486,7 +1486,6 @@ Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
Handle<Context> context(isolate()->native_context());
Handle<SharedFunctionInfo> info =
NewSharedFunctionInfo(name, code, map->is_constructor());
// Proper language mode in shared function info will be set outside.
DCHECK(is_sloppy(info->language_mode()));
DCHECK(!map->IsUndefined(isolate()));
DCHECK(
......@@ -1505,10 +1504,8 @@ Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
Handle<JSFunction> Factory::NewFunction(Handle<String> name) {
Handle<JSFunction> result =
NewFunction(isolate()->sloppy_function_map(), name, MaybeHandle<Code>());
DCHECK(is_sloppy(result->shared()->language_mode()));
return result;
return NewFunction(
isolate()->sloppy_function_map(), name, MaybeHandle<Code>());
}
......@@ -1518,9 +1515,7 @@ Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
Handle<Map> map = is_strict
? isolate()->strict_function_without_prototype_map()
: isolate()->sloppy_function_without_prototype_map();
Handle<JSFunction> result = NewFunction(map, name, code);
result->shared()->set_language_mode(is_strict ? STRICT : SLOPPY);
return result;
return NewFunction(map, name, code);
}
......@@ -1531,7 +1526,6 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name, Handle<Code> code,
: isolate()->sloppy_function_map();
Handle<JSFunction> result = NewFunction(map, name, code);
result->set_prototype_or_initial_map(*prototype);
result->shared()->set_language_mode(is_strict ? STRICT : SLOPPY);
return result;
}
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
(function(global, utils) {
"use strict";
%CheckIsBootstrapping();
......
......@@ -4,8 +4,6 @@
(function(global, utils) {
"use strict";
%CheckIsBootstrapping();
function MaxSimple(a, b) {
......
......@@ -6,8 +6,6 @@
(function(global, utils) {
"use strict";
%CheckIsBootstrapping();
// -------------------------------------------------------------------
......
......@@ -4,7 +4,7 @@
(function(global, utils) {
"use strict";
'use strict';
// -------------------------------------------------------------------
// Imports
......
......@@ -4,8 +4,6 @@
(function(global, utils) {
"use strict";
%CheckIsBootstrapping();
// -------------------------------------------------------------------
......
......@@ -4,8 +4,6 @@
(function(global, utils) {
"use strict";
%CheckIsBootstrapping();
// ----------------------------------------------------------------------------
......
......@@ -46,9 +46,11 @@ f(null);
// Check called from eval.
eval('f(null)');
// Check called from builtin functions.
// Check called from strict builtin functions.
[null, null].sort(f);
[null].forEach(f, null);
// Check called from sloppy builtin functions.
"abel".replace(/b/g, function h() {
assertEquals(null, h.caller);
assertEquals(String.prototype.replace, h.caller);
});
......@@ -26,11 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var builtInPropertyNames = [
'prototype', 'length', 0, 1, '$1', 'name', 'message', 'constructor'
];
var builtInPropertyNamesMayThrow = [
'caller', 'arguments'
'prototype', 'length', 'caller', 0, 1, '$1', 'arguments', 'name', 'message', 'constructor'
];
function getAnException() {
......@@ -81,13 +77,6 @@ function runTest(fun) {
var propertyName = builtInPropertyNames[k];
fun(obj, propertyName);
}
for (var k in builtInPropertyNamesMayThrow) {
var propertyName = builtInPropertyNamesMayThrow[k];
try {
fun(obj, propertyName);
} catch (e) {
}
}
}
}
}
......
......@@ -625,11 +625,6 @@ if (testFailed) {
}
(function ExtractedAsyncFromSyncIteratorMethods() {
// TODO(ishell, caitp): Rewrite the test without using function.caller.
// According to ES#sec-built-in-function-objects all built-in functions
// must be strict. And ES#sec-forbidden-extensions states that the value of
// a function.caller must not be a strict function.
return;
// Async-from-Sync iterator methods can be extracted via function.caller.
// TODO(caitp): test extracted `throw` method using yield* in async generator.
let extractor = [0, 1, 2, 3, 4,5,6,7,8,9];
......
......@@ -6,7 +6,7 @@
let success = false;
function f() {
success = (f.caller === null);
success = (f.caller.arguments === null);
}
Promise.resolve().then(f);
%RunMicrotasks();
......
......@@ -12,9 +12,6 @@ function CheckMethodEx(object, prop_name, function_name, length) {
assertTrue(desc.configurable);
assertTrue(desc.writable);
assertThrows(() => new desc.value());
// Check that built-in function is strict.
assertThrows(() => desc.value.arguments);
assertThrows(() => desc.value.caller);
}
function CheckMethod(object, name, length) {
......@@ -35,9 +32,6 @@ function CheckGetter(object, name) {
assertEquals(0, desc.get.length);
assertFalse(desc.enumerable);
assertTrue(desc.configurable);
// Check that built-in function is strict.
assertThrows(() => desc.get.arguments);
assertThrows(() => desc.get.caller);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment