[cleanup] Transfer ownership for compilation jobs
Make NewCompilationJob methods return a unique_ptr to explicitly transfer ownership. R=mstarzinger@chromium.org Bug: v8:9183 Change-Id: I1cc6614cc1941b1b27489443a3c330cf6e88f089 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660474 Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org> Cr-Commit-Position: refs/heads/master@{#62206}
This commit is contained in:
parent
f45c25f785
commit
ac9a9bd70e
@ -319,10 +319,10 @@ void AsmJsCompilationJob::RecordHistograms(Isolate* isolate) {
|
||||
translation_throughput);
|
||||
}
|
||||
|
||||
UnoptimizedCompilationJob* AsmJs::NewCompilationJob(
|
||||
std::unique_ptr<UnoptimizedCompilationJob> AsmJs::NewCompilationJob(
|
||||
ParseInfo* parse_info, FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator) {
|
||||
return new AsmJsCompilationJob(parse_info, literal, allocator);
|
||||
return base::make_unique<AsmJsCompilationJob>(parse_info, literal, allocator);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -23,7 +23,7 @@ class UnoptimizedCompilationJob;
|
||||
// Interface to compile and instantiate for asm.js modules.
|
||||
class AsmJs {
|
||||
public:
|
||||
static UnoptimizedCompilationJob* NewCompilationJob(
|
||||
static std::unique_ptr<UnoptimizedCompilationJob> NewCompilationJob(
|
||||
ParseInfo* parse_info, FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator);
|
||||
static MaybeHandle<Object> InstantiateAsmWasm(Isolate* isolate,
|
||||
|
@ -2479,11 +2479,11 @@ MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
|
||||
}
|
||||
|
||||
// static
|
||||
OptimizedCompilationJob* Pipeline::NewCompilationJob(
|
||||
std::unique_ptr<OptimizedCompilationJob> Pipeline::NewCompilationJob(
|
||||
Isolate* isolate, Handle<JSFunction> function, bool has_script) {
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
handle(function->shared(), function->GetIsolate());
|
||||
return new PipelineCompilationJob(isolate, shared, function);
|
||||
return base::make_unique<PipelineCompilationJob>(isolate, shared, function);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -41,9 +41,8 @@ class SourcePositionTable;
|
||||
class Pipeline : public AllStatic {
|
||||
public:
|
||||
// Returns a new compilation job for the given JavaScript function.
|
||||
static OptimizedCompilationJob* NewCompilationJob(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
bool has_script);
|
||||
static std::unique_ptr<OptimizedCompilationJob> NewCompilationJob(
|
||||
Isolate* isolate, Handle<JSFunction> function, bool has_script);
|
||||
|
||||
// Run the pipeline for the WebAssembly compilation info.
|
||||
static void GenerateCodeForWasmFunction(
|
||||
|
@ -230,12 +230,12 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl(
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
UnoptimizedCompilationJob* Interpreter::NewCompilationJob(
|
||||
std::unique_ptr<UnoptimizedCompilationJob> Interpreter::NewCompilationJob(
|
||||
ParseInfo* parse_info, FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator,
|
||||
std::vector<FunctionLiteral*>* eager_inner_literals) {
|
||||
return new InterpreterCompilationJob(parse_info, literal, allocator,
|
||||
eager_inner_literals);
|
||||
return base::make_unique<InterpreterCompilationJob>(
|
||||
parse_info, literal, allocator, eager_inner_literals);
|
||||
}
|
||||
|
||||
void Interpreter::ForEachBytecode(
|
||||
|
@ -43,7 +43,7 @@ class Interpreter {
|
||||
// Creates a compilation job which will generate bytecode for |literal|.
|
||||
// Additionally, if |eager_inner_literals| is not null, adds any eagerly
|
||||
// compilable inner FunctionLiterals to this list.
|
||||
static UnoptimizedCompilationJob* NewCompilationJob(
|
||||
static std::unique_ptr<UnoptimizedCompilationJob> NewCompilationJob(
|
||||
ParseInfo* parse_info, FunctionLiteral* literal,
|
||||
AccountingAllocator* allocator,
|
||||
std::vector<FunctionLiteral*>* eager_inner_literals);
|
||||
|
Loading…
Reference in New Issue
Block a user