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

Side by Side Diff: src/compiler.cc

Issue 42020: - Added ability to call histograms from within v8... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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/api.cc ('k') | src/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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // Check for parse errors. 104 // Check for parse errors.
105 if (lit == NULL) { 105 if (lit == NULL) {
106 ASSERT(Top::has_pending_exception()); 106 ASSERT(Top::has_pending_exception());
107 return Handle<JSFunction>::null(); 107 return Handle<JSFunction>::null();
108 } 108 }
109 109
110 // Measure how long it takes to do the compilation; only take the 110 // Measure how long it takes to do the compilation; only take the
111 // rest of the function into account to avoid overlap with the 111 // rest of the function into account to avoid overlap with the
112 // parsing statistics. 112 // parsing statistics.
113 StatsRate* rate = is_eval 113 HistogramTimer* rate = is_eval
114 ? &Counters::compile_eval 114 ? &Counters::compile_eval
115 : &Counters::compile; 115 : &Counters::compile;
116 StatsRateScope timer(rate); 116 HistogramTimerScope timer(rate);
117 117
118 // Compile the code. 118 // Compile the code.
119 Handle<Code> code = MakeCode(lit, script, context, is_eval); 119 Handle<Code> code = MakeCode(lit, script, context, is_eval);
120 120
121 // Check for stack-overflow exceptions. 121 // Check for stack-overflow exceptions.
122 if (code.is_null()) { 122 if (code.is_null()) {
123 Top::StackOverflow(); 123 Top::StackOverflow();
124 return Handle<JSFunction>::null(); 124 return Handle<JSFunction>::null();
125 } 125 }
126 126
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 ASSERT(Top::has_pending_exception()); 293 ASSERT(Top::has_pending_exception());
294 return false; 294 return false;
295 } 295 }
296 296
297 // Update the loop nesting in the function literal. 297 // Update the loop nesting in the function literal.
298 lit->set_loop_nesting(loop_nesting); 298 lit->set_loop_nesting(loop_nesting);
299 299
300 // Measure how long it takes to do the lazy compilation; only take 300 // Measure how long it takes to do the lazy compilation; only take
301 // the rest of the function into account to avoid overlap with the 301 // the rest of the function into account to avoid overlap with the
302 // lazy parsing statistics. 302 // lazy parsing statistics.
303 StatsRateScope timer(&Counters::compile_lazy); 303 HistogramTimerScope timer(&Counters::compile_lazy);
304 304
305 // Compile the code. 305 // Compile the code.
306 Handle<Code> code = MakeCode(lit, script, Handle<Context>::null(), false); 306 Handle<Code> code = MakeCode(lit, script, Handle<Context>::null(), false);
307 307
308 // Check for stack-overflow exception. 308 // Check for stack-overflow exception.
309 if (code.is_null()) { 309 if (code.is_null()) {
310 Top::StackOverflow(); 310 Top::StackOverflow();
311 return false; 311 return false;
312 } 312 }
313 313
(...skipping 27 matching lines...) Expand all
341 // Set the expected number of properties for instances. 341 // Set the expected number of properties for instances.
342 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 342 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
343 343
344 // Check the function has compiled code. 344 // Check the function has compiled code.
345 ASSERT(shared->is_compiled()); 345 ASSERT(shared->is_compiled());
346 return true; 346 return true;
347 } 347 }
348 348
349 349
350 } } // namespace v8::internal 350 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698