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

Unified Diff: src/compiler.cc

Issue 1285793002: Debugger: correctly find closure to recompile eval for debugging. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mark toplevel eval as not allow recompile without context Created 5 years, 4 months 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
« no previous file with comments | « no previous file | src/debug/debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index ede006c04cf27d7cfb4709a31c554efb809a2bc0..2081c0648ede72b3fa8d75540e5329f39b6a5c7f 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1016,11 +1016,16 @@ bool CompileForDebugging(CompilationInfo* info) {
}
+static inline bool IsEvalToplevel(Handle<SharedFunctionInfo> shared) {
+ return shared->is_toplevel() && shared->script()->IsScript() &&
+ Script::cast(shared->script())->compilation_type() ==
+ Script::COMPILATION_TYPE_EVAL;
+}
+
+
bool Compiler::CompileDebugCode(Handle<JSFunction> function) {
Handle<SharedFunctionInfo> shared(function->shared());
- if (shared->is_toplevel() && shared->script()->IsScript() &&
- Script::cast(shared->script())->compilation_type() ==
- Script::COMPILATION_TYPE_EVAL) {
+ if (IsEvalToplevel(shared)) {
return CompileEvalForDebugging(function, shared);
} else {
CompilationInfoWithZone info(function);
@@ -1031,6 +1036,7 @@ bool Compiler::CompileDebugCode(Handle<JSFunction> function) {
bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) {
DCHECK(shared->allows_lazy_compilation_without_context());
+ DCHECK(!IsEvalToplevel(shared));
Zone zone;
ParseInfo parse_info(&zone, shared);
CompilationInfo info(&parse_info);
@@ -1141,6 +1147,10 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
SharedFunctionInfo::InitFromFunctionLiteral(result, lit);
SharedFunctionInfo::SetScript(result, script);
result->set_is_toplevel(true);
+ if (info->is_eval()) {
+ // Eval scripts cannot be (re-)compiled without context.
+ result->set_allows_lazy_compilation_without_context(false);
+ }
Handle<String> script_name = script->name()->IsString()
? Handle<String>(String::cast(script->name()))
« no previous file with comments | « no previous file | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698