OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if defined(V8_OS_AIX) | 7 #if defined(V8_OS_AIX) |
8 #include <fenv.h> | 8 #include <fenv.h> |
9 #endif | 9 #endif |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { | 176 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
177 #ifdef ENABLE_DISASSEMBLER | 177 #ifdef ENABLE_DISASSEMBLER |
178 AllowDeferredHandleDereference allow_deference_for_print_code; | 178 AllowDeferredHandleDereference allow_deference_for_print_code; |
179 bool print_code = info->isolate()->bootstrapper()->IsActive() | 179 bool print_code = info->isolate()->bootstrapper()->IsActive() |
180 ? FLAG_print_builtin_code | 180 ? FLAG_print_builtin_code |
181 : (FLAG_print_code || | 181 : (FLAG_print_code || |
182 (info->IsStub() && FLAG_print_code_stubs) || | 182 (info->IsStub() && FLAG_print_code_stubs) || |
183 (info->IsOptimizing() && FLAG_print_opt_code)); | 183 (info->IsOptimizing() && FLAG_print_opt_code)); |
184 if (print_code) { | 184 if (print_code) { |
185 const char* debug_name; | 185 const char* debug_name; |
| 186 SmartArrayPointer<char> debug_name_holder; |
186 if (info->IsStub()) { | 187 if (info->IsStub()) { |
187 CodeStub::Major major_key = info->code_stub()->MajorKey(); | 188 CodeStub::Major major_key = info->code_stub()->MajorKey(); |
188 debug_name = CodeStub::MajorName(major_key, false); | 189 debug_name = CodeStub::MajorName(major_key, false); |
189 } else { | 190 } else { |
190 debug_name = | 191 debug_name_holder = |
191 info->parse_info()->function()->debug_name()->ToCString().get(); | 192 info->parse_info()->function()->debug_name()->ToCString(); |
| 193 debug_name = debug_name_holder.get(); |
192 } | 194 } |
193 | 195 |
194 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); | 196 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); |
195 OFStream os(tracing_scope.file()); | 197 OFStream os(tracing_scope.file()); |
196 | 198 |
197 // Print the source code if available. | 199 // Print the source code if available. |
198 FunctionLiteral* function = nullptr; | 200 FunctionLiteral* function = nullptr; |
199 bool print_source = | 201 bool print_source = |
200 info->parse_info() && (code->kind() == Code::OPTIMIZED_FUNCTION || | 202 info->parse_info() && (code->kind() == Code::OPTIMIZED_FUNCTION || |
201 code->kind() == Code::FUNCTION); | 203 code->kind() == Code::FUNCTION); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 masm->positions_recorder()->RecordStatementPosition(pos); | 247 masm->positions_recorder()->RecordStatementPosition(pos); |
246 masm->positions_recorder()->RecordPosition(pos); | 248 masm->positions_recorder()->RecordPosition(pos); |
247 if (right_here) { | 249 if (right_here) { |
248 return masm->positions_recorder()->WriteRecordedPositions(); | 250 return masm->positions_recorder()->WriteRecordedPositions(); |
249 } | 251 } |
250 } | 252 } |
251 return false; | 253 return false; |
252 } | 254 } |
253 | 255 |
254 } } // namespace v8::internal | 256 } } // namespace v8::internal |
OLD | NEW |