OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 if (FLAG_hydrogen_track_positions && | 1384 if (FLAG_hydrogen_track_positions && |
1385 !script->source()->IsUndefined(isolate())) { | 1385 !script->source()->IsUndefined(isolate())) { |
1386 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); | 1386 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); |
1387 Object* source_name = script->name(); | 1387 Object* source_name = script->name(); |
1388 OFStream os(tracing_scope.file()); | 1388 OFStream os(tracing_scope.file()); |
1389 os << "--- FUNCTION SOURCE ("; | 1389 os << "--- FUNCTION SOURCE ("; |
1390 if (source_name->IsString()) { | 1390 if (source_name->IsString()) { |
1391 os << String::cast(source_name)->ToCString().get() << ":"; | 1391 os << String::cast(source_name)->ToCString().get() << ":"; |
1392 } | 1392 } |
1393 os << shared->DebugName()->ToCString().get() << ") id{"; | 1393 os << shared->DebugName()->ToCString().get() << ") id{"; |
1394 os << info_->optimization_id() << "," << inlining_id << "} ---\n"; | 1394 os << info_->optimization_id() << "," << inlining_id << "} start{"; |
| 1395 os << shared->start_position() << "} ---\n"; |
1395 { | 1396 { |
1396 DisallowHeapAllocation no_allocation; | 1397 DisallowHeapAllocation no_allocation; |
1397 int start = shared->start_position(); | 1398 int start = shared->start_position(); |
1398 int len = shared->end_position() - start; | 1399 int len = shared->end_position() - start; |
1399 String::SubStringRange source(String::cast(script->source()), start, | 1400 String::SubStringRange source(String::cast(script->source()), start, |
1400 len); | 1401 len); |
1401 for (const auto& c : source) { | 1402 for (const auto& c : source) { |
1402 os << AsReversiblyEscapedUC16(c); | 1403 os << AsReversiblyEscapedUC16(c); |
1403 } | 1404 } |
1404 } | 1405 } |
1405 | 1406 |
1406 os << "\n--- END ---\n"; | 1407 os << "\n--- END ---\n"; |
1407 } | 1408 } |
1408 } | 1409 } |
1409 | 1410 |
1410 if (FLAG_hydrogen_track_positions && | 1411 if (FLAG_hydrogen_track_positions && |
1411 inlining_id != SourcePosition::kNotInlined) { | 1412 inlining_id != SourcePosition::kNotInlined) { |
1412 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); | 1413 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); |
1413 OFStream os(tracing_scope.file()); | 1414 OFStream os(tracing_scope.file()); |
1414 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" | 1415 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" |
1415 << info_->optimization_id() << "," << inlining_id << "} AS " | 1416 << info_->optimization_id() << "," << inlining_id << "} AS " |
1416 << inlining_id << " AT " << position.ScriptOffset() << std::endl; | 1417 << inlining_id << " AT "; |
| 1418 if (position.IsKnown()) { |
| 1419 os << "<" << position.InliningId() << ":" << position.ScriptOffset() |
| 1420 << ">"; |
| 1421 } else { |
| 1422 os << "<?>"; |
| 1423 } |
| 1424 os << std::endl; |
1417 } | 1425 } |
1418 } | 1426 } |
1419 | 1427 |
1420 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { | 1428 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { |
1421 DCHECK(current_block() != NULL); | 1429 DCHECK(current_block() != NULL); |
1422 DCHECK(!FLAG_hydrogen_track_positions || position_.IsKnown() || | 1430 DCHECK(!FLAG_hydrogen_track_positions || position_.IsKnown() || |
1423 !info_->IsOptimizing()); | 1431 !info_->IsOptimizing()); |
1424 current_block()->AddInstruction(instr, source_position()); | 1432 current_block()->AddInstruction(instr, source_position()); |
1425 if (graph()->IsInsideNoSideEffectsScope()) { | 1433 if (graph()->IsInsideNoSideEffectsScope()) { |
1426 instr->SetFlag(HValue::kHasNoObservableSideEffects); | 1434 instr->SetFlag(HValue::kHasNoObservableSideEffects); |
(...skipping 11601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13028 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13036 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13029 } | 13037 } |
13030 | 13038 |
13031 #ifdef DEBUG | 13039 #ifdef DEBUG |
13032 graph_->Verify(false); // No full verify. | 13040 graph_->Verify(false); // No full verify. |
13033 #endif | 13041 #endif |
13034 } | 13042 } |
13035 | 13043 |
13036 } // namespace internal | 13044 } // namespace internal |
13037 } // namespace v8 | 13045 } // namespace v8 |
OLD | NEW |