v8/test/mjsunit/compiler/constant-fold-add-static.js
Georg Schmid a542b735b4 Add StaticAssert node and corresponding intrinsic that allows explicit static asserts in tests
R=tebbi@chromium.org

Change-Id: I1003a4f4a0e9227618e685a2fb56ead2083709a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1594731
Commit-Queue: Georg Schmid <gsps@google.com>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61251}
2019-05-06 16:32:47 +00:00

17 lines
426 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.
// Flags: --allow-natives-syntax
// Check that constant-folding of arithmetic results in identical nodes.
(function() {
function foo(x) {
%StaticAssert(1 * x == x + 0);
}
foo(121);
foo(122);
%OptimizeFunctionOnNextCall(foo);
foo(123);
})();