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

Unified Diff: src/debug.cc

Issue 692453002: Reland "In PrepareForBreakPoints, also purge shared function info not referenced by functions." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 years, 2 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 | test/mjsunit/regress/regress-crbug-424142.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 6521110a61dc61ebb12271ed7a4bdbd1be2ea08d..4a58766e53d340c551e1d8925437e5367b212ffe 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1894,6 +1894,23 @@ static void RecompileAndRelocateSuspendedGenerators(
}
+static bool SkipSharedFunctionInfo(SharedFunctionInfo* shared,
+ Object* active_code_marker) {
+ if (!shared->allows_lazy_compilation()) return true;
+ if (!shared->script()->IsScript()) return true;
+ Object* script = shared->script();
+ if (!script->IsScript()) return true;
+ if (Script::cast(script)->type()->value() == Script::TYPE_NATIVE) return true;
+ Code* shared_code = shared->code();
+ return shared_code->gc_metadata() == active_code_marker;
+}
+
+
+static inline bool HasDebugBreakSlots(Code* code) {
+ return code->kind() == Code::FUNCTION && code->has_debug_break_slots();
+}
+
+
void Debug::PrepareForBreakPoints() {
// If preparing for the first break point make sure to deoptimize all
// functions as debugging does not work with optimized code.
@@ -1959,35 +1976,28 @@ void Debug::PrepareForBreakPoints() {
if (obj->IsJSFunction()) {
JSFunction* function = JSFunction::cast(obj);
SharedFunctionInfo* shared = function->shared();
-
- if (!shared->allows_lazy_compilation()) continue;
- if (!shared->script()->IsScript()) continue;
- if (function->IsFromNativeScript()) continue;
- if (shared->code()->gc_metadata() == active_code_marker) continue;
-
+ if (SkipSharedFunctionInfo(shared, active_code_marker)) continue;
if (shared->is_generator()) {
generator_functions.Add(Handle<JSFunction>(function, isolate_));
continue;
}
-
+ if (HasDebugBreakSlots(function->code())) continue;
+ Code* fallback = HasDebugBreakSlots(shared->code()) ? shared->code()
+ : *lazy_compile;
Code::Kind kind = function->code()->kind();
- if (kind == Code::FUNCTION &&
- !function->code()->has_debug_break_slots()) {
- function->ReplaceCode(*lazy_compile);
- function->shared()->ReplaceCode(*lazy_compile);
- } else if (kind == Code::BUILTIN &&
- (function->IsInOptimizationQueue() ||
- function->IsMarkedForOptimization() ||
- function->IsMarkedForConcurrentOptimization())) {
- // Abort in-flight compilation.
- Code* shared_code = function->shared()->code();
- if (shared_code->kind() == Code::FUNCTION &&
- shared_code->has_debug_break_slots()) {
- function->ReplaceCode(shared_code);
- } else {
- function->ReplaceCode(*lazy_compile);
- function->shared()->ReplaceCode(*lazy_compile);
- }
+ if (kind == Code::FUNCTION ||
+ (kind == Code::BUILTIN && // Abort in-flight compilation.
+ (function->IsInOptimizationQueue() ||
+ function->IsMarkedForOptimization() ||
+ function->IsMarkedForConcurrentOptimization()))) {
+ function->ReplaceCode(fallback);
+ }
+ if (kind == Code::OPTIMIZED_FUNCTION) {
+ // Optimized code can only get here if DeoptimizeAll did not
+ // deoptimize turbo fan code.
+ DCHECK(!FLAG_turbo_deoptimization);
+ DCHECK(function->code()->is_turbofanned());
+ function->ReplaceCode(fallback);
}
} else if (obj->IsJSGeneratorObject()) {
JSGeneratorObject* gen = JSGeneratorObject::cast(obj);
@@ -2007,6 +2017,12 @@ void Debug::PrepareForBreakPoints() {
gen->set_continuation(code_offset);
suspended_generators.Add(Handle<JSGeneratorObject>(gen, isolate_));
+ } else if (obj->IsSharedFunctionInfo()) {
+ SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj);
+ if (SkipSharedFunctionInfo(shared, active_code_marker)) continue;
+ if (shared->is_generator()) continue;
+ if (HasDebugBreakSlots(shared->code())) continue;
+ shared->ReplaceCode(*lazy_compile);
}
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-424142.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698