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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 memset(sampler_window_, 0, sizeof(sampler_window_)); | 211 memset(sampler_window_, 0, sizeof(sampler_window_)); |
212 memset(sampler_window_weight_, 0, sizeof(sampler_window_weight_)); | 212 memset(sampler_window_weight_, 0, sizeof(sampler_window_weight_)); |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 int RuntimeProfiler::LookupSample(JSFunction* function) { | 216 int RuntimeProfiler::LookupSample(JSFunction* function) { |
217 int weight = 0; | 217 int weight = 0; |
218 for (int i = 0; i < kSamplerWindowSize; i++) { | 218 for (int i = 0; i < kSamplerWindowSize; i++) { |
219 Object* sample = sampler_window_[i]; | 219 Object* sample = sampler_window_[i]; |
220 if (sample != NULL) { | 220 if (sample != NULL) { |
221 if (function == sample) { | 221 bool fits = FLAG_lookup_sample_by_shared |
| 222 ? (function->shared() == JSFunction::cast(sample)->shared()) |
| 223 : (function == JSFunction::cast(sample)); |
| 224 if (fits) { |
222 weight += sampler_window_weight_[i]; | 225 weight += sampler_window_weight_[i]; |
223 } | 226 } |
224 } | 227 } |
225 } | 228 } |
226 return weight; | 229 return weight; |
227 } | 230 } |
228 | 231 |
229 | 232 |
230 void RuntimeProfiler::AddSample(JSFunction* function, int weight) { | 233 void RuntimeProfiler::AddSample(JSFunction* function, int weight) { |
231 ASSERT(IsPowerOf2(kSamplerWindowSize)); | 234 ASSERT(IsPowerOf2(kSamplerWindowSize)); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 490 |
488 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { | 491 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { |
489 if (!RuntimeProfiler::IsSomeIsolateInJS()) { | 492 if (!RuntimeProfiler::IsSomeIsolateInJS()) { |
490 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); | 493 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); |
491 } | 494 } |
492 return false; | 495 return false; |
493 } | 496 } |
494 | 497 |
495 | 498 |
496 } } // namespace v8::internal | 499 } } // namespace v8::internal |
OLD | NEW |