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

Unified Diff: src/objects.cc

Issue 1662983002: [interpreter] add source positions for call and call-new. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index d48e7efa06682edb49d4b983cafcad7b3aff9985..e701de0fd2c7c2741bd87f921bf1ac92f7e43b58 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -30,6 +30,7 @@
#include "src/ic/ic.h"
#include "src/identity-map.h"
#include "src/interpreter/bytecodes.h"
+#include "src/interpreter/source-position-table.h"
#include "src/isolate-inl.h"
#include "src/key-accumulator.h"
#include "src/list.h"
@@ -15043,8 +15044,8 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT
#endif // ENABLE_DISASSEMBLER
int BytecodeArray::SourcePosition(int offset) {
- // TODO(yangguo): implement this.
- return 0;
+ return interpreter::SourcePositionTableIterator::PositionFromBytecodeOffset(
+ this, offset);
}
void BytecodeArray::Disassemble(std::ostream& os) {
@@ -15054,12 +15055,24 @@ void BytecodeArray::Disassemble(std::ostream& os) {
const uint8_t* first_bytecode_address = GetFirstBytecodeAddress();
int bytecode_size = 0;
+
+ interpreter::SourcePositionTableIterator source_positions(this);
+ source_positions.Next();
+
for (int i = 0; i < this->length(); i += bytecode_size) {
const uint8_t* bytecode_start = &first_bytecode_address[i];
interpreter::Bytecode bytecode =
interpreter::Bytecodes::FromByte(bytecode_start[0]);
bytecode_size = interpreter::Bytecodes::Size(bytecode);
+ if (i == source_positions.bytecode_offset()) {
+ os << std::setw(5) << source_positions.source_position();
+ os << (source_positions.is_statement() ? " S> " : " E> ");
+ source_positions.Next();
+ } else {
+ os << " ";
+ }
+
SNPrintF(buf, "%p", bytecode_start);
os << buf.start() << " : ";
interpreter::Bytecodes::Decode(os, bytecode_start, parameter_count());
@@ -15082,7 +15095,8 @@ void BytecodeArray::Disassemble(std::ostream& os) {
SNPrintF(buf, " (%p)", bytecode_start + offset);
os << buf.start();
}
- os << "\n";
+
+ os << std::endl;
}
if (constant_pool()->length() > 0) {

Powered by Google App Engine
This is Rietveld 408576698