Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime-profiler.cc

Issue 6793013: Cache optimized code on shared function info. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('k') | src/v8-counters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 memset(sampler_window_, 0, sizeof(sampler_window_)); 210 memset(sampler_window_, 0, sizeof(sampler_window_));
211 memset(sampler_window_weight_, 0, sizeof(sampler_window_weight_)); 211 memset(sampler_window_weight_, 0, sizeof(sampler_window_weight_));
212 } 212 }
213 213
214 214
215 int RuntimeProfiler::LookupSample(JSFunction* function) { 215 int RuntimeProfiler::LookupSample(JSFunction* function) {
216 int weight = 0; 216 int weight = 0;
217 for (int i = 0; i < kSamplerWindowSize; i++) { 217 for (int i = 0; i < kSamplerWindowSize; i++) {
218 Object* sample = sampler_window_[i]; 218 Object* sample = sampler_window_[i];
219 if (sample != NULL) { 219 if (sample != NULL) {
220 if (function == sample) { 220 bool fits = FLAG_lookup_sample_by_shared
221 ? (function->shared() == JSFunction::cast(sample)->shared())
222 : (function == JSFunction::cast(sample));
223 if (fits) {
221 weight += sampler_window_weight_[i]; 224 weight += sampler_window_weight_[i];
222 } 225 }
223 } 226 }
224 } 227 }
225 return weight; 228 return weight;
226 } 229 }
227 230
228 231
229 void RuntimeProfiler::AddSample(JSFunction* function, int weight) { 232 void RuntimeProfiler::AddSample(JSFunction* function, int weight) {
230 ASSERT(IsPowerOf2(kSamplerWindowSize)); 233 ASSERT(IsPowerOf2(kSamplerWindowSize));
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } else { 472 } else {
470 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); 473 return RuntimeProfiler::WaitForSomeIsolateToEnterJS();
471 } 474 }
472 } 475 }
473 #endif 476 #endif
474 return false; 477 return false;
475 } 478 }
476 479
477 480
478 } } // namespace v8::internal 481 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698