Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/log.h" | 5 #include "src/log.h" |
| 6 | 6 |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1601 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1601 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 1602 if (obj->IsCode()) LogCodeObject(obj); | 1602 if (obj->IsCode()) LogCodeObject(obj); |
| 1603 if (obj->IsBytecodeArray()) LogCodeObject(obj); | 1603 if (obj->IsBytecodeArray()) LogCodeObject(obj); |
| 1604 } | 1604 } |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 void Logger::LogBytecodeHandlers() { | 1607 void Logger::LogBytecodeHandlers() { |
| 1608 if (!FLAG_ignition) return; | 1608 if (!FLAG_ignition) return; |
| 1609 | 1609 |
| 1610 const int last_index = static_cast<int>(interpreter::Bytecode::kLast); | 1610 const int last_index = static_cast<int>(interpreter::Bytecode::kLast); |
| 1611 for (int index = 0; index <= last_index; ++index) { | 1611 for (int operand_scale = 1; operand_scale <= 4; operand_scale *= 2) { |
| 1612 interpreter::Bytecode bytecode = interpreter::Bytecodes::FromByte(index); | 1612 for (int index = 0; index <= last_index; ++index) { |
| 1613 Code* code = isolate_->interpreter()->GetBytecodeHandler(bytecode); | 1613 interpreter::Bytecode bytecode = interpreter::Bytecodes::FromByte(index); |
| 1614 CodeCreateEvent(Logger::BYTECODE_HANDLER_TAG, AbstractCode::cast(code), | 1614 Code* code = |
| 1615 interpreter::Bytecodes::ToString(bytecode)); | 1615 isolate_->interpreter()->GetBytecodeHandler(bytecode, operand_scale); |
| 1616 if (code != nullptr) { | |
| 1617 std::string bytecode_name = interpreter::Bytecodes::ToString(bytecode); | |
|
rmcilroy
2016/03/10 16:45:38
How about making Bytecode::ToString take a width t
oth
2016/03/11 16:26:13
Added an overload to do this.
| |
| 1618 if (operand_scale == 2) { | |
| 1619 bytecode_name += "."; | |
| 1620 bytecode_name += | |
| 1621 interpreter::Bytecodes::ToString(interpreter::Bytecode::kWide); | |
| 1622 } else if (operand_scale == 4) { | |
| 1623 bytecode_name += "."; | |
| 1624 bytecode_name += interpreter::Bytecodes::ToString( | |
| 1625 interpreter::Bytecode::kExtraWide); | |
| 1626 } | |
| 1627 CodeCreateEvent(Logger::BYTECODE_HANDLER_TAG, AbstractCode::cast(code), | |
| 1628 bytecode_name.c_str()); | |
| 1629 } | |
| 1630 } | |
| 1616 } | 1631 } |
| 1617 } | 1632 } |
| 1618 | 1633 |
| 1619 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1634 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
| 1620 Handle<AbstractCode> code) { | 1635 Handle<AbstractCode> code) { |
| 1621 Handle<String> func_name(shared->DebugName()); | 1636 Handle<String> func_name(shared->DebugName()); |
| 1622 if (shared->script()->IsScript()) { | 1637 if (shared->script()->IsScript()) { |
| 1623 Handle<Script> script(Script::cast(shared->script())); | 1638 Handle<Script> script(Script::cast(shared->script())); |
| 1624 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; | 1639 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; |
| 1625 int column_num = | 1640 int column_num = |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1864 removeCodeEventListener(jit_logger_); | 1879 removeCodeEventListener(jit_logger_); |
| 1865 delete jit_logger_; | 1880 delete jit_logger_; |
| 1866 jit_logger_ = NULL; | 1881 jit_logger_ = NULL; |
| 1867 } | 1882 } |
| 1868 | 1883 |
| 1869 return log_->Close(); | 1884 return log_->Close(); |
| 1870 } | 1885 } |
| 1871 | 1886 |
| 1872 } // namespace internal | 1887 } // namespace internal |
| 1873 } // namespace v8 | 1888 } // namespace v8 |
| OLD | NEW |