Commit a715e174 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Revert "[test] Add testing facility for SerializerForBackgroundCompilation"

This reverts commit acb60162.

Reason for revert: Breaks arm build - https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux%20-%20arm%20-%20sim%20-%20lite/2035

Original change's description:
> [test] Add testing facility for SerializerForBackgroundCompilation
> 
> R=​neis@chromium.org
> 
> Bug: v8:7790
> Change-Id: Id759112d0c780ff857eb094102245b38fcbb1709
> Reviewed-on: https://chromium-review.googlesource.com/c/1434375
> Reviewed-by: Georg Neis <neis@chromium.org>
> Commit-Queue: Maya Lekova <mslekova@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#59153}

TBR=neis@chromium.org,mslekova@chromium.org

Change-Id: I5e6a3b94a9b177242aebb582c5184bb35e999314
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7790
Reviewed-on: https://chromium-review.googlesource.com/c/1442232Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59154}
parent acb60162
......@@ -535,7 +535,7 @@ class PipelineImpl final {
std::unique_ptr<AssemblerBuffer> buffer = {});
// Step D. Run the code finalization pass.
MaybeHandle<Code> FinalizeCode(bool retire_broker = true);
MaybeHandle<Code> FinalizeCode();
// Step E. Install any code dependencies.
bool CommitDependencies(Handle<Code> code);
......@@ -2292,17 +2292,12 @@ MaybeHandle<Code> Pipeline::GenerateCodeForWasmHeapStub(
// static
MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
OptimizedCompilationInfo* info, Isolate* isolate,
JSHeapBroker** out_broker) {
OptimizedCompilationInfo* info, Isolate* isolate) {
ZoneStats zone_stats(isolate->allocator());
std::unique_ptr<PipelineStatistics> pipeline_statistics(
CreatePipelineStatistics(Handle<Script>::null(), info, isolate,
&zone_stats));
PipelineData data(&zone_stats, isolate, info, pipeline_statistics.get());
if (out_broker != nullptr) {
*out_broker = data.broker();
}
PipelineImpl pipeline(&data);
Linkage linkage(Linkage::ComputeIncoming(data.instruction_zone(), info));
......@@ -2312,7 +2307,7 @@ MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
if (!pipeline.OptimizeGraph(&linkage)) return MaybeHandle<Code>();
pipeline.AssembleCode(&linkage);
Handle<Code> code;
if (pipeline.FinalizeCode(out_broker == nullptr).ToHandle(&code) &&
if (pipeline.FinalizeCode().ToHandle(&code) &&
pipeline.CommitDependencies(code)) {
return code;
}
......@@ -2711,9 +2706,9 @@ std::ostream& operator<<(std::ostream& out, const BlockStartsAsJSON& s) {
return out;
}
MaybeHandle<Code> PipelineImpl::FinalizeCode(bool retire_broker) {
MaybeHandle<Code> PipelineImpl::FinalizeCode() {
PipelineData* data = this->data_;
if (data->broker() && retire_broker) {
if (data->broker()) {
data->broker()->Retire();
}
Run<FinalizeCodePhase>();
......
......@@ -32,7 +32,6 @@ namespace compiler {
class CallDescriptor;
class Graph;
class InstructionSequence;
class JSHeapBroker;
class MachineGraph;
class NodeOriginTable;
class Schedule;
......@@ -81,11 +80,8 @@ class Pipeline : public AllStatic {
// ---------------------------------------------------------------------------
// Run the pipeline on JavaScript bytecode and generate code.
// If requested, hands out the heap broker, which is allocated
// in {info}'s zone.
static MaybeHandle<Code> GenerateCodeForTesting(
OptimizedCompilationInfo* info, Isolate* isolate,
JSHeapBroker** out_broker = nullptr);
OptimizedCompilationInfo* info, Isolate* isolate);
// Run the pipeline on a machine graph and generate code. If {schedule} is
// {nullptr}, then compute a new schedule for code generation.
......
......@@ -64,8 +64,6 @@ v8_source_set("cctest_sources") {
"compiler/function-tester.cc",
"compiler/function-tester.h",
"compiler/graph-builder-tester.h",
"compiler/serializer-tester.cc",
"compiler/serializer-tester.h",
"compiler/test-basic-block-profiler.cc",
"compiler/test-branch-combine.cc",
"compiler/test-code-assembler.cc",
......
......@@ -29,11 +29,8 @@
#include "test/cctest/cctest.h"
#include "include/libplatform/libplatform.h"
#include "src/compiler.h"
#include "src/compiler/pipeline.h"
#include "src/debug/debug.h"
#include "src/objects-inl.h"
#include "src/optimized-compilation-info.h"
#include "src/trap-handler/trap-handler.h"
#include "test/cctest/print-extension.h"
#include "test/cctest/profiler-extension.h"
......@@ -225,36 +222,6 @@ HandleAndZoneScope::HandleAndZoneScope()
HandleAndZoneScope::~HandleAndZoneScope() = default;
i::Handle<i::JSFunction> Optimize(i::Handle<i::JSFunction> function,
i::Zone* zone, i::Isolate* isolate,
uint32_t flags,
i::compiler::JSHeapBroker** out_broker) {
i::Handle<i::SharedFunctionInfo> shared(function->shared(), isolate);
i::IsCompiledScope is_compiled_scope(shared->is_compiled_scope());
CHECK(is_compiled_scope.is_compiled() ||
i::Compiler::Compile(function, i::Compiler::CLEAR_EXCEPTION,
&is_compiled_scope));
CHECK_NOT_NULL(zone);
i::OptimizedCompilationInfo info(zone, isolate, shared, function);
if (flags & i::OptimizedCompilationInfo::kInliningEnabled) {
info.MarkAsInliningEnabled();
}
CHECK(info.shared_info()->HasBytecodeArray());
i::JSFunction::EnsureFeedbackVector(function);
i::Handle<i::Code> code =
i::compiler::Pipeline::GenerateCodeForTesting(&info, isolate, out_broker)
.ToHandleChecked();
info.native_context()->AddOptimizedCode(*code);
function->set_code(*code);
return function;
}
static void PrintTestList(CcTest* current) {
if (current == nullptr) return;
PrintTestList(current->prev());
......
......@@ -56,12 +56,6 @@ const auto GetRegConfig = RegisterConfiguration::Default;
class HandleScope;
class Zone;
namespace compiler {
class JSHeapBroker;
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -493,13 +487,7 @@ static inline v8::Local<v8::Value> CompileRunWithOrigin(
return CompileRunWithOrigin(v8_str(source), origin_url);
}
// Takes a JSFunction and runs it through the test version of the optimizing
// pipeline, allocating the temporary compilation artifacts in a given Zone.
// For possible {flags} values, look at OptimizedCompilationInfo::Flag.
// If passed a non-null pointer for {broker}, outputs the JSHeapBroker to it.
i::Handle<i::JSFunction> Optimize(
i::Handle<i::JSFunction> function, i::Zone* zone, i::Isolate* isolate,
uint32_t flags, i::compiler::JSHeapBroker** out_broker = nullptr);
static inline void ExpectString(const char* code, const char* expected) {
v8::Local<v8::Value> result = CompileRun(code);
......
......@@ -6,6 +6,7 @@
#include "src/api-inl.h"
#include "src/assembler.h"
#include "src/compiler.h"
#include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h"
#include "src/execution.h"
......@@ -141,8 +142,27 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph,
}
Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
IsCompiledScope is_compiled_scope(shared->is_compiled_scope());
CHECK(is_compiled_scope.is_compiled() ||
Compiler::Compile(function, Compiler::CLEAR_EXCEPTION,
&is_compiled_scope));
Zone zone(isolate->allocator(), ZONE_NAME);
return Optimize(function, &zone, isolate, flags_);
OptimizedCompilationInfo info(&zone, isolate, shared, function);
if (flags_ & OptimizedCompilationInfo::kInliningEnabled) {
info.MarkAsInliningEnabled();
}
CHECK(info.shared_info()->HasBytecodeArray());
JSFunction::EnsureFeedbackVector(function);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, isolate).ToHandleChecked();
info.native_context()->AddOptimizedCode(*code);
function->set_code(*code);
return function;
}
// Compile the given machine graph instead of the source of the function
......
// 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.
#include "test/cctest/compiler/serializer-tester.h"
#include "src/api-inl.h"
#include "src/compiler/serializer-for-background-compilation.h"
#include "src/compiler/zone-stats.h"
#include "src/zone/zone.h"
namespace v8 {
namespace internal {
namespace compiler {
SerializerTester::SerializerTester(const char* source)
: canonical_(main_isolate()) {
FLAG_concurrent_inlining = true;
Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Local<v8::Function>::Cast(CompileRun(source))));
Optimize(function, main_zone(), main_isolate(), 0, &broker_);
function_ = JSFunctionRef(broker_, function);
}
TEST(SerializeEmptyFunction) {
SerializerTester tester("(function() { function f() {}; return f; })();");
CHECK(tester.function().shared().IsSerializedForCompilation(
tester.function().feedback_vector()));
}
} // namespace compiler
} // namespace internal
} // namespace v8
// 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.
#ifndef V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
#define V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
#include "src/compiler/js-heap-broker.h"
#include "test/cctest/cctest.h"
namespace v8 {
namespace internal {
namespace compiler {
class ZoneStats;
class SerializerTester : public HandleAndZoneScope {
public:
explicit SerializerTester(const char* source);
JSFunctionRef function() const { return function_.value(); }
private:
CanonicalHandleScope canonical_;
base::Optional<JSFunctionRef> function_;
JSHeapBroker* broker_ = nullptr;
};
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
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