Commit 90d28637 authored by Wiktor Garbacz's avatar Wiktor Garbacz Committed by Commit Bot

Remove isolate param from DeserializeScopeChain.

It was removed so that Parser::DeserializeScopeChain does not have
 to get it from ParseInfo.
Only a small step in direction of removing isolate from ParseInfo.

BUG=v8:6093

Change-Id: Iaaf92dc6eb5ec9c4efc05ac73666fbc66e0ed8c1
Reviewed-on: https://chromium-review.googlesource.com/457999
Commit-Queue: Wiktor Garbacz <wiktorg@google.com>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarJochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44057}
parent 1a7a6057
...@@ -201,10 +201,11 @@ ModuleScope::ModuleScope(DeclarationScope* script_scope, ...@@ -201,10 +201,11 @@ ModuleScope::ModuleScope(DeclarationScope* script_scope,
DeclareThis(ast_value_factory); DeclareThis(ast_value_factory);
} }
ModuleScope::ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info, ModuleScope::ModuleScope(Handle<ScopeInfo> scope_info,
AstValueFactory* avfactory) AstValueFactory* avfactory)
: DeclarationScope(avfactory->zone(), MODULE_SCOPE, scope_info) { : DeclarationScope(avfactory->zone(), MODULE_SCOPE, scope_info) {
Zone* zone = avfactory->zone(); Zone* zone = avfactory->zone();
Isolate* isolate = scope_info->GetIsolate();
Handle<ModuleInfo> module_info(scope_info->ModuleDescriptorInfo(), isolate); Handle<ModuleInfo> module_info(scope_info->ModuleDescriptorInfo(), isolate);
set_language_mode(STRICT); set_language_mode(STRICT);
...@@ -384,8 +385,7 @@ bool Scope::IsAsmFunction() const { ...@@ -384,8 +385,7 @@ bool Scope::IsAsmFunction() const {
return is_function_scope() && AsDeclarationScope()->asm_function(); return is_function_scope() && AsDeclarationScope()->asm_function();
} }
Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone, Scope* Scope::DeserializeScopeChain(Zone* zone, ScopeInfo* scope_info,
ScopeInfo* scope_info,
DeclarationScope* script_scope, DeclarationScope* script_scope,
AstValueFactory* ast_value_factory, AstValueFactory* ast_value_factory,
DeserializationMode deserialization_mode) { DeserializationMode deserialization_mode) {
...@@ -430,8 +430,8 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone, ...@@ -430,8 +430,8 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone,
outer_scope = new (zone) Scope(zone, BLOCK_SCOPE, handle(scope_info)); outer_scope = new (zone) Scope(zone, BLOCK_SCOPE, handle(scope_info));
} }
} else if (scope_info->scope_type() == MODULE_SCOPE) { } else if (scope_info->scope_type() == MODULE_SCOPE) {
outer_scope = new (zone) outer_scope =
ModuleScope(isolate, handle(scope_info), ast_value_factory); new (zone) ModuleScope(handle(scope_info), ast_value_factory);
} else { } else {
DCHECK_EQ(scope_info->scope_type(), CATCH_SCOPE); DCHECK_EQ(scope_info->scope_type(), CATCH_SCOPE);
DCHECK_EQ(scope_info->LocalCount(), 1); DCHECK_EQ(scope_info->LocalCount(), 1);
...@@ -441,8 +441,8 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone, ...@@ -441,8 +441,8 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone,
String* name = scope_info->ContextLocalName(0); String* name = scope_info->ContextLocalName(0);
MaybeAssignedFlag maybe_assigned = MaybeAssignedFlag maybe_assigned =
scope_info->ContextLocalMaybeAssignedFlag(0); scope_info->ContextLocalMaybeAssignedFlag(0);
outer_scope = new (zone) outer_scope =
Scope(zone, ast_value_factory->GetString(handle(name, isolate)), new (zone) Scope(zone, ast_value_factory->GetString(handle(name)),
maybe_assigned, handle(scope_info)); maybe_assigned, handle(scope_info));
} }
if (deserialization_mode == DeserializationMode::kScopesOnly) { if (deserialization_mode == DeserializationMode::kScopesOnly) {
...@@ -633,7 +633,7 @@ void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) { ...@@ -633,7 +633,7 @@ void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) {
DeclarationScope(info->zone(), info->ast_value_factory()); DeclarationScope(info->zone(), info->ast_value_factory());
info->set_script_scope(script_scope); info->set_script_scope(script_scope);
scope->ReplaceOuterScope(Scope::DeserializeScopeChain( scope->ReplaceOuterScope(Scope::DeserializeScopeChain(
info->isolate(), info->zone(), *outer_scope_info, script_scope, info->zone(), *outer_scope_info, script_scope,
info->ast_value_factory(), info->ast_value_factory(),
Scope::DeserializationMode::kIncludingVariables)); Scope::DeserializationMode::kIncludingVariables));
} else { } else {
......
...@@ -132,8 +132,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -132,8 +132,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
enum class DeserializationMode { kIncludingVariables, kScopesOnly }; enum class DeserializationMode { kIncludingVariables, kScopesOnly };
static Scope* DeserializeScopeChain(Isolate* isolate, Zone* zone, static Scope* DeserializeScopeChain(Zone* zone, ScopeInfo* scope_info,
ScopeInfo* scope_info,
DeclarationScope* script_scope, DeclarationScope* script_scope,
AstValueFactory* ast_value_factory, AstValueFactory* ast_value_factory,
DeserializationMode deserialization_mode); DeserializationMode deserialization_mode);
...@@ -983,8 +982,7 @@ class ModuleScope final : public DeclarationScope { ...@@ -983,8 +982,7 @@ class ModuleScope final : public DeclarationScope {
// The generated ModuleDescriptor does not preserve all information. In // The generated ModuleDescriptor does not preserve all information. In
// particular, its module_requests map will be empty because we no longer need // particular, its module_requests map will be empty because we no longer need
// the map after parsing. // the map after parsing.
ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info, ModuleScope(Handle<ScopeInfo> scope_info, AstValueFactory* ast_value_factory);
AstValueFactory* ast_value_factory);
ModuleDescriptor* module() const { ModuleDescriptor* module() const {
DCHECK_NOT_NULL(module_descriptor_); DCHECK_NOT_NULL(module_descriptor_);
......
...@@ -568,7 +568,6 @@ Parser::Parser(ParseInfo* info) ...@@ -568,7 +568,6 @@ Parser::Parser(ParseInfo* info)
void Parser::DeserializeScopeChain( void Parser::DeserializeScopeChain(
ParseInfo* info, MaybeHandle<ScopeInfo> maybe_outer_scope_info) { ParseInfo* info, MaybeHandle<ScopeInfo> maybe_outer_scope_info) {
DCHECK(ThreadId::Current().Equals(info->isolate()->thread_id()));
// TODO(wingo): Add an outer SCRIPT_SCOPE corresponding to the native // TODO(wingo): Add an outer SCRIPT_SCOPE corresponding to the native
// context, which will have the "this" binding for script scopes. // context, which will have the "this" binding for script scopes.
DeclarationScope* script_scope = NewScriptScope(); DeclarationScope* script_scope = NewScriptScope();
...@@ -576,9 +575,11 @@ void Parser::DeserializeScopeChain( ...@@ -576,9 +575,11 @@ void Parser::DeserializeScopeChain(
Scope* scope = script_scope; Scope* scope = script_scope;
Handle<ScopeInfo> outer_scope_info; Handle<ScopeInfo> outer_scope_info;
if (maybe_outer_scope_info.ToHandle(&outer_scope_info)) { if (maybe_outer_scope_info.ToHandle(&outer_scope_info)) {
DCHECK(ThreadId::Current().Equals(
outer_scope_info->GetIsolate()->thread_id()));
scope = Scope::DeserializeScopeChain( scope = Scope::DeserializeScopeChain(
info->isolate(), zone(), *outer_scope_info, script_scope, zone(), *outer_scope_info, script_scope, ast_value_factory(),
ast_value_factory(), Scope::DeserializationMode::kScopesOnly); Scope::DeserializationMode::kScopesOnly);
DCHECK(!info->is_module() || scope->is_module_scope()); DCHECK(!info->is_module() || scope->is_module_scope());
} }
original_scope_ = scope; original_scope_ = scope;
......
...@@ -3157,7 +3157,7 @@ TEST(SerializationOfMaybeAssignmentFlag) { ...@@ -3157,7 +3157,7 @@ TEST(SerializationOfMaybeAssignmentFlag) {
i::DeclarationScope* script_scope = i::DeclarationScope* script_scope =
new (&zone) i::DeclarationScope(&zone, &avf); new (&zone) i::DeclarationScope(&zone, &avf);
i::Scope* s = i::Scope::DeserializeScopeChain( i::Scope* s = i::Scope::DeserializeScopeChain(
isolate, &zone, context->scope_info(), script_scope, &avf, &zone, context->scope_info(), script_scope, &avf,
i::Scope::DeserializationMode::kIncludingVariables); i::Scope::DeserializationMode::kIncludingVariables);
CHECK(s != script_scope); CHECK(s != script_scope);
CHECK(name != NULL); CHECK(name != NULL);
...@@ -3206,7 +3206,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) { ...@@ -3206,7 +3206,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) {
i::DeclarationScope* script_scope = i::DeclarationScope* script_scope =
new (&zone) i::DeclarationScope(&zone, &avf); new (&zone) i::DeclarationScope(&zone, &avf);
i::Scope* s = i::Scope::DeserializeScopeChain( i::Scope* s = i::Scope::DeserializeScopeChain(
isolate, &zone, context->scope_info(), script_scope, &avf, &zone, context->scope_info(), script_scope, &avf,
i::Scope::DeserializationMode::kIncludingVariables); i::Scope::DeserializationMode::kIncludingVariables);
CHECK(s != script_scope); CHECK(s != script_scope);
...@@ -3929,7 +3929,7 @@ i::Scope* DeserializeFunctionScope(i::Isolate* isolate, i::Zone* zone, ...@@ -3929,7 +3929,7 @@ i::Scope* DeserializeFunctionScope(i::Isolate* isolate, i::Zone* zone,
i::DeclarationScope* script_scope = i::DeclarationScope* script_scope =
new (zone) i::DeclarationScope(zone, &avf); new (zone) i::DeclarationScope(zone, &avf);
i::Scope* s = i::Scope::DeserializeScopeChain( i::Scope* s = i::Scope::DeserializeScopeChain(
isolate, zone, f->context()->scope_info(), script_scope, &avf, zone, f->context()->scope_info(), script_scope, &avf,
i::Scope::DeserializationMode::kIncludingVariables); i::Scope::DeserializationMode::kIncludingVariables);
return s; return s;
} }
......
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