| Index: src/compiler-dispatcher/compiler-dispatcher-job.cc
|
| diff --git a/src/compiler-dispatcher/compiler-dispatcher-job.cc b/src/compiler-dispatcher/compiler-dispatcher-job.cc
|
| index a58fa3b9dcbc91ba4828a1349c703c6c4fe9ce93..94a732286e48830042cc0ff48f88f783b30c3f83 100644
|
| --- a/src/compiler-dispatcher/compiler-dispatcher-job.cc
|
| +++ b/src/compiler-dispatcher/compiler-dispatcher-job.cc
|
| @@ -20,16 +20,16 @@ namespace v8 {
|
| namespace internal {
|
|
|
| CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
|
| - Handle<JSFunction> function,
|
| + Handle<SharedFunctionInfo> shared,
|
| size_t max_stack_size)
|
| : isolate_(isolate),
|
| - function_(Handle<JSFunction>::cast(
|
| - isolate_->global_handles()->Create(*function))),
|
| + shared_(Handle<SharedFunctionInfo>::cast(
|
| + isolate_->global_handles()->Create(*shared))),
|
| max_stack_size_(max_stack_size),
|
| can_compile_on_background_thread_(false) {
|
| HandleScope scope(isolate_);
|
| - Handle<SharedFunctionInfo> shared(function_->shared(), isolate_);
|
| - Handle<Script> script(Script::cast(shared->script()), isolate_);
|
| + DCHECK(!shared_->outer_scope_info()->IsTheHole(isolate_));
|
| + Handle<Script> script(Script::cast(shared_->script()), isolate_);
|
| Handle<String> source(String::cast(script->source()), isolate_);
|
| can_parse_on_background_thread_ =
|
| source->IsExternalTwoByteString() || source->IsExternalOneByteString();
|
| @@ -39,7 +39,7 @@ CompilerDispatcherJob::~CompilerDispatcherJob() {
|
| DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
|
| DCHECK(status_ == CompileJobStatus::kInitial ||
|
| status_ == CompileJobStatus::kDone);
|
| - i::GlobalHandles::Destroy(Handle<Object>::cast(function_).location());
|
| + i::GlobalHandles::Destroy(Handle<Object>::cast(shared_).location());
|
| }
|
|
|
| void CompilerDispatcherJob::PrepareToParseOnMainThread() {
|
| @@ -48,44 +48,42 @@ void CompilerDispatcherJob::PrepareToParseOnMainThread() {
|
| HandleScope scope(isolate_);
|
| unicode_cache_.reset(new UnicodeCache());
|
| zone_.reset(new Zone(isolate_->allocator()));
|
| - Handle<SharedFunctionInfo> shared(function_->shared(), isolate_);
|
| - Handle<Script> script(Script::cast(shared->script()), isolate_);
|
| + Handle<Script> script(Script::cast(shared_->script()), isolate_);
|
| DCHECK(script->type() != Script::TYPE_NATIVE);
|
|
|
| Handle<String> source(String::cast(script->source()), isolate_);
|
| if (source->IsExternalTwoByteString() || source->IsExternalOneByteString()) {
|
| - character_stream_.reset(ScannerStream::For(source, shared->start_position(),
|
| - shared->end_position()));
|
| + character_stream_.reset(ScannerStream::For(
|
| + source, shared_->start_position(), shared_->end_position()));
|
| } else {
|
| source = String::Flatten(source);
|
| // Have to globalize the reference here, so it survives between function
|
| // calls.
|
| source_ = Handle<String>::cast(isolate_->global_handles()->Create(*source));
|
| character_stream_.reset(ScannerStream::For(
|
| - source_, shared->start_position(), shared->end_position()));
|
| + source_, shared_->start_position(), shared_->end_position()));
|
| }
|
| parse_info_.reset(new ParseInfo(zone_.get()));
|
| parse_info_->set_isolate(isolate_);
|
| parse_info_->set_character_stream(character_stream_.get());
|
| parse_info_->set_lazy();
|
| parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
|
| - parse_info_->set_is_named_expression(shared->is_named_expression());
|
| - parse_info_->set_calls_eval(shared->scope_info()->CallsEval());
|
| - parse_info_->set_compiler_hints(shared->compiler_hints());
|
| - parse_info_->set_start_position(shared->start_position());
|
| - parse_info_->set_end_position(shared->end_position());
|
| + parse_info_->set_is_named_expression(shared_->is_named_expression());
|
| + parse_info_->set_compiler_hints(shared_->compiler_hints());
|
| + parse_info_->set_start_position(shared_->start_position());
|
| + parse_info_->set_end_position(shared_->end_position());
|
| parse_info_->set_unicode_cache(unicode_cache_.get());
|
| - parse_info_->set_language_mode(shared->language_mode());
|
| + parse_info_->set_language_mode(shared_->language_mode());
|
|
|
| parser_.reset(new Parser(parse_info_.get()));
|
| - parser_->DeserializeScopeChain(
|
| - parse_info_.get(),
|
| - function_->context()->IsNativeContext()
|
| - ? MaybeHandle<ScopeInfo>()
|
| - : MaybeHandle<ScopeInfo>(function_->context()->scope_info(),
|
| - isolate_));
|
| -
|
| - Handle<String> name(String::cast(shared->name()));
|
| + Handle<ScopeInfo> outer_scope_info(
|
| + handle(ScopeInfo::cast(shared_->outer_scope_info())));
|
| + parser_->DeserializeScopeChain(parse_info_.get(),
|
| + outer_scope_info->length() > 0
|
| + ? MaybeHandle<ScopeInfo>(outer_scope_info)
|
| + : MaybeHandle<ScopeInfo>());
|
| +
|
| + Handle<String> name(String::cast(shared_->name()));
|
| parse_info_->set_function_name(
|
| parse_info_->ast_value_factory()->GetString(name));
|
| status_ = CompileJobStatus::kReadyToParse;
|
| @@ -136,15 +134,15 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() {
|
|
|
| DeferredHandleScope scope(isolate_);
|
| {
|
| - Handle<SharedFunctionInfo> shared(function_->shared(), isolate_);
|
| - Handle<Script> script(Script::cast(shared->script()), isolate_);
|
| + Handle<Script> script(Script::cast(shared_->script()), isolate_);
|
|
|
| parse_info_->set_script(script);
|
| - if (!function_->context()->IsNativeContext()) {
|
| - parse_info_->set_outer_scope_info(
|
| - handle(function_->context()->scope_info(), isolate_));
|
| + Handle<ScopeInfo> outer_scope_info(
|
| + handle(ScopeInfo::cast(shared_->outer_scope_info())));
|
| + if (outer_scope_info->length() > 0) {
|
| + parse_info_->set_outer_scope_info(outer_scope_info);
|
| }
|
| - parse_info_->set_shared_info(handle(function_->shared(), isolate_));
|
| + parse_info_->set_shared_info(shared_);
|
|
|
| {
|
| // Create a canonical handle scope if compiling ignition bytecode. This is
|
| @@ -174,7 +172,8 @@ bool CompilerDispatcherJob::PrepareToCompileOnMainThread() {
|
| DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
|
| DCHECK(status() == CompileJobStatus::kReadyToAnalyse);
|
|
|
| - compile_info_.reset(new CompilationInfo(parse_info_.get(), function_));
|
| + compile_info_.reset(
|
| + new CompilationInfo(parse_info_.get(), Handle<JSFunction>::null()));
|
|
|
| DeferredHandleScope scope(isolate_);
|
| if (Compiler::Analyze(parse_info_.get())) {
|
|
|