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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 // We're using on-stack replacement: patch the unoptimized code so that | 171 // We're using on-stack replacement: patch the unoptimized code so that |
172 // any back edge in any unoptimized frame will trigger on-stack | 172 // any back edge in any unoptimized frame will trigger on-stack |
173 // replacement for that frame. | 173 // replacement for that frame. |
174 if (FLAG_trace_osr) { | 174 if (FLAG_trace_osr) { |
175 PrintF("[patching back edges in "); | 175 PrintF("[patching back edges in "); |
176 function->PrintName(); | 176 function->PrintName(); |
177 PrintF(" for on-stack replacement]\n"); | 177 PrintF(" for on-stack replacement]\n"); |
178 } | 178 } |
179 | 179 |
180 // Get the interrupt stub code object to match against. We aren't | 180 Deoptimizer::PatchInterruptCode(isolate_, shared->code()); |
181 // prepared to generate it, but we don't expect to have to. | |
182 Code* interrupt_code = NULL; | |
183 InterruptStub interrupt_stub; | |
184 bool found_code = interrupt_stub.FindCodeInCache(&interrupt_code, isolate_); | |
185 if (found_code) { | |
186 Code* replacement_code = | |
187 isolate_->builtins()->builtin(Builtins::kOnStackReplacement); | |
188 Code* unoptimized_code = shared->code(); | |
189 Deoptimizer::PatchInterruptCode( | |
190 unoptimized_code, interrupt_code, replacement_code); | |
191 } | |
192 } | 181 } |
193 | 182 |
194 | 183 |
195 void RuntimeProfiler::ClearSampleBuffer() { | 184 void RuntimeProfiler::ClearSampleBuffer() { |
196 memset(sampler_window_, 0, sizeof(sampler_window_)); | 185 memset(sampler_window_, 0, sizeof(sampler_window_)); |
197 memset(sampler_window_weight_, 0, sizeof(sampler_window_weight_)); | 186 memset(sampler_window_weight_, 0, sizeof(sampler_window_weight_)); |
198 } | 187 } |
199 | 188 |
200 | 189 |
201 int RuntimeProfiler::LookupSample(JSFunction* function) { | 190 int RuntimeProfiler::LookupSample(JSFunction* function) { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 425 |
437 | 426 |
438 void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) { | 427 void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) { |
439 for (int i = 0; i < kSamplerWindowSize; i++) { | 428 for (int i = 0; i < kSamplerWindowSize; i++) { |
440 visitor->VisitPointer(&sampler_window_[i]); | 429 visitor->VisitPointer(&sampler_window_[i]); |
441 } | 430 } |
442 } | 431 } |
443 | 432 |
444 | 433 |
445 } } // namespace v8::internal | 434 } } // namespace v8::internal |
OLD | NEW |