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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 ftype = "user-defined"; | 74 ftype = "user-defined"; |
75 } | 75 } |
76 | 76 |
77 if (FLAG_trace_codegen || print_source || print_ast) { | 77 if (FLAG_trace_codegen || print_source || print_ast) { |
78 PrintF("[generating %s code for %s function: ", kind, ftype); | 78 PrintF("[generating %s code for %s function: ", kind, ftype); |
79 if (info->IsStub()) { | 79 if (info->IsStub()) { |
80 const char* name = | 80 const char* name = |
81 CodeStub::MajorName(info->code_stub()->MajorKey(), true); | 81 CodeStub::MajorName(info->code_stub()->MajorKey(), true); |
82 PrintF("%s", name == NULL ? "<unknown>" : name); | 82 PrintF("%s", name == NULL ? "<unknown>" : name); |
83 } else { | 83 } else { |
84 PrintF("%s", *info->function()->debug_name()->ToCString()); | 84 PrintF("%s", info->function()->debug_name()->ToCString().get()); |
85 } | 85 } |
86 PrintF("]\n"); | 86 PrintF("]\n"); |
87 } | 87 } |
88 | 88 |
89 #ifdef DEBUG | 89 #ifdef DEBUG |
90 if (!info->IsStub() && print_source) { | 90 if (!info->IsStub() && print_source) { |
91 PrintF("--- Source from AST ---\n%s\n", | 91 PrintF("--- Source from AST ---\n%s\n", |
92 PrettyPrinter(info->isolate()).PrintProgram(info->function())); | 92 PrettyPrinter(info->isolate()).PrintProgram(info->function())); |
93 } | 93 } |
94 | 94 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 PrintF(tracing_scope.file(), "%c", stream.GetNext()); | 155 PrintF(tracing_scope.file(), "%c", stream.GetNext()); |
156 } | 156 } |
157 } | 157 } |
158 PrintF(tracing_scope.file(), "\n\n"); | 158 PrintF(tracing_scope.file(), "\n\n"); |
159 } | 159 } |
160 } | 160 } |
161 if (info->IsOptimizing()) { | 161 if (info->IsOptimizing()) { |
162 if (FLAG_print_unopt_code) { | 162 if (FLAG_print_unopt_code) { |
163 PrintF(tracing_scope.file(), "--- Unoptimized code ---\n"); | 163 PrintF(tracing_scope.file(), "--- Unoptimized code ---\n"); |
164 info->closure()->shared()->code()->Disassemble( | 164 info->closure()->shared()->code()->Disassemble( |
165 *function->debug_name()->ToCString(), tracing_scope.file()); | 165 function->debug_name()->ToCString().get(), tracing_scope.file()); |
166 } | 166 } |
167 PrintF(tracing_scope.file(), "--- Optimized code ---\n"); | 167 PrintF(tracing_scope.file(), "--- Optimized code ---\n"); |
168 } else { | 168 } else { |
169 PrintF(tracing_scope.file(), "--- Code ---\n"); | 169 PrintF(tracing_scope.file(), "--- Code ---\n"); |
170 } | 170 } |
171 if (print_source) { | 171 if (print_source) { |
172 PrintF(tracing_scope.file(), | 172 PrintF(tracing_scope.file(), |
173 "source_position = %d\n", function->start_position()); | 173 "source_position = %d\n", function->start_position()); |
174 } | 174 } |
175 if (info->IsStub()) { | 175 if (info->IsStub()) { |
176 CodeStub::Major major_key = info->code_stub()->MajorKey(); | 176 CodeStub::Major major_key = info->code_stub()->MajorKey(); |
177 code->Disassemble(CodeStub::MajorName(major_key, false), | 177 code->Disassemble(CodeStub::MajorName(major_key, false), |
178 tracing_scope.file()); | 178 tracing_scope.file()); |
179 } else { | 179 } else { |
180 code->Disassemble(*function->debug_name()->ToCString(), | 180 code->Disassemble(function->debug_name()->ToCString().get(), |
181 tracing_scope.file()); | 181 tracing_scope.file()); |
182 } | 182 } |
183 PrintF(tracing_scope.file(), "--- End code ---\n"); | 183 PrintF(tracing_scope.file(), "--- End code ---\n"); |
184 } | 184 } |
185 #endif // ENABLE_DISASSEMBLER | 185 #endif // ENABLE_DISASSEMBLER |
186 } | 186 } |
187 | 187 |
188 | 188 |
189 bool CodeGenerator::ShouldGenerateLog(Isolate* isolate, Expression* type) { | 189 bool CodeGenerator::ShouldGenerateLog(Isolate* isolate, Expression* type) { |
190 ASSERT(type != NULL); | 190 ASSERT(type != NULL); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 ASSERT(result_size_ == 1 || result_size_ == 2); | 238 ASSERT(result_size_ == 1 || result_size_ == 2); |
239 #ifdef _WIN64 | 239 #ifdef _WIN64 |
240 return result | ((result_size_ == 1) ? 0 : 2); | 240 return result | ((result_size_ == 1) ? 0 : 2); |
241 #else | 241 #else |
242 return result; | 242 return result; |
243 #endif | 243 #endif |
244 } | 244 } |
245 | 245 |
246 | 246 |
247 } } // namespace v8::internal | 247 } } // namespace v8::internal |
OLD | NEW |