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

Side by Side Diff: src/compiler.cc

Issue 10746: Track loop nesting across function calls when the function... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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/compiler.h ('k') | src/debug.cc » ('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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 script->set_line_offset(Smi::FromInt(line_offset)); 232 script->set_line_offset(Smi::FromInt(line_offset));
233 result = MakeFunction(is_global, true, script, NULL, NULL); 233 result = MakeFunction(is_global, true, script, NULL, NULL);
234 if (!result.is_null()) { 234 if (!result.is_null()) {
235 CompilationCache::PutFunction(source, entry, result); 235 CompilationCache::PutFunction(source, entry, result);
236 } 236 }
237 } 237 }
238 return result; 238 return result;
239 } 239 }
240 240
241 241
242 bool Compiler::CompileLazy(Handle<SharedFunctionInfo> shared) { 242 bool Compiler::CompileLazy(Handle<SharedFunctionInfo> shared,
243 int loop_nesting) {
243 ZoneScope zone_scope(DELETE_ON_EXIT); 244 ZoneScope zone_scope(DELETE_ON_EXIT);
244 245
245 // The VM is in the COMPILER state until exiting this function. 246 // The VM is in the COMPILER state until exiting this function.
246 VMState state(COMPILER); 247 VMState state(COMPILER);
247 248
248 // Make sure we have an initial stack limit. 249 // Make sure we have an initial stack limit.
249 StackGuard guard; 250 StackGuard guard;
250 PostponeInterruptsScope postpone; 251 PostponeInterruptsScope postpone;
251 252
252 // Compute name, source code and script data. 253 // Compute name, source code and script data.
(...skipping 11 matching lines...) Expand all
264 start_position, 265 start_position,
265 end_position, 266 end_position,
266 is_expression); 267 is_expression);
267 268
268 // Check for parse errors. 269 // Check for parse errors.
269 if (lit == NULL) { 270 if (lit == NULL) {
270 ASSERT(Top::has_pending_exception()); 271 ASSERT(Top::has_pending_exception());
271 return false; 272 return false;
272 } 273 }
273 274
275 // Update the loop nesting in the function literal.
276 lit->set_loop_nesting(loop_nesting);
277
274 // Measure how long it takes to do the lazy compilation; only take 278 // Measure how long it takes to do the lazy compilation; only take
275 // the rest of the function into account to avoid overlap with the 279 // the rest of the function into account to avoid overlap with the
276 // lazy parsing statistics. 280 // lazy parsing statistics.
277 StatsRateScope timer(&Counters::compile_lazy); 281 StatsRateScope timer(&Counters::compile_lazy);
278 282
279 // Compile the code. 283 // Compile the code.
280 Handle<Code> code = MakeCode(lit, script, false); 284 Handle<Code> code = MakeCode(lit, script, false);
281 285
282 // Check for stack-overflow exception. 286 // Check for stack-overflow exception.
283 if (code.is_null()) { 287 if (code.is_null()) {
(...skipping 10 matching lines...) Expand all
294 // Set the expected number of properties for instances. 298 // Set the expected number of properties for instances.
295 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 299 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
296 300
297 // Check the function has compiled code. 301 // Check the function has compiled code.
298 ASSERT(shared->is_compiled()); 302 ASSERT(shared->is_compiled());
299 return true; 303 return true;
300 } 304 }
301 305
302 306
303 } } // namespace v8::internal 307 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698