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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // Compile the code. | 286 // Compile the code. |
287 Handle<Code> code = MakeCode(lit, script, false); | 287 Handle<Code> code = MakeCode(lit, script, false); |
288 | 288 |
289 // Check for stack-overflow exception. | 289 // Check for stack-overflow exception. |
290 if (code.is_null()) { | 290 if (code.is_null()) { |
291 Top::StackOverflow(); | 291 Top::StackOverflow(); |
292 return false; | 292 return false; |
293 } | 293 } |
294 | 294 |
295 // Generate the code, update the function info, and return the code. | 295 // Generate the code, update the function info, and return the code. |
296 LOG(CodeCreateEvent("LazyCompile", *code, *lit->name())); | 296 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 297 if (script->name()->IsString()) { |
| 298 int lineNum = script->GetLineNumber(start_position); |
| 299 if (lineNum > 0) { |
| 300 lineNum += script->line_offset()->value() + 1; |
| 301 } |
| 302 LOG(CodeCreateEvent("LazyCompile", *code, *lit->name(), |
| 303 String::cast(script->name()), lineNum)); |
| 304 } else { |
| 305 LOG(CodeCreateEvent("LazyCompile", *code, *lit->name())); |
| 306 } |
| 307 #endif |
297 | 308 |
298 // Update the shared function info with the compiled code. | 309 // Update the shared function info with the compiled code. |
299 shared->set_code(*code); | 310 shared->set_code(*code); |
300 | 311 |
301 // Set the expected number of properties for instances. | 312 // Set the expected number of properties for instances. |
302 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); | 313 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
303 | 314 |
304 // Check the function has compiled code. | 315 // Check the function has compiled code. |
305 ASSERT(shared->is_compiled()); | 316 ASSERT(shared->is_compiled()); |
306 return true; | 317 return true; |
307 } | 318 } |
308 | 319 |
309 | 320 |
310 } } // namespace v8::internal | 321 } } // namespace v8::internal |
OLD | NEW |