OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |