OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 Comment::~Comment() { | 52 Comment::~Comment() { |
53 if (msg_[0] == '[') __ RecordComment("]"); | 53 if (msg_[0] == '[') __ RecordComment("]"); |
54 } | 54 } |
55 | 55 |
56 #endif // DEBUG | 56 #endif // DEBUG |
57 | 57 |
58 #undef __ | 58 #undef __ |
59 | 59 |
60 | 60 |
61 void CodeGenerator::MakeCodePrologue(CompilationInfo* info) { | 61 void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) { |
62 #ifdef DEBUG | |
63 bool print_source = false; | 62 bool print_source = false; |
64 bool print_ast = false; | 63 bool print_ast = false; |
65 const char* ftype; | 64 const char* ftype; |
66 | 65 |
67 if (Isolate::Current()->bootstrapper()->IsActive()) { | 66 if (info->isolate()->bootstrapper()->IsActive()) { |
68 print_source = FLAG_print_builtin_source; | 67 print_source = FLAG_print_builtin_source; |
69 print_ast = FLAG_print_builtin_ast; | 68 print_ast = FLAG_print_builtin_ast; |
70 ftype = "builtin"; | 69 ftype = "builtin"; |
71 } else { | 70 } else { |
72 print_source = FLAG_print_source; | 71 print_source = FLAG_print_source; |
73 print_ast = FLAG_print_ast; | 72 print_ast = FLAG_print_ast; |
74 ftype = "user-defined"; | 73 ftype = "user-defined"; |
75 } | 74 } |
76 | 75 |
77 if (FLAG_trace_codegen || print_source || print_ast) { | 76 if (FLAG_trace_codegen || print_source || print_ast) { |
78 PrintF("*** Generate code for %s function: ", ftype); | 77 PrintF("[generating %s code for %s function: ", kind, ftype); |
79 if (info->IsStub()) { | 78 if (info->IsStub()) { |
80 const char* name = | 79 const char* name = |
81 CodeStub::MajorName(info->code_stub()->MajorKey(), true); | 80 CodeStub::MajorName(info->code_stub()->MajorKey(), true); |
82 PrintF("%s", name == NULL ? "<unknown>" : name); | 81 PrintF("%s", name == NULL ? "<unknown>" : name); |
83 } else { | 82 } else { |
84 info->function()->name()->ShortPrint(); | 83 PrintF("%s", *info->function()->debug_name()->ToCString()); |
85 } | 84 } |
86 PrintF(" ***\n"); | 85 PrintF("]\n"); |
87 } | 86 } |
88 | 87 |
| 88 #ifdef DEBUG |
89 if (!info->IsStub() && print_source) { | 89 if (!info->IsStub() && print_source) { |
90 PrintF("--- Source from AST ---\n%s\n", | 90 PrintF("--- Source from AST ---\n%s\n", |
91 PrettyPrinter().PrintProgram(info->function())); | 91 PrettyPrinter().PrintProgram(info->function())); |
92 } | 92 } |
93 | 93 |
94 if (!info->IsStub() && print_ast) { | 94 if (!info->IsStub() && print_ast) { |
95 PrintF("--- AST ---\n%s\n", | 95 PrintF("--- AST ---\n%s\n", |
96 AstPrinter().PrintProgram(info->function())); | 96 AstPrinter().PrintProgram(info->function())); |
97 } | 97 } |
98 #endif // DEBUG | 98 #endif // DEBUG |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 ASSERT(result_size_ == 1 || result_size_ == 2); | 224 ASSERT(result_size_ == 1 || result_size_ == 2); |
225 #ifdef _WIN64 | 225 #ifdef _WIN64 |
226 return result | ((result_size_ == 1) ? 0 : 2); | 226 return result | ((result_size_ == 1) ? 0 : 2); |
227 #else | 227 #else |
228 return result; | 228 return result; |
229 #endif | 229 #endif |
230 } | 230 } |
231 | 231 |
232 | 232 |
233 } } // namespace v8::internal | 233 } } // namespace v8::internal |
OLD | NEW |