Commit 319d915c authored by Wiktor Garbacz's avatar Wiktor Garbacz Committed by Commit Bot

Make isolate explicit param of Rewriter::Rewrite

A step towards removing isolate from ParseInfo.
Removing isolate from ParseInfo will make it easier to create and
execute parse tasks on background threads.

BUG=v8:6093

Change-Id: I977eec8faecc8a112506f219994b4e4ec388b180
Reviewed-on: https://chromium-review.googlesource.com/458004
Commit-Queue: Wiktor Garbacz <wiktorg@google.com>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarDaniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44160}
parent 6c8d2852
......@@ -1194,7 +1194,7 @@ bool Compiler::Analyze(ParseInfo* info,
RuntimeCallTimerScope runtimeTimer(info->runtime_call_stats(),
&RuntimeCallStats::CompileAnalyse);
Isolate* isolate = info->isolate();
if (!Rewriter::Rewrite(info)) return false;
if (!Rewriter::Rewrite(info, isolate)) return false;
DeclarationScope::Analyze(info, isolate, AnalyzeMode::kRegular);
if (!Renumber(info, eager_literals)) {
return false;
......
......@@ -109,7 +109,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
// Inner function.
info.reset(new ParseInfo(shared_info));
}
if (parsing::ParseAny(info.get()) && Rewriter::Rewrite(info.get())) {
if (parsing::ParseAny(info.get()) && Rewriter::Rewrite(info.get(), isolate)) {
DeclarationScope* scope = info->literal()->scope();
if (!ignore_nested_scopes || collect_non_locals) {
CollectNonLocals(info.get(), scope);
......
......@@ -352,7 +352,7 @@ DECLARATION_NODE_LIST(DEF_VISIT)
// Assumes code has been parsed. Mutates the AST, so the AST should not
// continue to be used in the case of failure.
bool Rewriter::Rewrite(ParseInfo* info) {
bool Rewriter::Rewrite(ParseInfo* info, Isolate* isolate) {
DisallowHeapAllocation no_allocation;
DisallowHandleAllocation no_handles;
DisallowHandleDereference no_deref;
......@@ -400,14 +400,14 @@ bool Rewriter::Rewrite(ParseInfo* info) {
}
// TODO(leszeks): Remove this check and releases once internalization is
// moved out of parsing/analysis.
DCHECK(ThreadId::Current().Equals(info->isolate()->thread_id()));
// moved out of parsing/analysis. Also remove the parameter once done.
DCHECK(ThreadId::Current().Equals(isolate->thread_id()));
no_deref.Release();
no_handles.Release();
no_allocation.Release();
// Internalize any values created during rewriting.
info->ast_value_factory()->Internalize(info->isolate());
info->ast_value_factory()->Internalize(isolate);
if (processor.HasStackOverflow()) return false;
}
......
......@@ -10,6 +10,7 @@ namespace internal {
class AstValueFactory;
class DoExpression;
class Isolate;
class ParseInfo;
class Parser;
class DeclarationScope;
......@@ -23,7 +24,7 @@ class Rewriter {
//
// Assumes code has been parsed and scopes have been analyzed. Mutates the
// AST, so the AST should not continue to be used in the case of failure.
static bool Rewrite(ParseInfo* info);
static bool Rewrite(ParseInfo* info, Isolate* isolate);
// Rewrite a list of statements, using the same rules as a top-level program,
// to ensure identical behaviour of completion result. The temporary is added
......
......@@ -38,7 +38,7 @@ struct TestHelper : public HandleAndZoneScope {
function);
CHECK(parsing::ParseFunction(&parse_info));
CHECK(Rewriter::Rewrite(&parse_info));
CHECK(Rewriter::Rewrite(&parse_info, function->GetIsolate()));
DeclarationScope::Analyze(&parse_info, info.isolate(),
AnalyzeMode::kRegular);
......
......@@ -812,7 +812,7 @@ TEST(ScopeUsesArgumentsSuperThis) {
// The information we're checking is only produced when eager parsing.
info.set_allow_lazy_parsing(false);
CHECK(i::parsing::ParseProgram(&info));
CHECK(i::Rewriter::Rewrite(&info));
CHECK(i::Rewriter::Rewrite(&info, isolate));
i::DeclarationScope::Analyze(&info, isolate, i::AnalyzeMode::kRegular);
CHECK(info.literal() != NULL);
......
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