Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 2db83f2ba0225a4910bbb340d3b6bb436e7068a1..15d9b3750ed4127ec95a8a6e49ec8c4f141169ca 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -5427,11 +5427,6 @@ void JSFunction::ReplaceCode(Code* code) { |
bool was_optimized = IsOptimized(); |
bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; |
- if (was_optimized && is_optimized) { |
- shared()->EvictFromOptimizedCodeMap( |
- this->code(), "Replacing with another optimized code"); |
- } |
- |
set_code(code); |
// Add/remove the function from the list of optimized functions for this |
@@ -5442,6 +5437,8 @@ void JSFunction::ReplaceCode(Code* code) { |
if (was_optimized && !is_optimized) { |
// TODO(titzer): linear in the number of optimized functions; fix! |
context()->native_context()->RemoveOptimizedFunction(this); |
+ shared()->EvictFromOptimizedCodeMap(context()->native_context(), |
+ "Removing optimized code"); |
} |
} |