Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/compiler-dispatcher/compiler-dispatcher-job.cc

Issue 2191443003: Add a prepare to parse step to CompilerDispatcherJob (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" 5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h"
6 6
7 #include "src/global-handles.h" 7 #include "src/global-handles.h"
8 #include "src/isolate.h" 8 #include "src/isolate.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 #include "src/parsing/parser.h"
11 #include "src/unicode-cache.h"
12 #include "src/zone.h"
10 13
11 namespace v8 { 14 namespace v8 {
12 namespace internal { 15 namespace internal {
13 16
14 CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate, 17 CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
15 Handle<JSFunction> function) 18 Handle<JSFunction> function)
16 : isolate_(isolate), 19 : isolate_(isolate),
17 function_(Handle<JSFunction>::cast( 20 function_(Handle<JSFunction>::cast(
18 isolate_->global_handles()->Create(*function))) {} 21 isolate_->global_handles()->Create(*function))) {}
19 22
20 CompilerDispatcherJob::~CompilerDispatcherJob() { 23 CompilerDispatcherJob::~CompilerDispatcherJob() {
24 DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
21 i::GlobalHandles::Destroy(Handle<Object>::cast(function_).location()); 25 i::GlobalHandles::Destroy(Handle<Object>::cast(function_).location());
22 } 26 }
23 27
28 void CompilerDispatcherJob::PrepareToParseOnMainThread() {
29 DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
30 DCHECK(status_ == CompileJobStatus::kInitial);
31 unicode_cache_.reset(new UnicodeCache());
32 zone_.reset(new Zone(isolate_->allocator()));
33 parse_info_.reset(new ParseInfo(zone_.get()));
34 parse_info_->set_isolate(isolate_);
35 // TODO(jochen): We need to hook up a fake source stream here.
36 parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
37 parse_info_->set_unicode_cache(unicode_cache_.get());
38 status_ = CompileJobStatus::kReadyToParse;
39 }
40
24 } // namespace internal 41 } // namespace internal
25 } // namespace v8 42 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698