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" |
| 11 #include "src/base/platform/platform.h" | 11 #include "src/base/platform/platform.h" |
| 12 #include "src/bootstrapper.h" | 12 #include "src/bootstrapper.h" |
| 13 #include "src/code-stubs.h" | 13 #include "src/code-stubs.h" |
| 14 #include "src/deoptimizer.h" | 14 #include "src/deoptimizer.h" |
| 15 #include "src/global-handles.h" | 15 #include "src/global-handles.h" |
| 16 #include "src/interpreter/bytecodes.h" | |
| 17 #include "src/interpreter/interpreter.h" | |
| 16 #include "src/log-inl.h" | 18 #include "src/log-inl.h" |
| 17 #include "src/log-utils.h" | 19 #include "src/log-utils.h" |
| 18 #include "src/macro-assembler.h" | 20 #include "src/macro-assembler.h" |
| 19 #include "src/profiler/cpu-profiler.h" | 21 #include "src/profiler/cpu-profiler.h" |
| 20 #include "src/runtime-profiler.h" | 22 #include "src/runtime-profiler.h" |
| 21 #include "src/string-stream.h" | 23 #include "src/string-stream.h" |
| 22 #include "src/vm-state-inl.h" | 24 #include "src/vm-state-inl.h" |
| 23 | 25 |
| 24 namespace v8 { | 26 namespace v8 { |
| 25 namespace internal { | 27 namespace internal { |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1518 | 1520 |
| 1519 void Logger::LogCodeObject(Object* object) { | 1521 void Logger::LogCodeObject(Object* object) { |
| 1520 AbstractCode* code_object = AbstractCode::cast(object); | 1522 AbstractCode* code_object = AbstractCode::cast(object); |
| 1521 LogEventsAndTags tag = Logger::STUB_TAG; | 1523 LogEventsAndTags tag = Logger::STUB_TAG; |
| 1522 const char* description = "Unknown code from the snapshot"; | 1524 const char* description = "Unknown code from the snapshot"; |
| 1523 switch (code_object->kind()) { | 1525 switch (code_object->kind()) { |
| 1524 case AbstractCode::FUNCTION: | 1526 case AbstractCode::FUNCTION: |
| 1525 case AbstractCode::INTERPRETED_FUNCTION: | 1527 case AbstractCode::INTERPRETED_FUNCTION: |
| 1526 case AbstractCode::OPTIMIZED_FUNCTION: | 1528 case AbstractCode::OPTIMIZED_FUNCTION: |
| 1527 return; // We log this later using LogCompiledFunctions. | 1529 return; // We log this later using LogCompiledFunctions. |
| 1530 case AbstractCode::BYTECODE_HANDLER: | |
| 1531 return; // We log it later by walking the dispatch table. | |
| 1528 case AbstractCode::BINARY_OP_IC: // fall through | 1532 case AbstractCode::BINARY_OP_IC: // fall through |
| 1529 case AbstractCode::COMPARE_IC: // fall through | 1533 case AbstractCode::COMPARE_IC: // fall through |
| 1530 case AbstractCode::TO_BOOLEAN_IC: // fall through | 1534 case AbstractCode::TO_BOOLEAN_IC: // fall through |
| 1531 | 1535 |
| 1532 case AbstractCode::STUB: | 1536 case AbstractCode::STUB: |
| 1533 description = | 1537 description = |
| 1534 CodeStub::MajorName(CodeStub::GetMajorKey(code_object->GetCode())); | 1538 CodeStub::MajorName(CodeStub::GetMajorKey(code_object->GetCode())); |
| 1535 if (description == NULL) | 1539 if (description == NULL) |
| 1536 description = "A stub from the snapshot"; | 1540 description = "A stub from the snapshot"; |
| 1537 tag = Logger::STUB_TAG; | 1541 tag = Logger::STUB_TAG; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1591 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1595 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1592 "Logger::LogCodeObjects"); | 1596 "Logger::LogCodeObjects"); |
| 1593 HeapIterator iterator(heap); | 1597 HeapIterator iterator(heap); |
| 1594 DisallowHeapAllocation no_gc; | 1598 DisallowHeapAllocation no_gc; |
| 1595 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1599 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 1596 if (obj->IsCode()) LogCodeObject(obj); | 1600 if (obj->IsCode()) LogCodeObject(obj); |
| 1597 if (obj->IsBytecodeArray()) LogCodeObject(obj); | 1601 if (obj->IsBytecodeArray()) LogCodeObject(obj); |
| 1598 } | 1602 } |
| 1599 } | 1603 } |
| 1600 | 1604 |
| 1605 void Logger::LogBytecodeHandlers() { | |
|
rmcilroy
2016/03/08 16:21:57
You should probably guard on FLAG_ignition so this
Stefano Sanfilippo
2016/03/08 17:22:29
Done.
| |
| 1606 const int last_index = static_cast<int>(interpreter::Bytecode::kLast); | |
| 1607 for (int index = 0; index <= last_index; ++index) { | |
| 1608 interpreter::Bytecode bytecode = interpreter::Bytecodes::FromByte(index); | |
| 1609 Code* code = isolate_->interpreter()->GetBytecodeHandler(bytecode); | |
| 1610 CodeCreateEvent(Logger::BYTECODE_HANDLER_TAG, AbstractCode::cast(code), | |
| 1611 interpreter::Bytecodes::ToString(bytecode)); | |
| 1612 } | |
| 1613 } | |
| 1614 | |
| 1601 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1615 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
| 1602 Handle<AbstractCode> code) { | 1616 Handle<AbstractCode> code) { |
| 1603 Handle<String> func_name(shared->DebugName()); | 1617 Handle<String> func_name(shared->DebugName()); |
| 1604 if (shared->script()->IsScript()) { | 1618 if (shared->script()->IsScript()) { |
| 1605 Handle<Script> script(Script::cast(shared->script())); | 1619 Handle<Script> script(Script::cast(shared->script())); |
| 1606 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; | 1620 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; |
| 1607 int column_num = | 1621 int column_num = |
| 1608 Script::GetColumnNumber(script, shared->start_position()) + 1; | 1622 Script::GetColumnNumber(script, shared->start_position()) + 1; |
| 1609 if (script->name()->IsString()) { | 1623 if (script->name()->IsString()) { |
| 1610 Handle<String> script_name(String::cast(script->name())); | 1624 Handle<String> script_name(String::cast(script->name())); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1846 removeCodeEventListener(jit_logger_); | 1860 removeCodeEventListener(jit_logger_); |
| 1847 delete jit_logger_; | 1861 delete jit_logger_; |
| 1848 jit_logger_ = NULL; | 1862 jit_logger_ = NULL; |
| 1849 } | 1863 } |
| 1850 | 1864 |
| 1851 return log_->Close(); | 1865 return log_->Close(); |
| 1852 } | 1866 } |
| 1853 | 1867 |
| 1854 } // namespace internal | 1868 } // namespace internal |
| 1855 } // namespace v8 | 1869 } // namespace v8 |
| OLD | NEW |