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 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 Mode mode, | 109 Mode mode, |
110 Zone* zone) { | 110 Zone* zone) { |
111 isolate_ = isolate; | 111 isolate_ = isolate; |
112 zone_ = zone; | 112 zone_ = zone; |
113 deferred_handles_ = NULL; | 113 deferred_handles_ = NULL; |
114 code_stub_ = NULL; | 114 code_stub_ = NULL; |
115 prologue_offset_ = Code::kPrologueOffsetNotSet; | 115 prologue_offset_ = Code::kPrologueOffsetNotSet; |
116 opt_count_ = has_shared_info() ? shared_info()->opt_count() : 0; | 116 opt_count_ = has_shared_info() ? shared_info()->opt_count() : 0; |
117 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() | 117 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() |
118 ? new List<OffsetRange>(2) : NULL; | 118 ? new List<OffsetRange>(2) : NULL; |
119 if (FLAG_hydrogen_track_positions) { | 119 if (FLAG_hydrogen_track_positions || |
| 120 isolate_->cpu_profiler()->is_profiling()) { |
120 inlined_function_infos_ = new std::vector<InlinedFunctionInfo>(); | 121 inlined_function_infos_ = new std::vector<InlinedFunctionInfo>(); |
121 track_positions_ = true; | 122 track_positions_ = true; |
122 } else { | 123 } else { |
123 inlined_function_infos_ = NULL; | 124 inlined_function_infos_ = NULL; |
124 track_positions_ = false; | 125 track_positions_ = false; |
125 } | 126 } |
126 | 127 |
127 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 128 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
128 dependencies_[i] = NULL; | 129 dependencies_[i] = NULL; |
129 } | 130 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 { | 297 { |
297 DisallowHeapAllocation no_allocation; | 298 DisallowHeapAllocation no_allocation; |
298 int start = shared->start_position(); | 299 int start = shared->start_position(); |
299 int len = shared->end_position() - start; | 300 int len = shared->end_position() - start; |
300 String::SubStringRange source(String::cast(script->source()), start, | 301 String::SubStringRange source(String::cast(script->source()), start, |
301 len); | 302 len); |
302 for (const auto& c : source) { | 303 for (const auto& c : source) { |
303 os << AsReversiblyEscapedUC16(c); | 304 os << AsReversiblyEscapedUC16(c); |
304 } | 305 } |
305 } | 306 } |
306 | |
307 os << "\n--- END ---\n"; | 307 os << "\n--- END ---\n"; |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 inlined_function_infos_->push_back(info); | 311 inlined_function_infos_->push_back(info); |
312 | 312 |
313 if (FLAG_hydrogen_track_positions && inline_id != 0) { | 313 if (FLAG_hydrogen_track_positions && inline_id != 0) { |
314 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); | 314 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); |
315 OFStream os(tracing_scope.file()); | 315 OFStream os(tracing_scope.file()); |
316 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" | 316 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 parse_info_ = nullptr; | 1605 parse_info_ = nullptr; |
1606 } | 1606 } |
1607 | 1607 |
1608 #if DEBUG | 1608 #if DEBUG |
1609 void CompilationInfo::PrintAstForTesting() { | 1609 void CompilationInfo::PrintAstForTesting() { |
1610 PrintF("--- Source from AST ---\n%s\n", | 1610 PrintF("--- Source from AST ---\n%s\n", |
1611 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1611 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1612 } | 1612 } |
1613 #endif | 1613 #endif |
1614 } } // namespace v8::internal | 1614 } } // namespace v8::internal |
OLD | NEW |