v8/test/mjsunit/asm/load-elimination.js
Georg Neis aff70262f1 [test] Crash on invalid intrinsic use unless --fuzzing is on
For example, when --fuzzing is off, %OptimizeFunctionOnNextCall now
crashes when given a non-function argument.

The following behaviors remain unchanged for now:
- %DeoptimizeFunction continues to do nothing if the function is not
  optimized.
- %DeoptimizeNow continues to do nothing if the top-most JS function
  is not optimized.
- %OptimizeOSR continues to do nothing if the function already has
  optimized code.

Bug: v8:10249
Change-Id: I35d2f3d50ce3f94c8ffccabe50fb4df2b70ce028
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137406
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67121}
2020-04-14 15:01:49 +00:00

26 lines
632 B
JavaScript

// Copyright 2016 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.
// Flags: --allow-natives-syntax
var stdlib = this;
var foreign = {};
var heap = new ArrayBuffer(64 * 1024 * 1024);
var foo = (function(stdlib, foreign, heap) {
"use asm";
var M16 = new stdlib.Int16Array(heap);
var M32 = new stdlib.Int32Array(heap);
function foo() {
var i = 0;
M32[0] = 0x12341234;
i = M32[0] | 0;
return M16[0] | 0;
}
return foo;
})(stdlib, foreign, heap);
assertEquals(0x1234, foo());
assertEquals(0x1234, foo());