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

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: fix test expectations Created 4 years, 10 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
« no previous file with comments | « src/interpreter/source-position-table.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 3b41cd22ecb669ccb3eb5d65a12a2ac41025e58b..9c93a811804ea99a46f764932e47a6e0aa95526c 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"
@@ -15025,8 +15026,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) {
@@ -15036,12 +15037,23 @@ void BytecodeArray::Disassemble(std::ostream& os) {
const uint8_t* first_bytecode_address = GetFirstBytecodeAddress();
int bytecode_size = 0;
+
+ interpreter::SourcePositionTableIterator source_positions(this);
+
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 (!source_positions.done() && i == source_positions.bytecode_offset()) {
+ os << std::setw(5) << source_positions.source_position();
+ os << (source_positions.is_statement() ? " S> " : " E> ");
+ source_positions.Advance();
+ } else {
+ os << " ";
+ }
+
SNPrintF(buf, "%p", bytecode_start);
os << buf.start() << " : ";
interpreter::Bytecodes::Decode(os, bytecode_start, parameter_count());
@@ -15064,7 +15076,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) {
« no previous file with comments | « src/interpreter/source-position-table.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698