Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index 4ff1d83ee3a2ede94b0f609d9c3ec405b2a182cf..7152b112fb773de7930778bd817a8c024ee9cad5 100644 |
| --- a/src/compiler.cc |
| +++ b/src/compiler.cc |
| @@ -57,8 +57,6 @@ PARSE_INFO_GETTER(bool, is_native) |
| PARSE_INFO_GETTER(bool, is_module) |
| PARSE_INFO_GETTER(FunctionLiteral*, literal) |
| PARSE_INFO_GETTER_WITH_DEFAULT(LanguageMode, language_mode, STRICT) |
| -PARSE_INFO_GETTER_WITH_DEFAULT(Handle<JSFunction>, closure, |
| - Handle<JSFunction>::null()) |
| PARSE_INFO_GETTER_WITH_DEFAULT(Scope*, scope, nullptr) |
| PARSE_INFO_GETTER(Handle<Context>, context) |
| PARSE_INFO_GETTER(Handle<SharedFunctionInfo>, shared_info) |
| @@ -85,7 +83,7 @@ class CompilationHandleScope BASE_EMBEDDED { |
| class CompilationInfoWithZone : public CompilationInfo { |
| public: |
| explicit CompilationInfoWithZone(Handle<JSFunction> function) |
| - : CompilationInfo(new ParseInfo(&zone_, function)), |
| + : CompilationInfo(new ParseInfo(&zone_, function), function), |
| zone_(function->GetIsolate()->allocator()) {} |
| // Virtual destructor because a CompilationInfoWithZone has to exit the |
| @@ -119,10 +117,12 @@ bool CompilationInfo::has_scope() const { |
| return parse_info_ && parse_info_->scope() != nullptr; |
| } |
| - |
| -CompilationInfo::CompilationInfo(ParseInfo* parse_info) |
| +CompilationInfo::CompilationInfo(ParseInfo* parse_info, |
| + Handle<JSFunction> closure) |
| : CompilationInfo(parse_info, nullptr, Code::ComputeFlags(Code::FUNCTION), |
| BASE, parse_info->isolate(), parse_info->zone()) { |
| + closure_ = closure; |
| + |
| // Compiling for the snapshot typically results in different code than |
| // compiling later on. This means that code recompiled with deoptimization |
| // support won't be "equivalent" (as defined by SharedFunctionInfo:: |
| @@ -1155,7 +1155,7 @@ bool CompileEvalForDebugging(Handle<JSFunction> function, |
| Zone zone(function->GetIsolate()->allocator()); |
| ParseInfo parse_info(&zone, script); |
| - CompilationInfo info(&parse_info); |
| + CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
|
rossberg
2016/04/06 14:57:32
Given the frequency of this case, why not make nul
Michael Starzinger
2016/04/06 16:13:59
The frequency of this case is _only_ in compiler.c
|
| Isolate* isolate = info.isolate(); |
| parse_info.set_eval(); |
| @@ -1411,7 +1411,7 @@ bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) { |
| DCHECK(!IsEvalToplevel(shared)); |
| Zone zone(shared->GetIsolate()->allocator()); |
| ParseInfo parse_info(&zone, shared); |
| - CompilationInfo info(&parse_info); |
| + CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
| return CompileForDebugging(&info); |
| } |
| @@ -1463,7 +1463,7 @@ void Compiler::CompileForLiveEdit(Handle<Script> script) { |
| // TODO(635): support extensions. |
| Zone zone(script->GetIsolate()->allocator()); |
| ParseInfo parse_info(&zone, script); |
| - CompilationInfo info(&parse_info); |
| + CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
| PostponeInterruptsScope postpone(info.isolate()); |
| VMState<COMPILER> state(info.isolate()); |
| @@ -1505,7 +1505,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( |
| script->set_origin_options(options); |
| Zone zone(isolate->allocator()); |
| ParseInfo parse_info(&zone, script); |
| - CompilationInfo info(&parse_info); |
| + CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
| parse_info.set_eval(); |
| if (context->IsNativeContext()) parse_info.set_global(); |
| parse_info.set_language_mode(language_mode); |
| @@ -1629,7 +1629,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( |
| // Compile the function and add it to the cache. |
| Zone zone(isolate->allocator()); |
| ParseInfo parse_info(&zone, script); |
| - CompilationInfo info(&parse_info); |
| + CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
| if (is_module) { |
| parse_info.set_module(); |
| } else { |
| @@ -1686,7 +1686,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForStreamedScript( |
| parse_info->set_language_mode( |
| static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); |
| - CompilationInfo compile_info(parse_info); |
| + CompilationInfo compile_info(parse_info, Handle<JSFunction>::null()); |
| // The source was parsed lazily, so compiling for debugging is not possible. |
| DCHECK(!compile_info.is_debug()); |
| @@ -1733,7 +1733,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( |
| Zone zone(isolate->allocator()); |
| ParseInfo parse_info(&zone, script); |
| - CompilationInfo info(&parse_info); |
| + CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
| parse_info.set_literal(literal); |
| parse_info.set_shared_info(result); |
| parse_info.set_scope(literal->scope()); |