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

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

Issue 5621005: Fix strict aliasing rule violation in runtime-profiler.cc (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years 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 | « no previous file | no next file » | 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 static int sampler_threshold = kSamplerThresholdInit; 88 static int sampler_threshold = kSamplerThresholdInit;
89 static int sampler_threshold_size_factor = kSamplerThresholdSizeFactorInit; 89 static int sampler_threshold_size_factor = kSamplerThresholdSizeFactorInit;
90 90
91 91
92 // The JSFunctions in the sampler window are not GC safe. Old-space 92 // The JSFunctions in the sampler window are not GC safe. Old-space
93 // pointers are not cleared during mark-sweep collection and therefore 93 // pointers are not cleared during mark-sweep collection and therefore
94 // the window might contain stale pointers. The window is updated on 94 // the window might contain stale pointers. The window is updated on
95 // scavenges and (parts of it) cleared on mark-sweep and 95 // scavenges and (parts of it) cleared on mark-sweep and
96 // mark-sweep-compact. 96 // mark-sweep-compact.
97 static JSFunction* sampler_window[kSamplerWindowSize] = { NULL, }; 97 static Object* sampler_window[kSamplerWindowSize] = { NULL, };
98 static int sampler_window_position = 0; 98 static int sampler_window_position = 0;
99 static int sampler_window_weight[kSamplerWindowSize] = { 0, }; 99 static int sampler_window_weight[kSamplerWindowSize] = { 0, };
100 100
101 101
102 // Support for pending 'optimize soon' requests. 102 // Support for pending 'optimize soon' requests.
103 static PendingListNode* optimize_soon_list = NULL; 103 static PendingListNode* optimize_soon_list = NULL;
104 104
105 105
106 PendingListNode::PendingListNode(JSFunction* function) : next_(NULL) { 106 PendingListNode::PendingListNode(JSFunction* function) : next_(NULL) {
107 function_ = GlobalHandles::Create(function); 107 function_ = GlobalHandles::Create(function);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 sampler_window[i] = NULL; 213 sampler_window[i] = NULL;
214 sampler_window_weight[i] = 0; 214 sampler_window_weight[i] = 0;
215 } 215 }
216 } 216 }
217 } 217 }
218 218
219 219
220 static int LookupSample(JSFunction* function) { 220 static int LookupSample(JSFunction* function) {
221 int weight = 0; 221 int weight = 0;
222 for (int i = 0; i < kSamplerWindowSize; i++) { 222 for (int i = 0; i < kSamplerWindowSize; i++) {
223 JSFunction* sample = sampler_window[i]; 223 Object* sample = sampler_window[i];
224 if (sample != NULL) { 224 if (sample != NULL) {
225 if (function == sample) { 225 if (function == sample) {
226 weight += sampler_window_weight[i]; 226 weight += sampler_window_weight[i];
227 } 227 }
228 } 228 }
229 } 229 }
230 return weight; 230 return weight;
231 } 231 }
232 232
233 233
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 sampler_threshold_size_factor = kSamplerThresholdSizeFactorInit; 344 sampler_threshold_size_factor = kSamplerThresholdSizeFactorInit;
345 } 345 }
346 346
347 347
348 void RuntimeProfiler::TearDown() { 348 void RuntimeProfiler::TearDown() {
349 // Nothing to do. 349 // Nothing to do.
350 } 350 }
351 351
352 352
353 Object** RuntimeProfiler::SamplerWindowAddress() { 353 Object** RuntimeProfiler::SamplerWindowAddress() {
354 return reinterpret_cast<Object**>(sampler_window); 354 return sampler_window;
355 } 355 }
356 356
357 357
358 int RuntimeProfiler::SamplerWindowSize() { 358 int RuntimeProfiler::SamplerWindowSize() {
359 return kSamplerWindowSize; 359 return kSamplerWindowSize;
360 } 360 }
361 361
362 362
363 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { 363 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() {
364 static const int kNonJSTicksThreshold = 100; 364 static const int kNonJSTicksThreshold = 100;
(...skipping 11 matching lines...) Expand all
376 } else { 376 } else {
377 if (Top::WaitForJSState()) return true; 377 if (Top::WaitForJSState()) return true;
378 } 378 }
379 } 379 }
380 } 380 }
381 return false; 381 return false;
382 } 382 }
383 383
384 384
385 } } // namespace v8::internal 385 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698