v8/test/mjsunit/regress/regress-crbug-935800.js
Michael Starzinger 6957e23b54 [asm.js] Exported functions diverge from wasm js-api spec.
The WebAssembly JavaScript Interface specifies[1] that exported
functions are not constructors, hence do not have the "prototype"
property. This is not true for asm.js exported functions which are
expected to look like normal functions (or constructors).

[1] https://webassembly.github.io/spec/js-api/index.html#exported-function-exotic-objects

R=clemensh@chromium.org
TEST=mjsunit/regress/regress-crbug-935800
BUG=chromium:935800

Change-Id: Idecacfb7f5d4668540589af95fd59872334c21a3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1578499
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60943}
2019-04-23 11:54:01 +00:00

13 lines
383 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 foo() {
"use asm";
function bar() {}
return {bar: bar};
}
var module = foo();
assertTrue(Object.getOwnPropertyNames(module.bar).includes("prototype"));
assertInstanceof(new module.bar(), module.bar);