Chromium Code Reviews| Index: src/codegen.cc |
| diff --git a/src/codegen.cc b/src/codegen.cc |
| index 0163580e90001a1bd40e63065a45dea06d734002..7c1d260cded38cdcabc2909030829a9264794b7e 100644 |
| --- a/src/codegen.cc |
| +++ b/src/codegen.cc |
| @@ -120,19 +120,21 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
| if (print_code) { |
| // Print the source code if available. |
| FunctionLiteral* function = info->function(); |
| - Handle<Script> script = info->script(); |
| - if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
| - PrintF("--- Raw source ---\n"); |
| - StringInputBuffer stream(String::cast(script->source())); |
| - stream.Seek(function->start_position()); |
| - // fun->end_position() points to the last character in the stream. We |
| - // need to compensate by adding one to calculate the length. |
| - int source_len = |
| - function->end_position() - function->start_position() + 1; |
| - for (int i = 0; i < source_len; i++) { |
| - if (stream.has_more()) PrintF("%c", stream.GetNext()); |
| + if (code->kind() != Code::COMPILED_STUB) { |
| + Handle<Script> script = info->script(); |
| + if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
| + PrintF("--- Raw source ---\n"); |
| + StringInputBuffer stream(String::cast(script->source())); |
| + stream.Seek(function->start_position()); |
| + // fun->end_position() points to the last character in the stream. We |
| + // need to compensate by adding one to calculate the length. |
| + int source_len = |
| + function->end_position() - function->start_position() + 1; |
| + for (int i = 0; i < source_len; i++) { |
| + if (stream.has_more()) PrintF("%c", stream.GetNext()); |
| + } |
| + PrintF("\n\n"); |
| } |
| - PrintF("\n\n"); |
| } |
| if (info->IsOptimizing()) { |
| if (FLAG_print_unopt_code) { |
| @@ -144,7 +146,11 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
| } else { |
| PrintF("--- Code ---\n"); |
| } |
| - code->Disassemble(*function->debug_name()->ToCString()); |
| + if (info->IsStub()) { |
| + code->Disassemble(""); |
|
Jakob Kummerow
2012/11/28 16:28:22
use info->stub()->Major()?
danno
2012/11/30 16:23:24
Done.
|
| + } else { |
| + code->Disassemble(*function->debug_name()->ToCString()); |
| + } |
| } |
| #endif // ENABLE_DISASSEMBLER |
| } |