[test] Move cctest/interpreter to unittests

... /interpreter.

This CL moves cctest/interpreter/{bytecode-expectations-printer,
test-bytecode-generator, test-interpreter-intrinsics,
interpreter-tester, test-interpreter, test-source-positions,
source-position-matcher} to unittests/interpreter/{
bytecode-expectations-printer, bytecode-generator-unittest,
interpreter-intrinsics-unittest, interpreter-tester,
interpreter-unittest, source-positions-unittest, source-position-matcher}.

Bug: v8:12781
Change-Id: I187583bd34f709dd0d7dfc0f92e18f191da0e30f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3609752
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81057}
This commit is contained in:
jameslahm 2022-06-10 12:16:39 +08:00 committed by V8 LUCI CQ
parent 04c1cbb8c9
commit b3d004aaf9
111 changed files with 1328 additions and 1793 deletions

View File

@ -32,7 +32,7 @@
"type": "script",
},
"generate-bytecode-expectations": {
"label": "//test/cctest:generate-bytecode-expectations",
"label": "//test/unittests:generate-bytecode-expectations",
"type": "script",
},
"mjsunit": {

View File

@ -41,7 +41,7 @@ group("gn_all") {
deps += [
"benchmarks/cpp:gn_all",
"cctest:cctest",
"cctest:generate-bytecode-expectations",
"unittests:generate-bytecode-expectations",
"unittests:unittests",
]
}

View File

@ -23,7 +23,6 @@ v8_executable("cctest") {
data = [
"testcfg.py",
"cctest.status",
"interpreter/bytecode_expectations/",
]
configs = [
@ -149,16 +148,6 @@ v8_source_set("cctest_sources") {
"heap/test-unmapper.cc",
"heap/test-weak-references.cc",
"heap/test-write-barrier.cc",
"interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h",
"interpreter/interpreter-tester.cc",
"interpreter/interpreter-tester.h",
"interpreter/source-position-matcher.cc",
"interpreter/source-position-matcher.h",
"interpreter/test-bytecode-generator.cc",
"interpreter/test-interpreter-intrinsics.cc",
"interpreter/test-interpreter.cc",
"interpreter/test-source-positions.cc",
"manually-externalized-buffer.h",
"parsing/test-preparser.cc",
"print-extension.cc",
@ -450,28 +439,3 @@ v8_source_set("cctest_sources") {
]
}
}
v8_executable("generate-bytecode-expectations") {
testonly = true
sources = [
"interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h",
"interpreter/generate-bytecode-expectations.cc",
]
configs = [
"../..:external_config",
"../..:internal_config_base",
]
deps = [
":cctest_headers",
"../..:v8",
"../..:v8_libbase",
"../..:v8_libplatform",
"//build/win:default_exe_manifest",
]
data = [ "interpreter/bytecode_expectations/" ]
}

View File

@ -511,9 +511,6 @@
}], # 'arch == ppc or arch == ppc64 or arch == s390 or arch == s390x'
['arch == ppc64', {
# https://crbug.com/v8/8766
'test-bytecode-generator/WideRegisters': [SKIP],
# SIMD / Liftoff not fully implemented yet
'test-run-wasm-simd-liftoff/*': [SKIP],
'test-gc/RunWasmLiftoff_RefTrivialCasts': [SKIP],
@ -673,7 +670,6 @@
# --interpreted-frames-native-stack tests
'test-serialize/CodeSerializerOnePlusOneWithInterpretedFramesNativeStack': [SKIP],
'test-interpreter/InterpreterWithNativeStack': [SKIP],
# Crashes on native arm.
'test-macro-assembler-arm/ExtractLane': [PASS, ['arch == arm and not simulator_run', SKIP]],

View File

@ -192,6 +192,7 @@ v8_executable("unittests") {
data_deps = [ "../../tools:v8_testrunner" ]
data = [
"interpreter/bytecode_expectations/",
"testcfg.py",
"unittests.status",
]
@ -377,6 +378,9 @@ v8_source_set("unittests_sources") {
"interpreter/bytecode-array-random-iterator-unittest.cc",
"interpreter/bytecode-array-writer-unittest.cc",
"interpreter/bytecode-decoder-unittest.cc",
"interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h",
"interpreter/bytecode-generator-unittest.cc",
"interpreter/bytecode-node-unittest.cc",
"interpreter/bytecode-operands-unittest.cc",
"interpreter/bytecode-register-allocator-unittest.cc",
@ -387,6 +391,13 @@ v8_source_set("unittests_sources") {
"interpreter/constant-array-builder-unittest.cc",
"interpreter/interpreter-assembler-unittest.cc",
"interpreter/interpreter-assembler-unittest.h",
"interpreter/interpreter-intrinsics-unittest.cc",
"interpreter/interpreter-tester.cc",
"interpreter/interpreter-tester.h",
"interpreter/interpreter-unittest.cc",
"interpreter/source-position-matcher.cc",
"interpreter/source-position-matcher.h",
"interpreter/source-positions-unittest.cc",
"js-atomics/js-atomics-mutex-unittest.cc",
"libplatform/default-job-unittest.cc",
"libplatform/default-platform-unittest.cc",
@ -626,3 +637,27 @@ v8_source_set("unittests_sources") {
sources += [ "avoid-windows-h-includes.cc" ]
}
}
v8_executable("generate-bytecode-expectations") {
testonly = true
sources = [
"interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h",
"interpreter/generate-bytecode-expectations.cc",
]
configs = [
"../..:external_config",
"../..:internal_config_base",
]
deps = [
"../..:v8",
"../..:v8_libbase",
"../..:v8_libplatform",
"//build/win:default_exe_manifest",
]
data = [ "interpreter/bytecode_expectations/" ]
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "test/cctest/interpreter/bytecode-expectations-printer.h"
#include "test/unittests/interpreter/bytecode-expectations-printer.h"
#include <iomanip>
#include <iostream>
@ -23,7 +23,6 @@
#include "src/objects/objects-inl.h"
#include "src/runtime/runtime.h"
#include "src/utils/ostreams.h"
#include "test/cctest/cctest.h"
namespace v8 {
namespace internal {
@ -121,8 +120,14 @@ BytecodeExpectationsPrinter::GetBytecodeArrayForScript(
i::Handle<i::BytecodeArray>
BytecodeExpectationsPrinter::GetBytecodeArrayOfCallee(
const char* source_code) const {
Local<v8::Context> context = isolate_->GetCurrentContext();
Local<v8::Script> script =
v8::Script::Compile(
context,
v8::String::NewFromUtf8(isolate_, source_code).ToLocalChecked())
.ToLocalChecked();
i::Handle<i::Object> i_object =
v8::Utils::OpenHandle(*CompileRun(source_code));
v8::Utils::OpenHandle(*script->Run(context).ToLocalChecked());
i::Handle<i::JSFunction> js_function =
i::Handle<i::JSFunction>::cast(i_object);
CHECK(js_function->shared().HasBytecodeArray());

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_
#define TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_
#ifndef TEST_UNITTESTS_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_
#define TEST_UNITTESTS_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_
#include <iostream>
#include <string>
@ -119,4 +119,4 @@ class BytecodeExpectationsPrinter final {
} // namespace internal
} // namespace v8
#endif // TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_
#endif // TEST_UNITTESTS_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_

Some files were not shown because too many files have changed in this diff Show More