OLD | NEW |
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 8028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8039 if (type == Deoptimizer::EAGER) { | 8039 if (type == Deoptimizer::EAGER) { |
8040 RUNTIME_ASSERT(function->IsOptimized()); | 8040 RUNTIME_ASSERT(function->IsOptimized()); |
8041 } | 8041 } |
8042 | 8042 |
8043 // Avoid doing too much work when running with --always-opt and keep | 8043 // Avoid doing too much work when running with --always-opt and keep |
8044 // the optimized code around. | 8044 // the optimized code around. |
8045 if (FLAG_always_opt || type == Deoptimizer::LAZY) { | 8045 if (FLAG_always_opt || type == Deoptimizer::LAZY) { |
8046 return isolate->heap()->undefined_value(); | 8046 return isolate->heap()->undefined_value(); |
8047 } | 8047 } |
8048 | 8048 |
8049 // Find other optimized activations of the function. | 8049 // Find other optimized activations of the function or functions that |
| 8050 // share the same optimized code. |
8050 bool has_other_activations = false; | 8051 bool has_other_activations = false; |
8051 while (!it.done()) { | 8052 while (!it.done()) { |
8052 JavaScriptFrame* frame = it.frame(); | 8053 JavaScriptFrame* frame = it.frame(); |
8053 if (frame->is_optimized() && frame->function() == *function) { | 8054 JSFunction* other_function = JSFunction::cast(frame->function()); |
| 8055 if (frame->is_optimized() && other_function->code() == function->code()) { |
8054 has_other_activations = true; | 8056 has_other_activations = true; |
8055 break; | 8057 break; |
8056 } | 8058 } |
8057 it.Advance(); | 8059 it.Advance(); |
8058 } | 8060 } |
8059 | 8061 |
8060 if (!has_other_activations) { | 8062 if (!has_other_activations) { |
8061 ActivationsFinder activations_finder(*function); | 8063 ActivationsFinder activations_finder(*function); |
8062 isolate->thread_manager()->IterateArchivedThreads(&activations_finder); | 8064 isolate->thread_manager()->IterateArchivedThreads(&activations_finder); |
8063 has_other_activations = activations_finder.has_activations(); | 8065 has_other_activations = activations_finder.has_activations(); |
(...skipping 5223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13287 // Handle last resort GC and make sure to allow future allocations | 13289 // Handle last resort GC and make sure to allow future allocations |
13288 // to grow the heap without causing GCs (if possible). | 13290 // to grow the heap without causing GCs (if possible). |
13289 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13291 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13290 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13292 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13291 "Runtime::PerformGC"); | 13293 "Runtime::PerformGC"); |
13292 } | 13294 } |
13293 } | 13295 } |
13294 | 13296 |
13295 | 13297 |
13296 } } // namespace v8::internal | 13298 } } // namespace v8::internal |
OLD | NEW |