Commit 0564a99e authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[snapshot] Remove TEST natives

These were only used by test-log/EquivalenceOfLoggingAndTraversal,
which itself has been marked as failing since 2013. This CL removes
the test itself as well as the TEST natives kind.

Bug: v8:7624,v8:2857
Change-Id: Iedf2b1c94e31ccd1ea885d72bf1fac5d33defa90
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1643467
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61984}
parent 43cd5d10
......@@ -4405,7 +4405,6 @@ group("v8_generated_cc_files") {
":js2c_extras",
":run_torque",
"src/inspector:v8_generated_cc_files",
"test/cctest:v8_generated_cc_files",
]
}
......
......@@ -16,7 +16,6 @@ namespace internal {
enum NativeType {
EXTRAS,
TEST
};
// Extra handling for V8_EXPORT_PRIVATE in combination with USING_V8_SHARED
......
......@@ -55,8 +55,6 @@ v8_source_set("cctest_sources") {
testonly = true
sources = [
"$target_gen_dir/resources.cc",
### gcmole(all) ###
"../common/assembler-tester.h",
"../common/wasm/flag-utils.h",
......@@ -369,7 +367,6 @@ v8_source_set("cctest_sources") {
public_deps = [
":cctest_headers",
":resources",
"..:common_test_headers",
"../..:v8_for_testing",
"../..:v8_libbase",
......@@ -418,35 +415,6 @@ v8_source_set("cctest_sources") {
}
}
action("resources") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
script = "../../tools/js2c.py"
# NOSORT
sources = [
"../../tools/splaytree.js",
"../../tools/codemap.js",
"../../tools/csvparser.js",
"../../tools/consarray.js",
"../../tools/profile.js",
"../../tools/profile_view.js",
"../../tools/arguments.js",
"../../tools/logreader.js",
"log-eq-of-logging-and-traversal.js",
]
outputs = [
"$target_gen_dir/resources.cc",
]
args = [
rebase_path("$target_gen_dir/resources.cc", root_build_dir),
"TEST",
]
args += rebase_path(sources, root_build_dir)
}
v8_executable("generate-bytecode-expectations") {
testonly = true
......@@ -469,12 +437,3 @@ v8_executable("generate-bytecode-expectations") {
"//build/win:default_exe_manifest",
]
}
#Target to generate all .cc files.
group("v8_generated_cc_files") {
testonly = true
deps = [
":resources",
]
}
......@@ -48,9 +48,6 @@
# works as intended.
'test-api/DisallowJavascriptExecutionScope': [FAIL],
# TODO(gc): Temporarily disabled in the GC branch.
'test-log/EquivalenceOfLoggingAndTraversal': [PASS, FAIL],
# We do not yet shrink weak maps after they have been emptied by the GC
'test-weakmaps/Shrinking': [FAIL],
'test-weaksets/WeakSet_Shrinking': [FAIL],
......@@ -375,14 +372,6 @@
'test-code-generator/FuzzAssemble*': [PASS, ['(mode == debug) and optimize_for_size', SKIP]],
}], # 'system != android and arch in [arm, arm64] and not simulator_run'
##############################################################################
['system == aix and arch == ppc64', {
# BUG 2857
'test-log/EquivalenceOfLoggingAndTraversal' : [SKIP],
}], # 'system == aix and arch == ppc64'
##############################################################################
['system == aix or (arch == ppc64 and byteorder == big)', {
......
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This is a supplementary file for test-log/EquivalenceOfLoggingAndTraversal.
function parseState(s) {
switch (s) {
case "": return Profile.CodeState.COMPILED;
case "~": return Profile.CodeState.OPTIMIZABLE;
case "*": return Profile.CodeState.OPTIMIZED;
}
throw new Error("unknown code state: " + s);
}
function LogProcessor() {
LogReader.call(this, {
'code-creation': {
parsers: [parseString, parseInt, parseInt, parseInt, parseInt,
parseString, parseVarArgs],
processor: this.processCodeCreation },
'code-move': { parsers: [parseInt, parseInt],
processor: this.processCodeMove },
'code-delete': parseString,
'sfi-move': { parsers: [parseInt, parseInt],
processor: this.processFunctionMove },
'shared-library': parseString,
'profiler': parseString,
'tick': parseString });
this.profile = new Profile();
}
LogProcessor.prototype.__proto__ = LogReader.prototype;
LogProcessor.prototype.processCodeCreation = function(
type, kind, timestamp, start, size, name, maybe_func) {
if (type != "LazyCompile" && type != "Script" && type != "Function") {
return;
}
// Scripts will compile into anonymous functions starting at 1:1. Adjust the
// name here so that it matches corrsponding function's name during the heap
// traversal.
if (type == "Script") name = " :1:1";
// Discard types to avoid discrepancies in "LazyCompile" vs. "Function".
type = "";
if (maybe_func.length) {
var funcAddr = parseInt(maybe_func[0]);
var state = parseState(maybe_func[1]);
this.profile.addFuncCode(type, name, timestamp, start, size, funcAddr, state);
} else {
this.profile.addCode(type, name, timestamp, start, size);
}
};
LogProcessor.prototype.processCodeMove = function(from, to) {
this.profile.moveCode(from, to);
};
LogProcessor.prototype.processFunctionMove = function(from, to) {
this.profile.moveFunc(from, to);
};
function RunTest() {
// _log must be provided externally.
var log_lines = _log.split("\n");
var line, pos = 0, log_lines_length = log_lines.length;
if (log_lines_length < 2)
return "log_lines_length < 2";
var logging_processor = new LogProcessor();
for ( ; pos < log_lines_length; ++pos) {
line = log_lines[pos];
if (line === "test-logging-done,\"\"") {
++pos;
break;
}
logging_processor.processLogLine(line);
}
logging_processor.profile.cleanUpFuncEntries();
var logging_entries =
logging_processor.profile.codeMap_.getAllDynamicEntriesWithAddresses();
if (logging_entries.length === 0)
return "logging_entries.length === 0";
var traversal_processor = new LogProcessor();
for ( ; pos < log_lines_length; ++pos) {
line = log_lines[pos];
if (line === "test-traversal-done,\"\"") break;
traversal_processor.processLogLine(line);
}
var traversal_entries =
traversal_processor.profile.codeMap_.getAllDynamicEntriesWithAddresses();
if (traversal_entries.length === 0)
return "traversal_entries.length === 0";
function addressComparator(entryA, entryB) {
return entryA[0] < entryB[0] ? -1 : (entryA[0] > entryB[0] ? 1 : 0);
}
logging_entries.sort(addressComparator);
traversal_entries.sort(addressComparator);
function entityNamesEqual(entityA, entityB) {
if ("getRawName" in entityB &&
entityNamesEqual.builtins.indexOf(entityB.getRawName()) !== -1) {
return true;
}
if (entityNamesEqual.builtins.indexOf(entityB.getName()) !== -1) return true;
return entityA.getName() === entityB.getName();
}
entityNamesEqual.builtins =
["Boolean", "Function", "Number", "Object",
"Script", "String", "RegExp", "Date", "Error"];
function entitiesEqual(entityA, entityB) {
if ((entityA === null && entityB !== null) ||
(entityA !== null && entityB === null)) return true;
return entityA.size === entityB.size && entityNamesEqual(entityA, entityB);
}
var l_pos = 0, t_pos = 0;
var l_len = logging_entries.length, t_len = traversal_entries.length;
var comparison = [];
var equal = true;
// Do a merge-like comparison of entries. At the same address we expect to
// find the same entries. We skip builtins during log parsing, but compiled
// functions traversal may erroneously recognize them as functions, so we are
// expecting more functions in traversal vs. logging.
// Since we don't track code deletions, logging can also report more entries
// than traversal.
while (l_pos < l_len && t_pos < t_len) {
var entryA = logging_entries[l_pos];
var entryB = traversal_entries[t_pos];
var cmp = addressComparator(entryA, entryB);
var entityA = entryA[1], entityB = entryB[1];
var address = entryA[0];
if (cmp < 0) {
++l_pos;
entityB = null;
} else if (cmp > 0) {
++t_pos;
entityA = null;
address = entryB[0];
} else {
++l_pos;
++t_pos;
}
var entities_equal = entitiesEqual(entityA, entityB);
if (!entities_equal) equal = false;
comparison.push([entities_equal, address, entityA, entityB]);
}
return [equal, comparison];
}
var result = RunTest();
if (typeof result !== "string") {
var out = [];
if (!result[0]) {
var comparison = result[1];
for (var i = 0, l = comparison.length; i < l; ++i) {
var c = comparison[i];
out.push((c[0] ? " " : "* ") +
c[1].toString(16) + " " +
(c[2] ? c[2] : "---") + " " +
(c[3] ? c[3] : "---"));
}
out.push("================================================")
out.push("MAKE SURE TO USE A CLEAN ISOLATiE!");
out.push("Use tools/test.py");
out.push("================================================")
out.push("* Lines are the same");
out.push("--- Line is missing"
out.push("================================================")
}
result[0] ? true : out.join("\n");
} else {
result;
}
......@@ -433,75 +433,6 @@ UNINITIALIZED_TEST(LogAccessorCallbacks) {
isolate->Dispose();
}
// Test that logging of code create / move events is equivalent to traversal of
// a resulting heap.
UNINITIALIZED_TEST(EquivalenceOfLoggingAndTraversal) {
// This test needs to be run on a "clean" V8 to ensure that snapshot log
// is loaded. This is always true when running using tools/test.py because
// it launches a new cctest instance for every test. To be sure that launching
// cctest manually also works, please be sure that no tests below
// are using V8.
// Start with profiling to capture all code events from the beginning.
SETUP_FLAGS();
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
// Compile and run a function that creates other functions.
CompileRun(
"(function f(obj) {\n"
" obj.test =\n"
" (function a(j) { return function b() { return j; } })(100);\n"
"})(this);");
logger.logger()->StopProfilerThread();
CcTest::PreciseCollectAllGarbage();
logger.StringEvent("test-logging-done", "");
// Iterate heap to find compiled functions, will write to log.
logger.LogCompiledFunctions();
logger.StringEvent("test-traversal-done", "");
logger.StopLogging();
v8::Local<v8::String> log_str = logger.GetLogString();
logger.env()
->Global()
->Set(logger.env(), v8_str("_log"), log_str)
.FromJust();
// Load the Test snapshot's sources, see log-eq-of-logging-and-traversal.js
i::Vector<const char> source =
i::NativesCollection<i::TEST>::GetScriptsSource();
v8::Local<v8::String> source_str =
v8::String::NewFromUtf8(isolate, source.begin(),
v8::NewStringType::kNormal, source.length())
.ToLocalChecked();
v8::TryCatch try_catch(isolate);
v8::Local<v8::Script> script = CompileWithOrigin(source_str, "", false);
if (script.IsEmpty()) {
v8::String::Utf8Value exception(isolate, try_catch.Exception());
FATAL("compile: %s\n", *exception);
}
v8::Local<v8::Value> result;
if (!script->Run(logger.env()).ToLocal(&result)) {
v8::String::Utf8Value exception(isolate, try_catch.Exception());
FATAL("run: %s\n", *exception);
}
// The result either be the "true" literal or problem description.
if (!result->IsTrue()) {
v8::Local<v8::String> s = result->ToString(logger.env()).ToLocalChecked();
i::ScopedVector<char> data(s->Utf8Length(isolate) + 1);
CHECK(data.begin());
s->WriteUtf8(isolate, data.begin());
FATAL("%s\n", data.begin());
}
}
isolate->Dispose();
}
UNINITIALIZED_TEST(LogVersion) {
SETUP_FLAGS();
v8::Isolate::CreateParams create_params;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment