Commit cbcc2319 authored by jochen's avatar jochen Committed by Commit bot

Clean up compiler dispatcher job a bit

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

Review-Url: https://codereview.chromium.org/2197573002
Cr-Commit-Position: refs/heads/master@{#38174}
parent cf177949
......@@ -27,13 +27,8 @@ CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
Handle<SharedFunctionInfo> shared(function_->shared(), isolate_);
Handle<Script> script(Script::cast(shared->script()), isolate_);
Handle<String> source(String::cast(script->source()), isolate_);
if (source->IsExternalTwoByteString()) {
can_parse_on_background_thread_ = true;
} else if (source->IsExternalOneByteString()) {
can_parse_on_background_thread_ = true;
} else {
can_parse_on_background_thread_ = false;
}
can_parse_on_background_thread_ =
source->IsExternalTwoByteString() || source->IsExternalOneByteString();
}
CompilerDispatcherJob::~CompilerDispatcherJob() {
......@@ -71,7 +66,7 @@ void CompilerDispatcherJob::PrepareToParseOnMainThread() {
parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
parse_info_->set_unicode_cache(unicode_cache_.get());
parser_.reset(new Parser(parse_info_.get()));
status_.SetValue(CompileJobStatus::kReadyToParse);
status_ = CompileJobStatus::kReadyToParse;
}
void CompilerDispatcherJob::Parse() {
......@@ -95,7 +90,7 @@ void CompilerDispatcherJob::Parse() {
parse_info_->set_isolate(isolate_);
status_.SetValue(CompileJobStatus::kParsed);
status_ = CompileJobStatus::kParsed;
}
} // namespace internal
......
......@@ -7,7 +7,6 @@
#include <memory>
#include "src/base/atomic-utils.h"
#include "src/base/macros.h"
#include "src/handles.h"
......@@ -35,7 +34,7 @@ class CompilerDispatcherJob {
size_t max_stack_size);
~CompilerDispatcherJob();
CompileJobStatus status() const { return status_.Value(); }
CompileJobStatus status() const { return status_; }
bool can_parse_on_background_thread() const {
return can_parse_on_background_thread_;
}
......@@ -47,8 +46,7 @@ class CompilerDispatcherJob {
void Parse();
private:
base::AtomicValue<CompileJobStatus> status_ =
base::AtomicValue<CompileJobStatus>(CompileJobStatus::kInitial);
CompileJobStatus status_ = CompileJobStatus::kInitial;
Isolate* isolate_;
Handle<JSFunction> function_; // Global handle.
size_t max_stack_size_;
......
......@@ -21,9 +21,10 @@ class ScriptResource : public v8::String::ExternalOneByteStringResource {
public:
ScriptResource(const char* data, size_t length)
: data_(data), length_(length) {}
~ScriptResource() override = default;
const char* data() const { return data_; }
size_t length() const { return length_; }
const char* data() const override { return data_; }
size_t length() const override { return length_; }
private:
const char* data_;
......
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