Chromium Code Reviews

Unified Diff: src/debug/debug-scopes.cc

Issue 2534393002: Split parsing of functions and top-level code into two separate methods (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/compiler.cc ('k') | src/parsing/parser.h » ('j') | src/parsing/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug-scopes.cc
diff --git a/src/debug/debug-scopes.cc b/src/debug/debug-scopes.cc
index fade076b18c189e1fae8583b1c1ac46a1c21cc35..b91657289edbc49dd1aa419f320a106848024594 100644
--- a/src/debug/debug-scopes.cc
+++ b/src/debug/debug-scopes.cc
@@ -6,13 +6,14 @@
#include <memory>
+#include "src/ast/ast.h"
#include "src/ast/scopes.h"
#include "src/debug/debug.h"
#include "src/frames-inl.h"
#include "src/globals.h"
#include "src/isolate-inl.h"
#include "src/parsing/parse-info.h"
-#include "src/parsing/parser.h"
+#include "src/parsing/parsing.h"
#include "src/parsing/rewriter.h"
namespace v8 {
@@ -88,6 +89,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
// Check whether we are in global, eval or function code.
Zone zone(isolate->allocator(), ZONE_NAME);
std::unique_ptr<ParseInfo> info;
+ bool successfully_parsed = false;
if (scope_info->scope_type() != FUNCTION_SCOPE) {
// Global or eval code.
Handle<Script> script(Script::cast(shared_info->script()));
@@ -105,11 +107,13 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
} else {
DCHECK(scope_info->scope_type() == SCRIPT_SCOPE);
}
+ successfully_parsed = parsing::ParseProgram(info.get());
} else {
// Inner function.
info.reset(new ParseInfo(&zone, shared_info));
+ successfully_parsed = parsing::ParseFunction(info.get());
}
- if (Parser::ParseStatic(info.get()) && Rewriter::Rewrite(info.get())) {
+ if (successfully_parsed && Rewriter::Rewrite(info.get())) {
DeclarationScope* scope = info->literal()->scope();
if (!ignore_nested_scopes || collect_non_locals) {
CollectNonLocals(info.get(), scope);
« no previous file with comments | « src/compiler.cc ('k') | src/parsing/parser.h » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine