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

Side by Side Diff: src/runtime.cc

Issue 184923002: Clear optimized code cache in shared function info when code gets deoptimized (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix assert Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 8505 matching lines...) Expand 10 before | Expand all | Expand 10 after
8516 isolate->thread_manager()->IterateArchivedThreads(&activations_finder); 8516 isolate->thread_manager()->IterateArchivedThreads(&activations_finder);
8517 8517
8518 if (!activations_finder.has_code_activations_) { 8518 if (!activations_finder.has_code_activations_) {
8519 if (function->code() == *optimized_code) { 8519 if (function->code() == *optimized_code) {
8520 if (FLAG_trace_deopt) { 8520 if (FLAG_trace_deopt) {
8521 PrintF("[removing optimized code for: "); 8521 PrintF("[removing optimized code for: ");
8522 function->PrintName(); 8522 function->PrintName();
8523 PrintF("]\n"); 8523 PrintF("]\n");
8524 } 8524 }
8525 function->ReplaceCode(function->shared()->code()); 8525 function->ReplaceCode(function->shared()->code());
8526 // Evict optimized code for this function from the cache so that it
8527 // doesn't get used for new closures.
8528 function->shared()->EvictFromOptimizedCodeMap(*optimized_code,
8529 "notify deoptimized");
8526 } 8530 }
8527 } else { 8531 } else {
8528 // TODO(titzer): we should probably do DeoptimizeCodeList(code) 8532 // TODO(titzer): we should probably do DeoptimizeCodeList(code)
8529 // unconditionally if the code is not already marked for deoptimization. 8533 // unconditionally if the code is not already marked for deoptimization.
8530 // If there is an index by shared function info, all the better. 8534 // If there is an index by shared function info, all the better.
8531 Deoptimizer::DeoptimizeFunction(*function); 8535 Deoptimizer::DeoptimizeFunction(*function);
8532 } 8536 }
8533 // Evict optimized code for this function from the cache so that it doesn't
8534 // get used for new closures.
8535 function->shared()->EvictFromOptimizedCodeMap(
8536 function->context()->native_context(), "notify deoptimized");
8537 8537
8538 return isolate->heap()->undefined_value(); 8538 return isolate->heap()->undefined_value();
8539 } 8539 }
8540 8540
8541 8541
8542 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeoptimizeFunction) { 8542 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeoptimizeFunction) {
8543 HandleScope scope(isolate); 8543 HandleScope scope(isolate);
8544 ASSERT(args.length() == 1); 8544 ASSERT(args.length() == 1);
8545 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8545 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8546 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); 8546 if (!function->IsOptimized()) return isolate->heap()->undefined_value();
(...skipping 6418 matching lines...) Expand 10 before | Expand all | Expand 10 after
14965 // Handle last resort GC and make sure to allow future allocations 14965 // Handle last resort GC and make sure to allow future allocations
14966 // to grow the heap without causing GCs (if possible). 14966 // to grow the heap without causing GCs (if possible).
14967 isolate->counters()->gc_last_resort_from_js()->Increment(); 14967 isolate->counters()->gc_last_resort_from_js()->Increment();
14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14969 "Runtime::PerformGC"); 14969 "Runtime::PerformGC");
14970 } 14970 }
14971 } 14971 }
14972 14972
14973 14973
14974 } } // namespace v8::internal 14974 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/objects-inl.h ('k') | src/x64/deoptimizer-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698