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/codegen.h" | 5 #include "src/codegen.h" |
6 | 6 |
7 #if defined(V8_OS_AIX) | 7 #if defined(V8_OS_AIX) |
8 #include <fenv.h> // NOLINT(build/c++11) | 8 #include <fenv.h> // NOLINT(build/c++11) |
9 #endif | 9 #endif |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 (info->IsOptimizing() && FLAG_print_opt_code)); | 154 (info->IsOptimizing() && FLAG_print_opt_code)); |
155 if (print_code) { | 155 if (print_code) { |
156 base::SmartArrayPointer<char> debug_name = info->GetDebugName(); | 156 base::SmartArrayPointer<char> debug_name = info->GetDebugName(); |
157 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); | 157 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); |
158 OFStream os(tracing_scope.file()); | 158 OFStream os(tracing_scope.file()); |
159 | 159 |
160 // Print the source code if available. | 160 // Print the source code if available. |
161 bool print_source = | 161 bool print_source = |
162 info->parse_info() && (code->kind() == Code::OPTIMIZED_FUNCTION || | 162 info->parse_info() && (code->kind() == Code::OPTIMIZED_FUNCTION || |
163 code->kind() == Code::FUNCTION); | 163 code->kind() == Code::FUNCTION); |
| 164 // TODO(mstarzinger): Switch this over to use SharedFunctionInfo instead of |
| 165 // the FunctionLiteral, once we have a SharedFunctionInfo for live edit. |
| 166 print_source = print_source && info->literal() != nullptr; |
164 if (print_source) { | 167 if (print_source) { |
165 FunctionLiteral* literal = info->literal(); | 168 FunctionLiteral* literal = info->literal(); |
166 Handle<Script> script = info->script(); | 169 Handle<Script> script = info->script(); |
167 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 170 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
168 os << "--- Raw source ---\n"; | 171 os << "--- Raw source ---\n"; |
169 StringCharacterStream stream(String::cast(script->source()), | 172 StringCharacterStream stream(String::cast(script->source()), |
170 literal->start_position()); | 173 literal->start_position()); |
171 // fun->end_position() points to the last character in the stream. We | 174 // fun->end_position() points to the last character in the stream. We |
172 // need to compensate by adding one to calculate the length. | 175 // need to compensate by adding one to calculate the length. |
173 int source_len = | 176 int source_len = |
(...skipping 21 matching lines...) Expand all Loading... |
195 os << "source_position = " << literal->start_position() << "\n"; | 198 os << "source_position = " << literal->start_position() << "\n"; |
196 } | 199 } |
197 code->Disassemble(debug_name.get(), os); | 200 code->Disassemble(debug_name.get(), os); |
198 os << "--- End code ---\n"; | 201 os << "--- End code ---\n"; |
199 } | 202 } |
200 #endif // ENABLE_DISASSEMBLER | 203 #endif // ENABLE_DISASSEMBLER |
201 } | 204 } |
202 | 205 |
203 } // namespace internal | 206 } // namespace internal |
204 } // namespace v8 | 207 } // namespace v8 |
OLD | NEW |