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

Side by Side Diff: src/runtime/runtime-interpreter.cc

Issue 1803373002: [interpreter] Print bytecode offsets when dumping bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 4 years, 8 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/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/frames-inl.h" 10 #include "src/frames-inl.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 CONVERT_ARG_HANDLE_CHECKED(BytecodeArray, bytecode_array, 0); 110 CONVERT_ARG_HANDLE_CHECKED(BytecodeArray, bytecode_array, 0);
111 CONVERT_SMI_ARG_CHECKED(bytecode_offset, 1); 111 CONVERT_SMI_ARG_CHECKED(bytecode_offset, 1);
112 CONVERT_ARG_HANDLE_CHECKED(Object, accumulator, 2); 112 CONVERT_ARG_HANDLE_CHECKED(Object, accumulator, 2);
113 OFStream os(stdout); 113 OFStream os(stdout);
114 114
115 int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; 115 int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag;
116 interpreter::BytecodeArrayIterator bytecode_iterator(bytecode_array); 116 interpreter::BytecodeArrayIterator bytecode_iterator(bytecode_array);
117 AdvanceToOffsetForTracing(bytecode_iterator, offset); 117 AdvanceToOffsetForTracing(bytecode_iterator, offset);
118 if (offset == bytecode_iterator.current_offset()) { 118 if (offset == bytecode_iterator.current_offset()) {
119 // Print bytecode. 119 // Print bytecode.
120 const uint8_t* bytecode_address = 120 const uint8_t* base_address = bytecode_array->GetFirstBytecodeAddress();
121 reinterpret_cast<const uint8_t*>(*bytecode_array) + bytecode_offset; 121 const uint8_t* bytecode_address = base_address + offset;
122 os << " -> " << static_cast<const void*>(bytecode_address) 122 os << " -> " << static_cast<const void*>(bytecode_address) << " @ "
123 << " (" << bytecode_offset << ") : "; 123 << std::setw(4) << offset << " : ";
124 interpreter::Bytecodes::Decode(os, bytecode_address, 124 interpreter::Bytecodes::Decode(os, bytecode_address,
125 bytecode_array->parameter_count()); 125 bytecode_array->parameter_count());
126 os << std::endl; 126 os << std::endl;
127 // Print all input registers and accumulator. 127 // Print all input registers and accumulator.
128 PrintRegisters(os, true, bytecode_iterator, accumulator); 128 PrintRegisters(os, true, bytecode_iterator, accumulator);
129 129
130 os << std::flush; 130 os << std::flush;
131 } 131 }
132 return isolate->heap()->undefined_value(); 132 return isolate->heap()->undefined_value();
133 } 133 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { 167 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) {
168 SealHandleScope shs(isolate); 168 SealHandleScope shs(isolate);
169 DCHECK_EQ(1, args.length()); 169 DCHECK_EQ(1, args.length());
170 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); 170 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0);
171 isolate->thread_local_top()->pending_message_obj_ = *message; 171 isolate->thread_local_top()->pending_message_obj_ = *message;
172 return isolate->heap()->undefined_value(); 172 return isolate->heap()->undefined_value();
173 } 173 }
174 174
175 } // namespace internal 175 } // namespace internal
176 } // namespace v8 176 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698