| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 inlined_function_infos_ = new List<InlinedFunctionInfo>(5); | 120 inlined_function_infos_ = new std::vector<InlinedFunctionInfo>(); |
| 121 } else { | 121 } else { |
| 122 inlined_function_infos_ = NULL; | 122 inlined_function_infos_ = NULL; |
| 123 } | 123 } |
| 124 | 124 |
| 125 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 125 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
| 126 dependencies_[i] = NULL; | 126 dependencies_[i] = NULL; |
| 127 } | 127 } |
| 128 if (mode == STUB) { | 128 if (mode == STUB) { |
| 129 mode_ = STUB; | 129 mode_ = STUB; |
| 130 return; | 130 return; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 return scope()->is_simple_parameter_list(); | 272 return scope()->is_simple_parameter_list(); |
| 273 } | 273 } |
| 274 | 274 |
| 275 | 275 |
| 276 int CompilationInfo::TraceInlinedFunction(Handle<SharedFunctionInfo> shared, | 276 int CompilationInfo::TraceInlinedFunction(Handle<SharedFunctionInfo> shared, |
| 277 SourcePosition position, | 277 SourcePosition position, |
| 278 int parent_id) { | 278 int parent_id) { |
| 279 DCHECK(FLAG_hydrogen_track_positions); | 279 DCHECK(FLAG_hydrogen_track_positions); |
| 280 DCHECK(inlined_function_infos_); | 280 DCHECK(inlined_function_infos_); |
| 281 | 281 |
| 282 int inline_id = inlined_function_infos_->length(); | 282 int inline_id = static_cast<int>(inlined_function_infos_->size()); |
| 283 InlinedFunctionInfo info(parent_id, position, UnboundScript::kNoScriptId, | 283 InlinedFunctionInfo info(parent_id, position, UnboundScript::kNoScriptId, |
| 284 shared->start_position()); | 284 shared->start_position()); |
| 285 if (!shared->script()->IsUndefined()) { | 285 if (!shared->script()->IsUndefined()) { |
| 286 Handle<Script> script(Script::cast(shared->script())); | 286 Handle<Script> script(Script::cast(shared->script())); |
| 287 info.script_id = script->id()->value(); | 287 info.script_id = script->id()->value(); |
| 288 | 288 |
| 289 if (!script->source()->IsUndefined()) { | 289 if (!script->source()->IsUndefined()) { |
| 290 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); | 290 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); |
| 291 OFStream os(tracing_scope.file()); | 291 OFStream os(tracing_scope.file()); |
| 292 os << "--- FUNCTION SOURCE (" << shared->DebugName()->ToCString().get() | 292 os << "--- FUNCTION SOURCE (" << shared->DebugName()->ToCString().get() |
| 293 << ") id{" << optimization_id() << "," << inline_id << "} ---\n"; | 293 << ") id{" << optimization_id() << "," << inline_id << "} ---\n"; |
| 294 { | 294 { |
| 295 DisallowHeapAllocation no_allocation; | 295 DisallowHeapAllocation no_allocation; |
| 296 int start = shared->start_position(); | 296 int start = shared->start_position(); |
| 297 int len = shared->end_position() - start; | 297 int len = shared->end_position() - start; |
| 298 String::SubStringRange source(String::cast(script->source()), start, | 298 String::SubStringRange source(String::cast(script->source()), start, |
| 299 len); | 299 len); |
| 300 for (const auto& c : source) { | 300 for (const auto& c : source) { |
| 301 os << AsReversiblyEscapedUC16(c); | 301 os << AsReversiblyEscapedUC16(c); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 os << "\n--- END ---\n"; | 305 os << "\n--- END ---\n"; |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 | 308 |
| 309 inlined_function_infos_->Add(info); | 309 inlined_function_infos_->push_back(info); |
| 310 | 310 |
| 311 if (inline_id != 0) { | 311 if (inline_id != 0) { |
| 312 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); | 312 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); |
| 313 OFStream os(tracing_scope.file()); | 313 OFStream os(tracing_scope.file()); |
| 314 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" | 314 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" |
| 315 << optimization_id() << "," << inline_id << "} AS " << inline_id | 315 << optimization_id() << "," << inline_id << "} AS " << inline_id |
| 316 << " AT " << position << std::endl; | 316 << " AT " << position << std::endl; |
| 317 } | 317 } |
| 318 | 318 |
| 319 return inline_id; | 319 return inline_id; |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 parse_info_ = nullptr; | 1589 parse_info_ = nullptr; |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 #if DEBUG | 1592 #if DEBUG |
| 1593 void CompilationInfo::PrintAstForTesting() { | 1593 void CompilationInfo::PrintAstForTesting() { |
| 1594 PrintF("--- Source from AST ---\n%s\n", | 1594 PrintF("--- Source from AST ---\n%s\n", |
| 1595 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1595 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1596 } | 1596 } |
| 1597 #endif | 1597 #endif |
| 1598 } } // namespace v8::internal | 1598 } } // namespace v8::internal |
| OLD | NEW |