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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 memset(sampler_window_, 0, sizeof(sampler_window_)); | 204 memset(sampler_window_, 0, sizeof(sampler_window_)); |
205 memset(sampler_window_weight_, 0, sizeof(sampler_window_weight_)); | 205 memset(sampler_window_weight_, 0, sizeof(sampler_window_weight_)); |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 int RuntimeProfiler::LookupSample(JSFunction* function) { | 209 int RuntimeProfiler::LookupSample(JSFunction* function) { |
210 int weight = 0; | 210 int weight = 0; |
211 for (int i = 0; i < kSamplerWindowSize; i++) { | 211 for (int i = 0; i < kSamplerWindowSize; i++) { |
212 Object* sample = sampler_window_[i]; | 212 Object* sample = sampler_window_[i]; |
213 if (sample != NULL) { | 213 if (sample != NULL) { |
214 if (function == sample) { | 214 bool fits = FLAG_lookup_sample_by_shared |
| 215 ? (function->shared() == JSFunction::cast(sample)->shared()) |
| 216 : (function == JSFunction::cast(sample)); |
| 217 if (fits) { |
215 weight += sampler_window_weight_[i]; | 218 weight += sampler_window_weight_[i]; |
216 } | 219 } |
217 } | 220 } |
218 } | 221 } |
219 return weight; | 222 return weight; |
220 } | 223 } |
221 | 224 |
222 | 225 |
223 void RuntimeProfiler::AddSample(JSFunction* function, int weight) { | 226 void RuntimeProfiler::AddSample(JSFunction* function, int weight) { |
224 ASSERT(IsPowerOf2(kSamplerWindowSize)); | 227 ASSERT(IsPowerOf2(kSamplerWindowSize)); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 467 |
465 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { | 468 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { |
466 if (!RuntimeProfiler::IsSomeIsolateInJS()) { | 469 if (!RuntimeProfiler::IsSomeIsolateInJS()) { |
467 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); | 470 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); |
468 } | 471 } |
469 return false; | 472 return false; |
470 } | 473 } |
471 | 474 |
472 | 475 |
473 } } // namespace v8::internal | 476 } } // namespace v8::internal |
OLD | NEW |