v8/test/debugger/debug/debug-evaluate-no-side-effect-builtins-2.js
Ross McIlroy 05207b098a [Interpreter] Replace --ignition flag with a --stress-fullcodegen
Removes the --ignition flag which is now on by default. Adds a
--stress-fullcodegen flag which enables running all functions supported
by fullcodegen to be compiled by fullcodegen.

This will enable moving parser internalization later when we are not
stressing fullcodegen or compiling asm.js functions.

BUG=v8:5203, v8:6409, v8:6589

Change-Id: I7fa68016d4e734755434ec0b4e749ef65ffa7f4e
Reviewed-on: https://chromium-review.googlesource.com/565569
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46635}
2017-07-13 13:05:00 +00:00

91 lines
2.6 KiB
JavaScript

// Copyright 2017 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: --no-stress-fullcodegen
Debug = debug.Debug
var exception = null;
var date = new Date();
var map = new Map().set("a", "b").set("c", "d");
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
function success(expectation, source) {
var result = exec_state.frame(0).evaluate(source, true).value();
if (expectation !== undefined) assertEquals(expectation, result);
}
function fail(source) {
assertThrows(() => exec_state.frame(0).evaluate(source, true),
EvalError);
}
// Test Date.prototype functions.
success(undefined, `Date()`);
success(undefined, `new Date()`);
success(undefined, `Date.now()`);
success(undefined, `Date.parse(1)`);
for (f of Object.getOwnPropertyNames(Date.prototype)) {
if (typeof Date.prototype[f] === "function") {
if (f.startsWith("set")) {
fail(`date.${f}(5);`, true);
} else if (f.startsWith("toLocale")) {
if (typeof Intl === "undefined") continue;
fail(`date.${f}();`, true);
} else {
success(undefined, `date.${f}();`, true);
}
}
}
// Test Boolean.
success(true, `Boolean(1)`);
success(new Boolean(true), `new Boolean(1)`);
success("true", `true.toString()`);
success(true, `true.valueOf()`);
// Test global functions.
success(1, `parseInt("1")`);
success(1.3, `parseFloat("1.3")`);
success("abc", `decodeURI("abc")`);
success("abc", `encodeURI("abc")`);
success("abc", `decodeURIComponent("abc")`);
success("abc", `encodeURIComponent("abc")`);
success("abc", `escape("abc")`);
success("abc", `unescape("abc")`);
success(true, `isFinite(0)`);
success(true, `isNaN(0/0)`);
// Test Map functions.
success(undefined, `new Map()`);
success("[object Map]", `map.toString()`);
success("b", `map.get("a")`);
success(true, `map.get("x") === undefined`);
success(undefined, `map.entries()`);
success(undefined, `map.keys()`);
success(undefined, `map.values()`);
success(2, `map.size`);
fail(`map.has("c")`); // This sets a hash on the object.
fail(`map.forEach(()=>1)`);
fail(`map.delete("a")`);
fail(`map.clear()`);
fail(`map.set("x", "y")`);
} catch (e) {
exception = e;
print(e, e.stack);
};
};
// Add the debug event listener.
Debug.setListener(listener);
function f() {
debugger;
};
f();
assertNull(exception);