Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: src/runtime/runtime-internal.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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/runtime/runtime-internal.cc
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index c1ef69efdc027325f00160b6c655371132ca3e70..b382173ba608489429900ba88ac23a077fbfff23 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -15,7 +15,7 @@
#include "src/isolate-inl.h"
#include "src/messages.h"
#include "src/parsing/parse-info.h"
-#include "src/parsing/parser.h"
+#include "src/parsing/parsing.h"
#include "src/wasm/wasm-module.h"
namespace v8 {
@@ -389,11 +389,16 @@ Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
MessageLocation location;
if (ComputeLocation(isolate, &location)) {
Zone zone(isolate->allocator(), ZONE_NAME);
- std::unique_ptr<ParseInfo> info(
- location.function()->shared()->is_function()
- ? new ParseInfo(&zone, handle(location.function()->shared()))
- : new ParseInfo(&zone, location.script()));
- if (Parser::ParseStatic(info.get())) {
+ bool successfully_parsed = false;
+ std::unique_ptr<ParseInfo> info;
+ if (location.function()->shared()->is_function()) {
+ info.reset(new ParseInfo(&zone, handle(location.function()->shared())));
+ successfully_parsed = parsing::ParseFunction(info.get());
+ } else {
+ info.reset(new ParseInfo(&zone, location.script()));
+ successfully_parsed = parsing::ParseProgram(info.get());
+ }
+ if (successfully_parsed) {
CallPrinter printer(isolate,
location.function()->shared()->IsUserJavaScript());
Handle<String> str = printer.Print(info->literal(), location.start_pos());

Powered by Google App Engine
This is Rietveld 408576698