| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/basic-block-instrumentor.h" | 5 #include "src/compiler/basic-block-instrumentor.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 | 49 |
| 50 BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument( | 50 BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument( |
| 51 CompilationInfo* info, Graph* graph, Schedule* schedule) { | 51 CompilationInfo* info, Graph* graph, Schedule* schedule) { |
| 52 // Skip the exit block in profiles, since the register allocator can't handle | 52 // Skip the exit block in profiles, since the register allocator can't handle |
| 53 // it and entry into it means falling off the end of the function anyway. | 53 // it and entry into it means falling off the end of the function anyway. |
| 54 size_t n_blocks = static_cast<size_t>(schedule->RpoBlockCount()) - 1; | 54 size_t n_blocks = static_cast<size_t>(schedule->RpoBlockCount()) - 1; |
| 55 BasicBlockProfiler::Data* data = | 55 BasicBlockProfiler::Data* data = |
| 56 info->isolate()->GetOrCreateBasicBlockProfiler()->NewData(n_blocks); | 56 info->isolate()->GetOrCreateBasicBlockProfiler()->NewData(n_blocks); |
| 57 // Set the function name. | 57 // Set the function name. |
| 58 if (!info->shared_info().is_null() && | 58 if (info->has_shared_info() && info->shared_info()->name()->IsString()) { |
| 59 info->shared_info()->name()->IsString()) { | |
| 60 std::ostringstream os; | 59 std::ostringstream os; |
| 61 String::cast(info->shared_info()->name())->PrintUC16(os); | 60 String::cast(info->shared_info()->name())->PrintUC16(os); |
| 62 data->SetFunctionName(&os); | 61 data->SetFunctionName(&os); |
| 63 } | 62 } |
| 64 // Capture the schedule string before instrumentation. | 63 // Capture the schedule string before instrumentation. |
| 65 { | 64 { |
| 66 std::ostringstream os; | 65 std::ostringstream os; |
| 67 os << *schedule; | 66 os << *schedule; |
| 68 data->SetSchedule(&os); | 67 data->SetSchedule(&os); |
| 69 } | 68 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 98 for (int i = insertion_start; i < kArraySize; ++i) { | 97 for (int i = insertion_start; i < kArraySize; ++i) { |
| 99 schedule->SetBlockForNode(block, to_insert[i]); | 98 schedule->SetBlockForNode(block, to_insert[i]); |
| 100 } | 99 } |
| 101 } | 100 } |
| 102 return data; | 101 return data; |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace compiler | 104 } // namespace compiler |
| 106 } // namespace internal | 105 } // namespace internal |
| 107 } // namespace v8 | 106 } // namespace v8 |
| OLD | NEW |