Commit aafdfba8 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Compiler] Remove isolate from CompilationInfo.

Removes Isolate from compilation info and instead threads isolate through
function calls. This ensures that we can't access the isolate from
background thread compilations.

BUG=v8:5203

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I9a4e1cd67c4736e36f609360b996fb55166a1c50
Reviewed-on: https://chromium-review.googlesource.com/751745
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49386}
parent 1031b5e7
......@@ -186,61 +186,66 @@ void ReportInstantiationFailure(Handle<Script> script, int position,
class AsmJsCompilationJob final : public CompilationJob {
public:
explicit AsmJsCompilationJob(ParseInfo* parse_info, FunctionLiteral* literal,
Isolate* isolate)
AccountingAllocator* allocator)
: CompilationJob(parse_info->stack_limit(), parse_info,
&compilation_info_, "AsmJs", State::kReadyToExecute),
zone_(isolate->allocator(), ZONE_NAME),
compilation_info_(&zone_, isolate, parse_info, literal),
allocator_(allocator),
zone_(allocator, ZONE_NAME),
compilation_info_(&zone_, parse_info, literal),
module_(nullptr),
asm_offsets_(nullptr),
translate_time_(0),
compile_time_(0) {}
compile_time_(0),
module_source_size_(0),
translate_time_micro_(0),
translate_zone_size_(0) {}
protected:
Status PrepareJobImpl() final;
Status PrepareJobImpl(Isolate* isolate) final;
Status ExecuteJobImpl() final;
Status FinalizeJobImpl() final;
Status FinalizeJobImpl(Isolate* isolate) final;
private:
void RecordHistograms(Isolate* isolate);
AccountingAllocator* allocator_;
Zone zone_;
CompilationInfo compilation_info_;
wasm::ZoneBuffer* module_;
wasm::ZoneBuffer* asm_offsets_;
wasm::AsmJsParser::StdlibSet stdlib_uses_;
double translate_time_; // Time (milliseconds) taken to execute step [1].
double compile_time_; // Time (milliseconds) taken to execute step [2].
double translate_time_; // Time (milliseconds) taken to execute step [1].
double compile_time_; // Time (milliseconds) taken to execute step [2].
int module_source_size_; // Module source size in bytes.
int64_t translate_time_micro_; // Time (microseconds) taken to translate.
size_t translate_zone_size_;
DISALLOW_COPY_AND_ASSIGN(AsmJsCompilationJob);
};
CompilationJob::Status AsmJsCompilationJob::PrepareJobImpl() {
CompilationJob::Status AsmJsCompilationJob::PrepareJobImpl(Isolate* isolate) {
UNREACHABLE(); // Prepare should always be skipped.
return SUCCEEDED;
}
CompilationJob::Status AsmJsCompilationJob::ExecuteJobImpl() {
// Step 1: Translate asm.js module to WebAssembly module.
HistogramTimerScope translate_time_scope(
compilation_info()->isolate()->counters()->asm_wasm_translation_time());
size_t compile_zone_start = compilation_info()->zone()->allocation_size();
base::ElapsedTimer translate_timer;
translate_timer.Start();
Zone* compile_zone = compilation_info()->zone();
Zone translate_zone(compilation_info()->isolate()->allocator(), ZONE_NAME);
Zone translate_zone(allocator_, ZONE_NAME);
Utf16CharacterStream* stream = parse_info()->character_stream();
base::Optional<AllowHandleDereference> allow_deref;
if (stream->can_access_heap()) {
DCHECK(
ThreadId::Current().Equals(compilation_info()->isolate()->thread_id()));
allow_deref.emplace();
}
stream->Seek(compilation_info()->literal()->start_position());
wasm::AsmJsParser parser(&translate_zone, stack_limit(), stream);
if (!parser.Run()) {
DCHECK(!compilation_info()->isolate()->has_pending_exception());
if (!FLAG_suppress_asm_messages) {
ReportCompilationFailure(parse_info(), parser.failure_location(),
parser.failure_message());
......@@ -255,52 +260,32 @@ CompilationJob::Status AsmJsCompilationJob::ExecuteJobImpl() {
size_t compile_zone_size =
compilation_info()->zone()->allocation_size() - compile_zone_start;
size_t translate_zone_size = translate_zone.allocation_size();
compilation_info()
->isolate()
->counters()
->asm_wasm_translation_peak_memory_bytes()
->AddSample(static_cast<int>(translate_zone_size));
translate_zone_size_ = translate_zone.allocation_size();
translate_time_ = translate_timer.Elapsed().InMillisecondsF();
int module_size = compilation_info()->literal()->end_position() -
compilation_info()->literal()->start_position();
compilation_info()->isolate()->counters()->asm_module_size_bytes()->AddSample(
module_size);
int64_t translation_time_micro = translate_timer.Elapsed().InMicroseconds();
// translation_throughput is not exact (assumes MB == 1000000). But that is ok
// since the metric is stored in buckets that lose some precision anyways.
int translation_throughput =
translation_time_micro != 0
? static_cast<int>(static_cast<int64_t>(module_size) /
translation_time_micro)
: 0;
compilation_info()
->isolate()
->counters()
->asm_wasm_translation_throughput()
->AddSample(translation_throughput);
translate_time_micro_ = translate_timer.Elapsed().InMicroseconds();
module_source_size_ = compilation_info()->literal()->end_position() -
compilation_info()->literal()->start_position();
if (FLAG_trace_asm_parser) {
PrintF(
"[asm.js translation successful: time=%0.3fms, "
"translate_zone=%" PRIuS "KB, compile_zone+=%" PRIuS "KB]\n",
translate_time_, translate_zone_size / KB, compile_zone_size / KB);
translate_time_, translate_zone_size_ / KB, compile_zone_size / KB);
}
return SUCCEEDED;
}
CompilationJob::Status AsmJsCompilationJob::FinalizeJobImpl() {
CompilationJob::Status AsmJsCompilationJob::FinalizeJobImpl(Isolate* isolate) {
// Step 2: Compile and decode the WebAssembly module.
base::ElapsedTimer compile_timer;
compile_timer.Start();
Handle<HeapNumber> uses_bitset =
compilation_info()->isolate()->factory()->NewHeapNumberFromBits(
stdlib_uses_.ToIntegral());
isolate->factory()->NewHeapNumberFromBits(stdlib_uses_.ToIntegral());
wasm::ErrorThrower thrower(compilation_info()->isolate(), "AsmJs::Compile");
wasm::ErrorThrower thrower(isolate, "AsmJs::Compile");
Handle<WasmModuleObject> compiled =
SyncCompileTranslatedAsmJs(
compilation_info()->isolate(), &thrower,
isolate, &thrower,
wasm::ModuleWireBytes(module_->begin(), module_->end()),
parse_info()->script(),
Vector<const byte>(asm_offsets_->begin(), asm_offsets_->size()))
......@@ -310,24 +295,41 @@ CompilationJob::Status AsmJsCompilationJob::FinalizeJobImpl() {
// The result is a compiled module and serialized standard library uses.
Handle<FixedArray> result =
compilation_info()->isolate()->factory()->NewFixedArray(
kWasmDataEntryCount);
isolate->factory()->NewFixedArray(kWasmDataEntryCount);
result->set(kWasmDataCompiledModule, *compiled);
result->set(kWasmDataUsesBitSet, *uses_bitset);
compilation_info()->SetAsmWasmData(result);
compilation_info()->SetCode(
BUILTIN_CODE(compilation_info()->isolate(), InstantiateAsmJs));
compilation_info()->SetCode(BUILTIN_CODE(isolate, InstantiateAsmJs));
RecordHistograms(isolate);
ReportCompilationSuccess(parse_info()->script(),
compilation_info()->literal()->position(),
translate_time_, compile_time_, module_->size());
return SUCCEEDED;
}
void AsmJsCompilationJob::RecordHistograms(Isolate* isolate) {
Counters* counters = isolate->counters();
counters->asm_wasm_translation_time()->AddSample(
static_cast<int>(translate_time_micro_));
counters->asm_wasm_translation_peak_memory_bytes()->AddSample(
static_cast<int>(translate_zone_size_));
counters->asm_module_size_bytes()->AddSample(module_source_size_);
// translation_throughput is not exact (assumes MB == 1000000). But that is ok
// since the metric is stored in buckets that lose some precision anyways.
int translation_throughput =
translate_time_micro_ != 0
? static_cast<int>(static_cast<int64_t>(module_source_size_) /
translate_time_micro_)
: 0;
counters->asm_wasm_translation_throughput()->AddSample(
translation_throughput);
}
CompilationJob* AsmJs::NewCompilationJob(ParseInfo* parse_info,
FunctionLiteral* literal,
Isolate* isolate) {
return new AsmJsCompilationJob(parse_info, literal, isolate);
AccountingAllocator* allocator) {
return new AsmJsCompilationJob(parse_info, literal, allocator);
}
MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
......
......@@ -12,6 +12,7 @@
namespace v8 {
namespace internal {
class AccountingAllocator;
class CompilationInfo;
class CompilationJob;
class FunctionLiteral;
......@@ -24,7 +25,7 @@ class AsmJs {
public:
static CompilationJob* NewCompilationJob(ParseInfo* parse_info,
FunctionLiteral* literal,
Isolate* isolate);
AccountingAllocator* allocator);
static MaybeHandle<Object> InstantiateAsmWasm(Isolate* isolate,
Handle<SharedFunctionInfo>,
Handle<FixedArray> wasm_data,
......
......@@ -19,10 +19,9 @@ namespace internal {
// TODO(mvstanton): the Code::OPTIMIZED_FUNCTION constant below is
// bogus, it's just that I've eliminated Code::FUNCTION and there isn't
// a "better" value to put in this place.
CompilationInfo::CompilationInfo(Zone* zone, Isolate* isolate,
ParseInfo* parse_info,
CompilationInfo::CompilationInfo(Zone* zone, ParseInfo* parse_info,
FunctionLiteral* literal)
: CompilationInfo({}, Code::OPTIMIZED_FUNCTION, BASE, isolate, zone) {
: CompilationInfo({}, Code::OPTIMIZED_FUNCTION, BASE, zone) {
// NOTE: The parse_info passed here represents the global information gathered
// during parsing, but does not represent specific details of the actual
// function literal being compiled for this CompilationInfo. As such,
......@@ -40,10 +39,11 @@ CompilationInfo::CompilationInfo(Zone* zone, Isolate* isolate,
CompilationInfo::CompilationInfo(Zone* zone, Isolate* isolate,
Handle<SharedFunctionInfo> shared,
Handle<JSFunction> closure)
: CompilationInfo({}, Code::OPTIMIZED_FUNCTION, OPTIMIZE, isolate, zone) {
: CompilationInfo({}, Code::OPTIMIZED_FUNCTION, OPTIMIZE, zone) {
shared_info_ = shared;
closure_ = closure;
optimization_id_ = isolate->NextOptimizationId();
dependencies_.reset(new CompilationDependencies(isolate, zone));
if (FLAG_function_context_specialization) MarkAsFunctionContextSpecializing();
if (FLAG_turbo_splitting) MarkAsSplittingEnabled();
......@@ -51,21 +51,18 @@ CompilationInfo::CompilationInfo(Zone* zone, Isolate* isolate,
// Collect source positions for optimized code when profiling or if debugger
// is active, to be able to get more precise source positions at the price of
// more memory consumption.
if (isolate_->NeedsSourcePositionsForProfiling()) {
if (isolate->NeedsSourcePositionsForProfiling()) {
MarkAsSourcePositionsEnabled();
}
}
CompilationInfo::CompilationInfo(Vector<const char> debug_name,
Isolate* isolate, Zone* zone,
CompilationInfo::CompilationInfo(Vector<const char> debug_name, Zone* zone,
Code::Kind code_kind)
: CompilationInfo(debug_name, code_kind, STUB, isolate, zone) {}
: CompilationInfo(debug_name, code_kind, STUB, zone) {}
CompilationInfo::CompilationInfo(Vector<const char> debug_name,
Code::Kind code_kind, Mode mode,
Isolate* isolate, Zone* zone)
: isolate_(isolate),
literal_(nullptr),
Code::Kind code_kind, Mode mode, Zone* zone)
: literal_(nullptr),
source_range_map_(nullptr),
flags_(0),
code_kind_(code_kind),
......@@ -75,7 +72,7 @@ CompilationInfo::CompilationInfo(Vector<const char> debug_name,
feedback_vector_spec_(zone),
zone_(zone),
deferred_handles_(nullptr),
dependencies_(isolate, zone),
dependencies_(nullptr),
bailout_reason_(kNoReason),
parameter_count_(0),
optimization_id_(-1),
......@@ -85,7 +82,9 @@ CompilationInfo::~CompilationInfo() {
if (GetFlag(kDisableFutureOptimization) && has_shared_info()) {
shared_info()->DisableOptimization(bailout_reason());
}
dependencies()->Rollback();
if (dependencies()) {
dependencies()->Rollback();
}
}
DeclarationScope* CompilationInfo::scope() const {
......
......@@ -32,6 +32,8 @@ class Zone;
// CompilationInfo encapsulates some information known at compile time. It
// is constructed based on the resources available at compile-time.
// TODO(rmcilroy): Split CompilationInfo into two classes, one for unoptimized
// compilation and one for optimized compilation, since they don't share much.
class V8_EXPORT_PRIVATE CompilationInfo final {
public:
// Various configuration flags for a compilation, as well as some properties
......@@ -51,14 +53,13 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
};
// Construct a compilation info for unoptimized compilation.
CompilationInfo(Zone* zone, Isolate* isolate, ParseInfo* parse_info,
FunctionLiteral* literal);
CompilationInfo(Zone* zone, ParseInfo* parse_info, FunctionLiteral* literal);
// Construct a compilation info for optimized compilation.
CompilationInfo(Zone* zone, Isolate* isolate,
Handle<SharedFunctionInfo> shared,
Handle<JSFunction> closure);
// Construct a compilation info for stub compilation (or testing).
CompilationInfo(Vector<const char> debug_name, Isolate* isolate, Zone* zone,
CompilationInfo(Vector<const char> debug_name, Zone* zone,
Code::Kind code_kind);
~CompilationInfo();
......@@ -76,7 +77,6 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
DeclarationScope* scope() const;
Isolate* isolate() const { return isolate_; }
Zone* zone() { return zone_; }
bool is_osr() const { return !osr_offset_.IsNone(); }
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
......@@ -205,7 +205,7 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
BailoutReason bailout_reason() const { return bailout_reason_; }
CompilationDependencies* dependencies() { return &dependencies_; }
CompilationDependencies* dependencies() { return dependencies_.get(); }
int optimization_id() const {
DCHECK(IsOptimizing());
......@@ -260,7 +260,7 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
enum Mode { BASE, OPTIMIZE, STUB };
CompilationInfo(Vector<const char> debug_name, Code::Kind code_kind,
Mode mode, Isolate* isolate, Zone* zone);
Mode mode, Zone* zone);
void SetMode(Mode mode) { mode_ = mode; }
......@@ -272,7 +272,6 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
bool GetFlag(Flag flag) const { return (flags_ & flag) != 0; }
Isolate* isolate_;
FunctionLiteral* literal_;
SourceRangeMap* source_range_map_; // Used when block coverage is enabled.
......@@ -310,7 +309,7 @@ class V8_EXPORT_PRIVATE CompilationInfo final {
std::shared_ptr<DeferredHandles> deferred_handles_;
// Dependencies for this compilation, e.g. stable maps.
CompilationDependencies dependencies_;
std::unique_ptr<CompilationDependencies> dependencies_;
BailoutReason bailout_reason_;
......
......@@ -206,7 +206,7 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() {
}
DisposeCompilationJob(job, false);
} else {
Compiler::FinalizeCompilationJob(job);
Compiler::FinalizeCompilationJob(job, isolate_);
}
}
}
......
......@@ -362,7 +362,7 @@ void UnoptimizedCompileJob::PrepareToCompileOnMainThread(Isolate* isolate) {
COMPILER_DISPATCHER_TRACE_SCOPE(tracer_, kPrepareToCompile);
compilation_job_.reset(interpreter::Interpreter::NewCompilationJob(
parse_info_.get(), parse_info_->literal(), isolate));
parse_info_.get(), parse_info_->literal(), isolate->allocator()));
if (!compilation_job_.get()) {
if (!isolate->has_pending_exception()) isolate->StackOverflow();
......@@ -413,7 +413,8 @@ void UnoptimizedCompileJob::FinalizeCompilingOnMainThread(Isolate* isolate) {
AnalyzeMode::kRegular);
compilation_job_->compilation_info()->set_shared_info(shared_);
if (compilation_job_->state() == CompilationJob::State::kFailed ||
!Compiler::FinalizeCompilationJob(compilation_job_.release())) {
!Compiler::FinalizeCompilationJob(compilation_job_.release(),
isolate)) {
if (!isolate->has_pending_exception()) isolate->StackOverflow();
status_ = Status::kFailed;
return;
......
This diff is collapsed.
......@@ -64,7 +64,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
CompilationJobList* inner_function_jobs);
// Generate and install code from previously queued compilation job.
static bool FinalizeCompilationJob(CompilationJob* job);
static bool FinalizeCompilationJob(CompilationJob* job, Isolate* isolate);
// Give the compiler a chance to perform low-latency initialization tasks of
// the given {function} on its instantiation. Note that only the runtime will
......@@ -184,14 +184,14 @@ class V8_EXPORT_PRIVATE CompilationJob {
virtual ~CompilationJob() {}
// Prepare the compile job. Must be called on the main thread.
MUST_USE_RESULT Status PrepareJob();
MUST_USE_RESULT Status PrepareJob(Isolate* isolate);
// Executes the compile job. Can be called on a background thread if
// can_execute_on_background_thread() returns true.
MUST_USE_RESULT Status ExecuteJob();
// Finalizes the compile job. Must be called on the main thread.
MUST_USE_RESULT Status FinalizeJob();
MUST_USE_RESULT Status FinalizeJob(Isolate* isolate);
// Report a transient failure, try again next time. Should only be called on
// optimization compilation jobs.
......@@ -202,8 +202,9 @@ class V8_EXPORT_PRIVATE CompilationJob {
Status AbortOptimization(BailoutReason reason);
void RecordOptimizedCompilationStats() const;
void RecordUnoptimizedCompilationStats() const;
void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag) const;
void RecordUnoptimizedCompilationStats(Isolate* isolate) const;
void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
Isolate* isolate) const;
void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; }
uintptr_t stack_limit() const { return stack_limit_; }
......@@ -215,9 +216,9 @@ class V8_EXPORT_PRIVATE CompilationJob {
protected:
// Overridden by the actual implementation.
virtual Status PrepareJobImpl() = 0;
virtual Status PrepareJobImpl(Isolate* isolate) = 0;
virtual Status ExecuteJobImpl() = 0;
virtual Status FinalizeJobImpl() = 0;
virtual Status FinalizeJobImpl(Isolate* isolate) = 0;
private:
// TODO(6409): Remove parse_info once Fullcode and AstGraphBuilder are gone.
......
......@@ -47,14 +47,13 @@ static const Operator* PointerConstant(CommonOperatorBuilder* common,
static_cast<int32_t>(reinterpret_cast<intptr_t>(ptr)));
}
BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument(
CompilationInfo* info, Graph* graph, Schedule* schedule) {
CompilationInfo* info, Graph* graph, Schedule* schedule, Isolate* isolate) {
// Skip the exit block in profiles, since the register allocator can't handle
// it and entry into it means falling off the end of the function anyway.
size_t n_blocks = static_cast<size_t>(schedule->RpoBlockCount()) - 1;
BasicBlockProfiler::Data* data =
info->isolate()->GetOrCreateBasicBlockProfiler()->NewData(n_blocks);
isolate->GetOrCreateBasicBlockProfiler()->NewData(n_blocks);
// Set the function name.
if (info->has_shared_info()) {
std::ostringstream os;
......
......@@ -21,7 +21,8 @@ class Schedule;
class BasicBlockInstrumentor : public AllStatic {
public:
static BasicBlockProfiler::Data* Instrument(CompilationInfo* info,
Graph* graph, Schedule* schedule);
Graph* graph, Schedule* schedule,
Isolate* isolate);
};
} // namespace compiler
......
......@@ -38,11 +38,12 @@ class CodeGenerator::JumpTable final : public ZoneObject {
CodeGenerator::CodeGenerator(
Zone* codegen_zone, Frame* frame, Linkage* linkage,
InstructionSequence* code, CompilationInfo* info,
InstructionSequence* code, CompilationInfo* info, Isolate* isolate,
base::Optional<OsrHelper> osr_helper, int start_source_position,
JumpOptimizationInfo* jump_opt,
std::vector<trap_handler::ProtectedInstructionData>* protected_instructions)
: zone_(codegen_zone),
isolate_(isolate),
frame_access_state_(nullptr),
linkage_(linkage),
code_(code),
......@@ -52,7 +53,7 @@ CodeGenerator::CodeGenerator(
current_block_(RpoNumber::Invalid()),
start_source_position_(start_source_position),
current_source_position_(SourcePosition::Unknown()),
tasm_(info->isolate(), nullptr, 0, CodeObjectRequired::kNo),
tasm_(isolate, nullptr, 0, CodeObjectRequired::kNo),
resolver_(this),
safepoints_(zone()),
handlers_(zone()),
......@@ -80,8 +81,6 @@ CodeGenerator::CodeGenerator(
tasm_.set_jump_optimization_info(jump_opt);
}
Isolate* CodeGenerator::isolate() const { return info_->isolate(); }
void CodeGenerator::AddProtectedInstructionLanding(uint32_t instr_offset,
uint32_t landing_offset) {
if (protected_instructions_ != nullptr) {
......@@ -603,16 +602,16 @@ void CodeGenerator::AssembleGaps(Instruction* instr) {
namespace {
Handle<PodArray<InliningPosition>> CreateInliningPositions(
CompilationInfo* info) {
CompilationInfo* info, Isolate* isolate) {
const CompilationInfo::InlinedFunctionList& inlined_functions =
info->inlined_functions();
if (inlined_functions.size() == 0) {
return Handle<PodArray<InliningPosition>>::cast(
info->isolate()->factory()->empty_byte_array());
isolate->factory()->empty_byte_array());
}
Handle<PodArray<InliningPosition>> inl_positions =
PodArray<InliningPosition>::New(
info->isolate(), static_cast<int>(inlined_functions.size()), TENURED);
isolate, static_cast<int>(inlined_functions.size()), TENURED);
for (size_t i = 0; i < inlined_functions.size(); ++i) {
inl_positions->set(static_cast<int>(i), inlined_functions[i].position);
}
......@@ -652,7 +651,8 @@ Handle<DeoptimizationData> CodeGenerator::GenerateDeoptimizationData() {
}
data->SetLiteralArray(*literals);
Handle<PodArray<InliningPosition>> inl_pos = CreateInliningPositions(info);
Handle<PodArray<InliningPosition>> inl_pos =
CreateInliningPositions(info, isolate());
data->SetInliningPositions(*inl_pos);
if (info->is_osr()) {
......
......@@ -79,7 +79,7 @@ class CodeGenerator final : public GapResolver::Assembler {
public:
explicit CodeGenerator(Zone* codegen_zone, Frame* frame, Linkage* linkage,
InstructionSequence* code, CompilationInfo* info,
base::Optional<OsrHelper> osr_helper,
Isolate* isolate, base::Optional<OsrHelper> osr_helper,
int start_source_position,
JumpOptimizationInfo* jump_opt,
std::vector<trap_handler::ProtectedInstructionData>*
......@@ -94,7 +94,7 @@ class CodeGenerator final : public GapResolver::Assembler {
InstructionSequence* code() const { return code_; }
FrameAccessState* frame_access_state() const { return frame_access_state_; }
const Frame* frame() const { return frame_access_state_->frame(); }
Isolate* isolate() const;
Isolate* isolate() const { return isolate_; }
Linkage* linkage() const { return linkage_; }
Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; }
......@@ -319,6 +319,7 @@ class CodeGenerator final : public GapResolver::Assembler {
friend class CodeGeneratorTester;
Zone* zone_;
Isolate* isolate_;
FrameAccessState* frame_access_state_;
Linkage* const linkage_;
InstructionSequence* const code_;
......
......@@ -45,9 +45,9 @@ void PipelineStatistics::CommonStats::End(
timer_.Stop();
}
PipelineStatistics::PipelineStatistics(CompilationInfo* info,
PipelineStatistics::PipelineStatistics(CompilationInfo* info, Isolate* isolate,
ZoneStats* zone_stats)
: isolate_(info->isolate()),
: isolate_(isolate),
outer_zone_(info->zone()),
zone_stats_(zone_stats),
compilation_stats_(isolate_->GetTurboStatistics()),
......
......@@ -20,7 +20,8 @@ class PhaseScope;
class PipelineStatistics : public Malloced {
public:
PipelineStatistics(CompilationInfo* info, ZoneStats* zone_stats);
PipelineStatistics(CompilationInfo* info, Isolate* isolate,
ZoneStats* zone_stats);
~PipelineStatistics();
void BeginPhaseKind(const char* phase_kind_name);
......
This diff is collapsed.
......@@ -45,8 +45,8 @@ class Pipeline : public AllStatic {
// Returns a new compilation job for the WebAssembly compilation info.
static CompilationJob* NewWasmCompilationJob(
CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor,
SourcePositionTable* source_positions,
CompilationInfo* info, Isolate* isolate, JSGraph* jsgraph,
CallDescriptor* descriptor, SourcePositionTable* source_positions,
std::vector<trap_handler::ProtectedInstructionData>*
protected_instructions,
wasm::ModuleOrigin wasm_origin);
......@@ -60,12 +60,13 @@ class Pipeline : public AllStatic {
// Run the entire pipeline and generate a handle to a code object suitable for
// testing.
static Handle<Code> GenerateCodeForTesting(CompilationInfo* info);
static Handle<Code> GenerateCodeForTesting(CompilationInfo* 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.
static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
Graph* graph,
Isolate* isolate, Graph* graph,
Schedule* schedule = nullptr);
// Run just the register allocator phases.
......@@ -76,8 +77,8 @@ class Pipeline : public AllStatic {
// Run the pipeline on a machine graph and generate code. If {schedule} is
// {nullptr}, then compute a new schedule for code generation.
static Handle<Code> GenerateCodeForTesting(
CompilationInfo* info, CallDescriptor* call_descriptor, Graph* graph,
Schedule* schedule = nullptr,
CompilationInfo* info, Isolate* isolate, CallDescriptor* call_descriptor,
Graph* graph, Schedule* schedule = nullptr,
SourcePositionTable* source_positions = nullptr);
private:
......
......@@ -4259,8 +4259,9 @@ Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::WasmModule* module,
Vector<const char> func_name = CStrVector("js-to-wasm");
#endif
CompilationInfo info(func_name, isolate, &zone, Code::JS_TO_WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph);
CompilationInfo info(func_name, &zone, Code::JS_TO_WASM_FUNCTION);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph);
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code && !code.is_null()) {
OFStream os(stdout);
......@@ -4376,9 +4377,9 @@ Handle<Code> CompileWasmToJSWrapper(
Vector<const char> func_name = CStrVector("wasm-to-js");
#endif
CompilationInfo info(func_name, isolate, &zone, Code::WASM_TO_JS_FUNCTION);
CompilationInfo info(func_name, &zone, Code::WASM_TO_JS_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting(
&info, incoming, &graph, nullptr, source_position_table);
&info, isolate, incoming, &graph, nullptr, source_position_table);
ValidateImportWrapperReferencesImmovables(code);
Handle<FixedArray> deopt_data =
isolate->factory()->NewFixedArray(2, TENURED);
......@@ -4458,8 +4459,9 @@ Handle<Code> CompileWasmToWasmWrapper(Isolate* isolate, Handle<Code> target,
func_name = Vector<const char>::cast(buffer.SubVector(0, chars));
}
CompilationInfo info(func_name, isolate, &zone, Code::WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph);
CompilationInfo info(func_name, &zone, Code::WASM_FUNCTION);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph);
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code && !code.is_null()) {
OFStream os(stdout);
......@@ -4522,9 +4524,9 @@ Handle<Code> CompileWasmInterpreterEntry(Isolate* isolate, uint32_t func_index,
Vector<const char> func_name = CStrVector("wasm-interpreter-entry");
#endif
CompilationInfo info(func_name, isolate, &zone,
Code::WASM_INTERPRETER_ENTRY);
code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr);
CompilationInfo info(func_name, &zone, Code::WASM_INTERPRETER_ENTRY);
code = Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph,
nullptr);
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code && !code.is_null()) {
OFStream os(stdout);
......@@ -4597,8 +4599,9 @@ Handle<Code> CompileCWasmEntry(Isolate* isolate, wasm::FunctionSig* sig,
debug_name[name_len] = '\0';
Vector<const char> debug_name_vec(debug_name, name_len);
CompilationInfo info(debug_name_vec, isolate, &zone, Code::C_WASM_ENTRY);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph);
CompilationInfo info(debug_name_vec, &zone, Code::C_WASM_ENTRY);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph);
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code && !code.is_null()) {
OFStream os(stdout);
......@@ -4796,10 +4799,10 @@ void WasmCompilationUnit::ExecuteTurbofanCompilation() {
}
tf_.info_.reset(new CompilationInfo(
GetDebugName(tf_.compilation_zone_.get(), func_name_, func_index_),
isolate_, tf_.compilation_zone_.get(), Code::WASM_FUNCTION));
tf_.compilation_zone_.get(), Code::WASM_FUNCTION));
tf_.job_.reset(Pipeline::NewWasmCompilationJob(
tf_.info_.get(), tf_.jsgraph_, descriptor, source_positions,
tf_.info_.get(), isolate_, tf_.jsgraph_, descriptor, source_positions,
&protected_instructions_, env_->module->origin()));
ok_ = tf_.job_->ExecuteJob() == CompilationJob::SUCCEEDED;
// TODO(bradnelson): Improve histogram handling of size_t.
......@@ -4859,7 +4862,7 @@ MaybeHandle<Code> WasmCompilationUnit::FinishTurbofanCompilation(
if (FLAG_trace_wasm_decode_time) {
codegen_timer.Start();
}
if (tf_.job_->FinalizeJob() != CompilationJob::SUCCEEDED) {
if (tf_.job_->FinalizeJob(isolate_) != CompilationJob::SUCCEEDED) {
return Handle<Code>::null();
}
Handle<Code> code = tf_.info_->code();
......
......@@ -38,7 +38,7 @@ class RegisterTransferWriter final
};
BytecodeArrayBuilder::BytecodeArrayBuilder(
Isolate* isolate, Zone* zone, int parameter_count, int locals_count,
Zone* zone, int parameter_count, int locals_count,
FeedbackVectorSpec* feedback_vector_spec,
SourcePositionTableBuilder::RecordingMode source_position_mode)
: zone_(zone),
......
......@@ -35,7 +35,7 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final
: public NON_EXPORTED_BASE(ZoneObject) {
public:
BytecodeArrayBuilder(
Isolate* isolate, Zone* zone, int parameter_count, int locals_count,
Zone* zone, int parameter_count, int locals_count,
FeedbackVectorSpec* feedback_vector_spec = nullptr,
SourcePositionTableBuilder::RecordingMode source_position_mode =
SourcePositionTableBuilder::RECORD_SOURCE_POSITIONS);
......
......@@ -705,19 +705,19 @@ class BytecodeGenerator::GlobalDeclarationsBuilder final : public ZoneObject {
}
Handle<FixedArray> AllocateDeclarations(CompilationInfo* info,
Handle<Script> script) {
Handle<Script> script,
Isolate* isolate) {
DCHECK(has_constant_pool_entry_);
int array_index = 0;
Handle<FixedArray> data = info->isolate()->factory()->NewFixedArray(
Handle<FixedArray> data = isolate->factory()->NewFixedArray(
static_cast<int>(declarations_.size() * 4), TENURED);
for (const Declaration& declaration : declarations_) {
FunctionLiteral* func = declaration.func;
Handle<Object> initial_value;
if (func == nullptr) {
initial_value = info->isolate()->factory()->undefined_value();
initial_value = isolate->factory()->undefined_value();
} else {
initial_value =
Compiler::GetSharedFunctionInfo(func, script, info->isolate());
initial_value = Compiler::GetSharedFunctionInfo(func, script, isolate);
}
// Return a null handle if any initial values can't be created. Caller
......@@ -728,7 +728,7 @@ class BytecodeGenerator::GlobalDeclarationsBuilder final : public ZoneObject {
data->set(array_index++, Smi::FromInt(declaration.slot.ToInt()));
Object* undefined_or_literal_slot;
if (declaration.literal_slot.IsInvalid()) {
undefined_or_literal_slot = info->isolate()->heap()->undefined_value();
undefined_or_literal_slot = isolate->heap()->undefined_value();
} else {
undefined_or_literal_slot =
Smi::FromInt(declaration.literal_slot.ToInt());
......@@ -834,14 +834,15 @@ class BytecodeGenerator::FeedbackSlotCache : public ZoneObject {
ZoneMap<Key, FeedbackSlot> map_;
};
BytecodeGenerator::BytecodeGenerator(CompilationInfo* info)
BytecodeGenerator::BytecodeGenerator(
CompilationInfo* info, const AstStringConstants* ast_string_constants)
: zone_(info->zone()),
builder_(new (zone()) BytecodeArrayBuilder(
info->isolate(), info->zone(), info->num_parameters_including_this(),
info->zone(), info->num_parameters_including_this(),
info->scope()->num_stack_slots(), info->feedback_vector_spec(),
info->SourcePositionRecordingMode())),
info_(info),
ast_string_constants_(info->isolate()->ast_string_constants()),
ast_string_constants_(ast_string_constants),
closure_scope_(info->scope()),
current_scope_(info->scope()),
feedback_slot_cache_(new (zone()) FeedbackSlotCache(zone())),
......@@ -898,7 +899,7 @@ void BytecodeGenerator::AllocateDeferredConstants(Isolate* isolate,
// Build global declaration pair arrays.
for (GlobalDeclarationsBuilder* globals_builder : global_declarations_) {
Handle<FixedArray> declarations =
globals_builder->AllocateDeclarations(info(), script);
globals_builder->AllocateDeclarations(info(), script, isolate);
if (declarations.is_null()) return SetStackOverflow();
builder()->SetDeferredConstantPoolEntry(
globals_builder->constant_pool_entry(), declarations);
......
......@@ -28,7 +28,8 @@ class BytecodeJumpTable;
class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
public:
explicit BytecodeGenerator(CompilationInfo* info);
explicit BytecodeGenerator(CompilationInfo* info,
const AstStringConstants* ast_string_constants);
void GenerateBytecode(uintptr_t stack_limit);
Handle<BytecodeArray> FinalizeBytecode(Isolate* isolate,
......
......@@ -29,12 +29,12 @@ namespace interpreter {
class InterpreterCompilationJob final : public CompilationJob {
public:
InterpreterCompilationJob(ParseInfo* parse_info, FunctionLiteral* literal,
Isolate* isolate);
AccountingAllocator* allocator);
protected:
Status PrepareJobImpl() final;
Status PrepareJobImpl(Isolate* isolate) final;
Status ExecuteJobImpl() final;
Status FinalizeJobImpl() final;
Status FinalizeJobImpl(Isolate* isolate) final;
private:
BytecodeGenerator* generator() { return &generator_; }
......@@ -161,16 +161,17 @@ bool ShouldPrintBytecode(Handle<SharedFunctionInfo> shared) {
} // namespace
InterpreterCompilationJob::InterpreterCompilationJob(ParseInfo* parse_info,
FunctionLiteral* literal,
Isolate* isolate)
InterpreterCompilationJob::InterpreterCompilationJob(
ParseInfo* parse_info, FunctionLiteral* literal,
AccountingAllocator* allocator)
: CompilationJob(parse_info->stack_limit(), parse_info, &compilation_info_,
"Ignition", State::kReadyToExecute),
zone_(isolate->allocator(), ZONE_NAME),
compilation_info_(&zone_, isolate, parse_info, literal),
generator_(&compilation_info_) {}
zone_(allocator, ZONE_NAME),
compilation_info_(&zone_, parse_info, literal),
generator_(&compilation_info_, parse_info->ast_string_constants()) {}
InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() {
InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl(
Isolate* isolate) {
UNREACHABLE(); // Prepare should always be skipped.
return SUCCEEDED;
}
......@@ -197,13 +198,14 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() {
return SUCCEEDED;
}
InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl() {
InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl(
Isolate* isolate) {
RuntimeCallTimerScope runtimeTimerScope(
parse_info()->runtime_call_stats(),
&RuntimeCallStats::CompileIgnitionFinalization);
Handle<BytecodeArray> bytecodes = generator()->FinalizeBytecode(
compilation_info()->isolate(), parse_info()->script());
Handle<BytecodeArray> bytecodes =
generator()->FinalizeBytecode(isolate, parse_info()->script());
if (generator()->HasStackOverflow()) {
return FAILED;
}
......@@ -219,14 +221,14 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl() {
compilation_info()->SetBytecodeArray(bytecodes);
compilation_info()->SetCode(
BUILTIN_CODE(compilation_info()->isolate(), InterpreterEntryTrampoline));
BUILTIN_CODE(isolate, InterpreterEntryTrampoline));
return SUCCEEDED;
}
CompilationJob* Interpreter::NewCompilationJob(ParseInfo* parse_info,
FunctionLiteral* literal,
Isolate* isolate) {
return new InterpreterCompilationJob(parse_info, literal, isolate);
AccountingAllocator* allocator) {
return new InterpreterCompilationJob(parse_info, literal, allocator);
}
bool Interpreter::IsDispatchTableInitialized() const {
......
......@@ -40,7 +40,7 @@ class Interpreter {
// Creates a compilation job which will generate bytecode for |literal|.
static CompilationJob* NewCompilationJob(ParseInfo* parse_info,
FunctionLiteral* literal,
Isolate* isolate);
AccountingAllocator* allocator);
// If the bytecode handler for |bytecode| and |operand_scale| has not yet
// been loaded, deserialize it. Then return the handler.
......
......@@ -68,10 +68,9 @@ class RawMachineAssemblerTester : public HandleAndZoneScope,
Schedule* schedule = this->Export();
CallDescriptor* call_descriptor = this->call_descriptor();
Graph* graph = this->graph();
CompilationInfo info(ArrayVector("testing"), main_isolate(), main_zone(),
Code::STUB);
code_ = Pipeline::GenerateCodeForTesting(&info, call_descriptor, graph,
schedule);
CompilationInfo info(ArrayVector("testing"), main_zone(), Code::STUB);
code_ = Pipeline::GenerateCodeForTesting(
&info, main_isolate(), call_descriptor, graph, schedule);
}
return this->code_.ToHandleChecked()->entry();
}
......
......@@ -152,7 +152,8 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
CHECK(info.shared_info()->HasBytecodeArray());
JSFunction::EnsureLiterals(function);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, function->GetIsolate());
CHECK(!code.is_null());
info.dependencies()->Commit(code);
info.context()->native_context()->AddOptimizedCode(*code);
......@@ -168,7 +169,8 @@ Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
CompilationInfo info(parse_info.zone(), function->GetIsolate(), shared,
function);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, function->GetIsolate(), graph);
CHECK(!code.is_null());
function->set_code(*code);
return function;
......
......@@ -280,9 +280,9 @@ class GraphBuilderTester : public HandleAndZoneScope,
Zone* zone = graph()->zone();
CallDescriptor* desc =
Linkage::GetSimplifiedCDescriptor(zone, this->csig_);
CompilationInfo info(ArrayVector("testing"), main_isolate(), main_zone(),
Code::STUB);
code_ = Pipeline::GenerateCodeForTesting(&info, desc, graph());
CompilationInfo info(ArrayVector("testing"), main_zone(), Code::STUB);
code_ = Pipeline::GenerateCodeForTesting(&info, main_isolate(), desc,
graph());
#ifdef ENABLE_DISASSEMBLER
if (!code_.is_null() && FLAG_print_opt_code) {
OFStream os(stdout);
......
......@@ -758,13 +758,13 @@ class CodeGeneratorTester {
public:
explicit CodeGeneratorTester(TestEnvironment* environment)
: zone_(environment->main_zone()),
info_(ArrayVector("test"), environment->main_isolate(),
environment->main_zone(), Code::STUB),
info_(ArrayVector("test"), environment->main_zone(), Code::STUB),
linkage_(environment->test_descriptor()),
frame_(environment->test_descriptor()->CalculateFixedFrameSize()),
generator_(environment->main_zone(), &frame_, &linkage_,
environment->code(), &info_, base::Optional<OsrHelper>(),
kNoSourcePosition, nullptr, nullptr) {
environment->code(), &info_, environment->main_isolate(),
base::Optional<OsrHelper>(), kNoSourcePosition, nullptr,
nullptr) {
// Force a frame to be created.
generator_.frame_access_state()->MarkHasFrame(true);
generator_.AssembleConstructFrame();
......
......@@ -108,7 +108,7 @@ TEST(TestLinkageStubCall) {
Isolate* isolate = CcTest::InitIsolateOnce();
Zone zone(isolate->allocator(), ZONE_NAME);
Callable callable = Builtins::CallableFor(isolate, Builtins::kToNumber);
CompilationInfo info(ArrayVector("test"), isolate, &zone, Code::STUB);
CompilationInfo info(ArrayVector("test"), &zone, Code::STUB);
CallDescriptor* descriptor = Linkage::GetStubCallDescriptor(
isolate, &zone, callable.descriptor(), 0, CallDescriptor::kNoFlags,
Operator::kNoProperties);
......
......@@ -81,10 +81,9 @@ TEST(ReturnThreeValues) {
Node* mul = m.Int32Mul(p0, p1);
m.Return(add, sub, mul);
CompilationInfo info(ArrayVector("testing"), handles.main_isolate(),
handles.main_zone(), Code::STUB);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, desc, m.graph(), m.Export());
CompilationInfo info(ArrayVector("testing"), handles.main_zone(), Code::STUB);
Handle<Code> code = Pipeline::GenerateCodeForTesting(
&info, handles.main_isolate(), desc, m.graph(), m.Export());
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_code) {
OFStream os(stdout);
......
......@@ -127,7 +127,8 @@ class BytecodeGraphTester {
CanonicalHandleScope canonical(isolate_);
compilation_info.ReopenHandlesInNewHandleScope();
Handle<Code> code = Pipeline::GenerateCodeForTesting(&compilation_info);
Handle<Code> code = Pipeline::GenerateCodeForTesting(
&compilation_info, function->GetIsolate());
function->set_code(*code);
return function;
......
......@@ -256,10 +256,9 @@ class Int32Signature : public MachineSignature {
Handle<Code> CompileGraph(const char* name, CallDescriptor* desc, Graph* graph,
Schedule* schedule = nullptr) {
Isolate* isolate = CcTest::InitIsolateOnce();
CompilationInfo info(ArrayVector("testing"), isolate, graph->zone(),
Code::STUB);
CompilationInfo info(ArrayVector("testing"), graph->zone(), Code::STUB);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, desc, graph, schedule);
Pipeline::GenerateCodeForTesting(&info, isolate, desc, graph, schedule);
CHECK(!code.is_null());
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code) {
......
......@@ -24,7 +24,7 @@ class StubTester {
public:
StubTester(Isolate* isolate, Zone* zone, CodeStub* stub)
: zone_(zone),
info_(ArrayVector("test"), isolate, zone, Code::STUB),
info_(ArrayVector("test"), zone, Code::STUB),
interface_descriptor_(stub->GetCallInterfaceDescriptor()),
descriptor_(Linkage::GetStubCallDescriptor(
isolate, zone, interface_descriptor_,
......@@ -37,7 +37,7 @@ class StubTester {
StubTester(Isolate* isolate, Zone* zone, Builtins::Name name)
: zone_(zone),
info_(ArrayVector("test"), isolate, zone, Code::STUB),
info_(ArrayVector("test"), zone, Code::STUB),
interface_descriptor_(
Builtins::CallableFor(isolate, name).descriptor()),
descriptor_(Linkage::GetStubCallDescriptor(
......
......@@ -26,7 +26,7 @@ class InvokeIntrinsicHelper {
template <class... A>
Handle<Object> Invoke(A... args) {
CHECK(IntrinsicsHelper::IsSupported(function_id_));
BytecodeArrayBuilder builder(isolate_, zone_, sizeof...(args), 0, 0);
BytecodeArrayBuilder builder(zone_, sizeof...(args), 0, 0);
RegisterList reg_list(builder.Receiver().index(), sizeof...(args));
builder.CallRuntime(function_id_, reg_list).Return();
InterpreterTester tester(isolate_, builder.ToBytecodeArray(isolate_));
......
This diff is collapsed.
......@@ -351,10 +351,10 @@ Handle<Code> WasmFunctionWrapper::GetWrapperCode() {
r.LowerGraph();
}
CompilationInfo info(ArrayVector("testing"), isolate, graph()->zone(),
CompilationInfo info(ArrayVector("testing"), graph()->zone(),
Code::C_WASM_ENTRY);
code_ = compiler::Pipeline::GenerateCodeForTesting(&info, descriptor,
graph(), nullptr);
code_ = compiler::Pipeline::GenerateCodeForTesting(
&info, isolate, descriptor, graph(), nullptr);
CHECK(!code_.is_null());
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code) {
......
......@@ -40,9 +40,7 @@ class BlockingCompilationJob : public CompilationJob {
void Signal() { semaphore_.Signal(); }
// CompilationJob implementation.
Status PrepareJobImpl() override {
UNREACHABLE();
}
Status PrepareJobImpl(Isolate* isolate) override { UNREACHABLE(); }
Status ExecuteJobImpl() override {
blocking_.SetValue(true);
......@@ -51,7 +49,7 @@ class BlockingCompilationJob : public CompilationJob {
return SUCCEEDED;
}
Status FinalizeJobImpl() override { return SUCCEEDED; }
Status FinalizeJobImpl(Isolate* isolate) override { return SUCCEEDED; }
private:
Handle<SharedFunctionInfo> shared_;
......
......@@ -90,7 +90,7 @@ class BytecodeAnalysisTest : public TestWithIsolateAndZone {
SaveFlags* BytecodeAnalysisTest::save_flags_ = nullptr;
TEST_F(BytecodeAnalysisTest, EmptyBlock) {
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......@@ -104,7 +104,7 @@ TEST_F(BytecodeAnalysisTest, EmptyBlock) {
}
TEST_F(BytecodeAnalysisTest, SimpleLoad) {
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......@@ -121,7 +121,7 @@ TEST_F(BytecodeAnalysisTest, SimpleLoad) {
}
TEST_F(BytecodeAnalysisTest, StoreThenLoad) {
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......@@ -141,7 +141,7 @@ TEST_F(BytecodeAnalysisTest, StoreThenLoad) {
}
TEST_F(BytecodeAnalysisTest, DiamondLoad) {
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......@@ -178,7 +178,7 @@ TEST_F(BytecodeAnalysisTest, DiamondLoad) {
}
TEST_F(BytecodeAnalysisTest, DiamondLookupsAndBinds) {
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......@@ -225,7 +225,7 @@ TEST_F(BytecodeAnalysisTest, DiamondLookupsAndBinds) {
}
TEST_F(BytecodeAnalysisTest, SimpleLoop) {
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......@@ -273,7 +273,7 @@ TEST_F(BytecodeAnalysisTest, SimpleLoop) {
}
TEST_F(BytecodeAnalysisTest, TryCatch) {
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......@@ -326,7 +326,7 @@ TEST_F(BytecodeAnalysisTest, DiamondInLoop) {
// diamond should eventually propagate up the other path when the loop is
// reprocessed.
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......@@ -396,7 +396,7 @@ TEST_F(BytecodeAnalysisTest, KillingLoopInsideLoop) {
// still process the inner loop when processing the outer loop, to ensure that
// r1 becomes live in 3 (via 5), but r0 stays dead (because of 4).
interpreter::BytecodeArrayBuilder builder(isolate(), zone(), 3, 3);
interpreter::BytecodeArrayBuilder builder(zone(), 3, 3);
std::vector<std::pair<std::string, std::string>> expected_liveness;
interpreter::Register reg_0(0);
......
......@@ -29,7 +29,7 @@ using ToBooleanMode = BytecodeArrayBuilder::ToBooleanMode;
TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 1, 131, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 1, 131, &feedback_spec);
Factory* factory = isolate()->factory();
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
......@@ -466,7 +466,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) {
for (int locals = 0; locals < 5; locals++) {
for (int temps = 0; temps < 3; temps++) {
BytecodeArrayBuilder builder(isolate(), zone(), 1, locals);
BytecodeArrayBuilder builder(zone(), 1, locals);
BytecodeRegisterAllocator* allocator(builder.register_allocator());
for (int i = 0; i < locals; i++) {
builder.LoadLiteral(Smi::kZero);
......@@ -503,7 +503,7 @@ TEST_F(BytecodeArrayBuilderTest, RegisterValues) {
TEST_F(BytecodeArrayBuilderTest, Parameters) {
BytecodeArrayBuilder builder(isolate(), zone(), 10, 0);
BytecodeArrayBuilder builder(zone(), 10, 0);
Register receiver(builder.Receiver());
Register param8(builder.Parameter(8));
......@@ -512,7 +512,7 @@ TEST_F(BytecodeArrayBuilderTest, Parameters) {
TEST_F(BytecodeArrayBuilderTest, Constants) {
BytecodeArrayBuilder builder(isolate(), zone(), 1, 0);
BytecodeArrayBuilder builder(zone(), 1, 0);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
......@@ -542,7 +542,7 @@ TEST_F(BytecodeArrayBuilderTest, Constants) {
TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
static const int kFarJumpDistance = 256 + 20;
BytecodeArrayBuilder builder(isolate(), zone(), 1, 1);
BytecodeArrayBuilder builder(zone(), 1, 1);
Register reg(0);
BytecodeLabel far0, far1, far2, far3, far4;
......@@ -657,7 +657,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
BytecodeArrayBuilder builder(isolate(), zone(), 1, 1);
BytecodeArrayBuilder builder(zone(), 1, 1);
Register reg(0);
......@@ -705,7 +705,7 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
}
TEST_F(BytecodeArrayBuilderTest, SmallSwitch) {
BytecodeArrayBuilder builder(isolate(), zone(), 1, 1);
BytecodeArrayBuilder builder(zone(), 1, 1);
// Small jump table that fits into the single-size constant pool
int small_jump_table_size = 5;
......@@ -753,7 +753,7 @@ TEST_F(BytecodeArrayBuilderTest, SmallSwitch) {
}
TEST_F(BytecodeArrayBuilderTest, WideSwitch) {
BytecodeArrayBuilder builder(isolate(), zone(), 1, 1);
BytecodeArrayBuilder builder(zone(), 1, 1);
// Large jump table that requires a wide Switch bytecode.
int large_jump_table_size = 256;
......@@ -801,7 +801,7 @@ TEST_F(BytecodeArrayBuilderTest, WideSwitch) {
}
TEST_F(BytecodeArrayBuilderTest, LabelReuse) {
BytecodeArrayBuilder builder(isolate(), zone(), 1, 0);
BytecodeArrayBuilder builder(zone(), 1, 0);
// Labels can only have 1 forward reference, but
// can be referred to mulitple times once bound.
......@@ -835,7 +835,7 @@ TEST_F(BytecodeArrayBuilderTest, LabelReuse) {
TEST_F(BytecodeArrayBuilderTest, LabelAddressReuse) {
static const int kRepeats = 3;
BytecodeArrayBuilder builder(isolate(), zone(), 1, 0);
BytecodeArrayBuilder builder(zone(), 1, 0);
for (int i = 0; i < kRepeats; i++) {
BytecodeLabel label, after_jump0, after_jump1;
builder.Jump(&label)
......
......@@ -23,7 +23,7 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
// Use a builder to create an array with containing multiple bytecodes
// with 0, 1 and 2 operands.
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
double heap_num_0 = 2.718;
......
......@@ -23,7 +23,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, InvalidBeforeStart) {
// Use a builder to create an array with containing multiple bytecodes
// with 0, 1 and 2 operands.
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
double heap_num_0 = 2.718;
......@@ -77,7 +77,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, InvalidAfterEnd) {
// Use a builder to create an array with containing multiple bytecodes
// with 0, 1 and 2 operands.
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
double heap_num_0 = 2.718;
......@@ -131,7 +131,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, AccessesFirst) {
// Use a builder to create an array with containing multiple bytecodes
// with 0, 1 and 2 operands.
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
double heap_num_0 = 2.718;
......@@ -189,7 +189,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, AccessesLast) {
// Use a builder to create an array with containing multiple bytecodes
// with 0, 1 and 2 operands.
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
double heap_num_0 = 2.718;
......@@ -248,7 +248,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, RandomAccessValid) {
// Use a builder to create an array with containing multiple bytecodes
// with 0, 1 and 2 operands.
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
double heap_num_0 = 2.718;
......@@ -433,7 +433,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArray) {
// Use a builder to create an array with containing multiple bytecodes
// with 0, 1 and 2 operands.
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
double heap_num_0 = 2.718;
......@@ -712,7 +712,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArrayBackwards) {
// Use a builder to create an array with containing multiple bytecodes
// with 0, 1 and 2 operands.
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, &feedback_spec);
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
isolate()->heap()->HashSeed());
double heap_num_0 = 2.718;
......
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