Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 54ea359c6598631674cb232499c4defd9409ba21..f5be30ecf3c278ea8e865993fcedcbef9f25463e 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -1755,16 +1755,18 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( |
maybe_existing = script->FindSharedFunctionInfo(literal); |
} |
- // We found an existing shared function info. If it's already compiled, |
- // don't worry about compiling it, and simply return it. If it's not yet |
- // compiled, continue to decide whether to eagerly compile. |
- // Carry on if we are compiling eager to obtain code for debugging, |
- // unless we already have code with debut break slots. |
+ // We found an existing shared function info. If it has any sort of code |
+ // attached, don't worry about compiling and simply return it. Otherwise, |
+ // continue to decide whether to eagerly compile. |
+ // Note that we also carry on if we are compiling eager to obtain code for |
+ // debugging, unless we already have code with debug break slots. |
Handle<SharedFunctionInfo> existing; |
- if (maybe_existing.ToHandle(&existing) && existing->is_compiled()) { |
+ if (maybe_existing.ToHandle(&existing)) { |
DCHECK(!existing->is_toplevel()); |
- if (!outer_info->is_debug() || existing->HasDebugCode()) { |
- return existing; |
+ if (existing->HasBaselineCode() || existing->HasBytecodeArray()) { |
+ if (!outer_info->is_debug() || existing->HasDebugCode()) { |
rmcilroy
2016/08/18 10:26:06
Should this be HasDebugCode() || HasDebugBytecode(
rmcilroy
2016/08/18 10:29:02
Sorry ignore this, HasDebugCode does what I though
|
+ return existing; |
+ } |
} |
} |