v8/test/mjsunit/regress/wasm/regress-985154.js
Michael Starzinger 224ca74ae4 [asm.js] Propagate language mode to exported functions.
This makes sure the language mode of the module is correctly propagated
through the WebAssembly module, so that exported functions are allocated
with the correct language mode. It extends the existing {ModuleOrigin}
enum to consist of three values now.

R=clemensh@chromium.org
TEST=mjsunit/regress/wasm/regress-985154
BUG=chromium:985154

Change-Id: Id7b566738b1e710cc5001b894022bcd0f2c01bc3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1708484
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62826}
2019-07-19 11:47:48 +00:00

35 lines
940 B
JavaScript

// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(function TestSloppynessPropagates() {
let f = (function() {
function Module() {
"use asm";
function f() {}
return {f: f}
}
return Module;
})()().f;
let p = Object.getOwnPropertyNames(f);
assertArrayEquals(["length", "name", "arguments", "caller", "prototype"], p);
assertEquals(null, f.arguments);
assertEquals(null, f.caller);
})();
(function TestStrictnessPropagates() {
let f = (function() {
"use strict";
function Module() {
"use asm";
function f() {}
return {f: f}
}
return Module;
})()().f;
let p = Object.getOwnPropertyNames(f);
assertArrayEquals(["length", "name", "prototype"], p);
assertThrows(() => f.arguments, TypeError);
assertThrows(() => f.caller, TypeError);
})();