Introduce a holder for compile jobs

Next step will be to add methods for parsing and then compiling.

BUG=v8:5215
R=marja@chromium.org

Review-Url: https://codereview.chromium.org/2171323002
Cr-Commit-Position: refs/heads/master@{#37980}
This commit is contained in:
jochen 2016-07-22 05:19:50 -07:00 committed by Commit bot
parent f4e142d1df
commit b5b9dd730a
6 changed files with 95 additions and 0 deletions

View File

@ -921,6 +921,8 @@ v8_source_set("v8_base") {
"src/compilation-dependencies.h",
"src/compilation-statistics.cc",
"src/compilation-statistics.h",
"src/compiler-dispatcher/compiler-dispatcher-job.cc",
"src/compiler-dispatcher/compiler-dispatcher-job.h",
"src/compiler-dispatcher/optimizing-compile-dispatcher.cc",
"src/compiler-dispatcher/optimizing-compile-dispatcher.h",
"src/compiler.cc",

View File

@ -0,0 +1,25 @@
// Copyright 2016 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 "src/compiler-dispatcher/compiler-dispatcher-job.h"
#include "src/global-handles.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {
CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
Handle<JSFunction> function)
: isolate_(isolate),
function_(Handle<JSFunction>::cast(
isolate_->global_handles()->Create(*function))) {}
CompilerDispatcherJob::~CompilerDispatcherJob() {
i::GlobalHandles::Destroy(Handle<Object>::cast(function_).location());
}
} // namespace internal
} // namespace v8

View File

@ -0,0 +1,41 @@
// Copyright 2016 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_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_
#define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_
#include "src/base/macros.h"
#include "src/handles.h"
namespace v8 {
namespace internal {
class CompilationInfo;
class Isolate;
class JSFunction;
enum class CompileJobStatus {
kInitial,
};
class CompilerDispatcherJob {
public:
CompilerDispatcherJob(Isolate* isolate, Handle<JSFunction> function);
~CompilerDispatcherJob();
CompileJobStatus status() const { return status_; }
private:
CompileJobStatus status_ = CompileJobStatus::kInitial;
Isolate* isolate_;
Handle<JSFunction> function_; // Global handle.
DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob);
};
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_

View File

@ -732,6 +732,8 @@
'compiler/wasm-linkage.cc',
'compiler/zone-pool.cc',
'compiler/zone-pool.h',
'compiler-dispatcher/compiler-dispatcher-job.cc',
'compiler-dispatcher/compiler-dispatcher-job.h',
'compiler-dispatcher/optimizing-compile-dispatcher.cc',
'compiler-dispatcher/optimizing-compile-dispatcher.h',
'compiler.cc',

View File

@ -0,0 +1,24 @@
// Copyright 2016 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 <memory>
#include "src/compiler-dispatcher/compiler-dispatcher-job.h"
#include "src/isolate-inl.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace internal {
typedef TestWithContext CompilerDispatcherJobTest;
TEST_F(CompilerDispatcherJobTest, Construct) {
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate());
std::unique_ptr<CompilerDispatcherJob> job(
new CompilerDispatcherJob(i_isolate, i_isolate->object_function()));
}
} // namespace internal
} // namespace v8

View File

@ -78,6 +78,7 @@
'compiler/typer-unittest.cc',
'compiler/value-numbering-reducer-unittest.cc',
'compiler/zone-pool-unittest.cc',
'compiler-dispatcher/compiler-dispatcher-job-unittest.cc',
'counters-unittest.cc',
'eh-frame-iterator-unittest.cc',
'eh-frame-writer-unittest.cc',