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/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 | 273 |
274 void CompilationInfo::LogDeoptCallPosition(int pc_offset, int inlining_id) { | 274 void CompilationInfo::LogDeoptCallPosition(int pc_offset, int inlining_id) { |
275 if (!track_positions_ || IsStub()) return; | 275 if (!track_positions_ || IsStub()) return; |
276 DCHECK_LT(static_cast<size_t>(inlining_id), inlined_function_infos_.size()); | 276 DCHECK_LT(static_cast<size_t>(inlining_id), inlined_function_infos_.size()); |
277 inlined_function_infos_.at(inlining_id).deopt_pc_offsets.push_back(pc_offset); | 277 inlined_function_infos_.at(inlining_id).deopt_pc_offsets.push_back(pc_offset); |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 base::SmartArrayPointer<char> CompilationInfo::GetDebugName() const { | 281 base::SmartArrayPointer<char> CompilationInfo::GetDebugName() const { |
282 if (parse_info()) { | 282 if (parse_info() && parse_info()->literal()) { |
283 AllowHandleDereference allow_deref; | 283 AllowHandleDereference allow_deref; |
284 return parse_info()->literal()->debug_name()->ToCString(); | 284 return parse_info()->literal()->debug_name()->ToCString(); |
285 } | 285 } |
| 286 if (parse_info() && !parse_info()->shared_info().is_null()) { |
| 287 return parse_info()->shared_info()->DebugName()->ToCString(); |
| 288 } |
286 const char* str = debug_name_ ? debug_name_ : "unknown"; | 289 const char* str = debug_name_ ? debug_name_ : "unknown"; |
287 size_t len = strlen(str) + 1; | 290 size_t len = strlen(str) + 1; |
288 base::SmartArrayPointer<char> name(new char[len]); | 291 base::SmartArrayPointer<char> name(new char[len]); |
289 memcpy(name.get(), str, len); | 292 memcpy(name.get(), str, len); |
290 return name; | 293 return name; |
291 } | 294 } |
292 | 295 |
293 | 296 |
294 bool CompilationInfo::ExpectsJSReceiverAsReceiver() { | 297 bool CompilationInfo::ExpectsJSReceiverAsReceiver() { |
295 return is_sloppy(language_mode()) && !is_native(); | 298 return is_sloppy(language_mode()) && !is_native(); |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 } | 1868 } |
1866 | 1869 |
1867 #if DEBUG | 1870 #if DEBUG |
1868 void CompilationInfo::PrintAstForTesting() { | 1871 void CompilationInfo::PrintAstForTesting() { |
1869 PrintF("--- Source from AST ---\n%s\n", | 1872 PrintF("--- Source from AST ---\n%s\n", |
1870 PrettyPrinter(isolate()).PrintProgram(literal())); | 1873 PrettyPrinter(isolate()).PrintProgram(literal())); |
1871 } | 1874 } |
1872 #endif | 1875 #endif |
1873 } // namespace internal | 1876 } // namespace internal |
1874 } // namespace v8 | 1877 } // namespace v8 |
OLD | NEW |