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}
This commit is contained in:
parent
cf1779495d
commit
cbcc231991
@ -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_;
|
||||
|
Loading…
Reference in New Issue
Block a user