Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: src/log.cc

Issue 1772403002: [Interpreter] Log code-creation events for bytecode handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing before committing. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/log.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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() {
1606 if (!FLAG_ignition) return;
1607
1608 const int last_index = static_cast<int>(interpreter::Bytecode::kLast);
1609 for (int index = 0; index <= last_index; ++index) {
1610 interpreter::Bytecode bytecode = interpreter::Bytecodes::FromByte(index);
1611 Code* code = isolate_->interpreter()->GetBytecodeHandler(bytecode);
1612 CodeCreateEvent(Logger::BYTECODE_HANDLER_TAG, AbstractCode::cast(code),
1613 interpreter::Bytecodes::ToString(bytecode));
1614 }
1615 }
1616
1601 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, 1617 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
1602 Handle<AbstractCode> code) { 1618 Handle<AbstractCode> code) {
1603 Handle<String> func_name(shared->DebugName()); 1619 Handle<String> func_name(shared->DebugName());
1604 if (shared->script()->IsScript()) { 1620 if (shared->script()->IsScript()) {
1605 Handle<Script> script(Script::cast(shared->script())); 1621 Handle<Script> script(Script::cast(shared->script()));
1606 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; 1622 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1;
1607 int column_num = 1623 int column_num =
1608 Script::GetColumnNumber(script, shared->start_position()) + 1; 1624 Script::GetColumnNumber(script, shared->start_position()) + 1;
1609 if (script->name()->IsString()) { 1625 if (script->name()->IsString()) {
1610 Handle<String> script_name(String::cast(script->name())); 1626 Handle<String> script_name(String::cast(script->name()));
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 removeCodeEventListener(jit_logger_); 1862 removeCodeEventListener(jit_logger_);
1847 delete jit_logger_; 1863 delete jit_logger_;
1848 jit_logger_ = NULL; 1864 jit_logger_ = NULL;
1849 } 1865 }
1850 1866
1851 return log_->Close(); 1867 return log_->Close();
1852 } 1868 }
1853 1869
1854 } // namespace internal 1870 } // namespace internal
1855 } // namespace v8 1871 } // namespace v8
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698