| OLD | NEW |
| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 CompilationInfo info(lit, script, is_eval); | 210 CompilationInfo info(lit, script, is_eval); |
| 211 Handle<Code> code = MakeCode(context, &info); | 211 Handle<Code> code = MakeCode(context, &info); |
| 212 | 212 |
| 213 // Check for stack-overflow exceptions. | 213 // Check for stack-overflow exceptions. |
| 214 if (code.is_null()) { | 214 if (code.is_null()) { |
| 215 Top::StackOverflow(); | 215 Top::StackOverflow(); |
| 216 return Handle<SharedFunctionInfo>::null(); | 216 return Handle<SharedFunctionInfo>::null(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 if (script->name()->IsString()) { | 219 if (script->name()->IsString()) { |
| 220 PROFILE(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, | 220 PROFILE(CodeCreateEvent( |
| 221 *code, String::cast(script->name()))); | 221 is_eval ? Logger::EVAL_TAG : |
| 222 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
| 223 *code, String::cast(script->name()))); |
| 222 OPROFILE(CreateNativeCodeRegion(String::cast(script->name()), | 224 OPROFILE(CreateNativeCodeRegion(String::cast(script->name()), |
| 223 code->instruction_start(), | 225 code->instruction_start(), |
| 224 code->instruction_size())); | 226 code->instruction_size())); |
| 225 } else { | 227 } else { |
| 226 PROFILE(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, | 228 PROFILE(CodeCreateEvent( |
| 227 *code, "")); | 229 is_eval ? Logger::EVAL_TAG : |
| 230 Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
| 231 *code, "")); |
| 228 OPROFILE(CreateNativeCodeRegion(is_eval ? "Eval" : "Script", | 232 OPROFILE(CreateNativeCodeRegion(is_eval ? "Eval" : "Script", |
| 229 code->instruction_start(), | 233 code->instruction_start(), |
| 230 code->instruction_size())); | 234 code->instruction_size())); |
| 231 } | 235 } |
| 232 | 236 |
| 233 // Allocate function. | 237 // Allocate function. |
| 234 Handle<SharedFunctionInfo> result = | 238 Handle<SharedFunctionInfo> result = |
| 235 Factory::NewSharedFunctionInfo(lit->name(), | 239 Factory::NewSharedFunctionInfo(lit->name(), |
| 236 lit->materialized_literal_count(), | 240 lit->materialized_literal_count(), |
| 237 code); | 241 code); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 // Log the code generation. If source information is available | 589 // Log the code generation. If source information is available |
| 586 // include script name and line number. Check explicitly whether | 590 // include script name and line number. Check explicitly whether |
| 587 // logging is enabled as finding the line number is not free. | 591 // logging is enabled as finding the line number is not free. |
| 588 if (Logger::is_logging() | 592 if (Logger::is_logging() |
| 589 || OProfileAgent::is_enabled() | 593 || OProfileAgent::is_enabled() |
| 590 || CpuProfiler::is_profiling()) { | 594 || CpuProfiler::is_profiling()) { |
| 591 Handle<String> func_name(name->length() > 0 ? *name : *inferred_name); | 595 Handle<String> func_name(name->length() > 0 ? *name : *inferred_name); |
| 592 if (script->name()->IsString()) { | 596 if (script->name()->IsString()) { |
| 593 int line_num = GetScriptLineNumber(script, start_position) + 1; | 597 int line_num = GetScriptLineNumber(script, start_position) + 1; |
| 594 USE(line_num); | 598 USE(line_num); |
| 595 PROFILE(CodeCreateEvent(tag, *code, *func_name, | 599 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
| 600 *code, *func_name, |
| 596 String::cast(script->name()), line_num)); | 601 String::cast(script->name()), line_num)); |
| 597 OPROFILE(CreateNativeCodeRegion(*func_name, | 602 OPROFILE(CreateNativeCodeRegion(*func_name, |
| 598 String::cast(script->name()), | 603 String::cast(script->name()), |
| 599 line_num, | 604 line_num, |
| 600 code->instruction_start(), | 605 code->instruction_start(), |
| 601 code->instruction_size())); | 606 code->instruction_size())); |
| 602 } else { | 607 } else { |
| 603 PROFILE(CodeCreateEvent(tag, *code, *func_name)); | 608 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
| 609 *code, *func_name)); |
| 604 OPROFILE(CreateNativeCodeRegion(*func_name, | 610 OPROFILE(CreateNativeCodeRegion(*func_name, |
| 605 code->instruction_start(), | 611 code->instruction_start(), |
| 606 code->instruction_size())); | 612 code->instruction_size())); |
| 607 } | 613 } |
| 608 } | 614 } |
| 609 } | 615 } |
| 610 | 616 |
| 611 } } // namespace v8::internal | 617 } } // namespace v8::internal |
| OLD | NEW |