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

Unified Diff: src/objects.cc

Issue 1230753004: [Interpreter] Add BytecodeArray class and add to SharedFunctionInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate patch set 11 comments. Created 5 years, 5 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
« src/objects.h ('K') | « src/objects.h ('k') | src/objects-debug.cc » ('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 d16bd828b43bf310e290840e3a5f9ee1175ef422..26b1b9a474e474083dc7f4dbcc88c0b98fb2b36f 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -31,6 +31,7 @@
#include "src/heap/objects-visiting-inl.h"
#include "src/hydrogen.h"
#include "src/ic/ic.h"
+#include "src/interpreter/bytecodes.h"
#include "src/log.h"
#include "src/lookup.h"
#include "src/macro-assembler.h"
@@ -1250,6 +1251,9 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
case BYTE_ARRAY_TYPE:
os << "<ByteArray[" << ByteArray::cast(this)->length() << "]>";
break;
+ case BYTECODE_ARRAY_TYPE:
+ os << "<BytecodeArray[" << BytecodeArray::cast(this)->length() << "]>";
+ break;
case FREE_SPACE_TYPE:
os << "<FreeSpace[" << FreeSpace::cast(this)->Size() << "]>";
break;
@@ -1476,6 +1480,7 @@ void HeapObject::IterateBody(InstanceType type, int object_size,
case FLOAT32X4_TYPE:
case FILLER_TYPE:
case BYTE_ARRAY_TYPE:
+ case BYTECODE_ARRAY_TYPE:
case FREE_SPACE_TYPE:
break;
@@ -11791,6 +11796,29 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT
#endif // ENABLE_DISASSEMBLER
+void BytecodeArray::Disassemble(std::ostream& os) {
+ os << "Frame size " << frame_size()
+ << ", number of locals = " << number_of_locals() << "\n";
+ Vector<char> buf = Vector<char>::New(50);
+ int bytecode_size = 0;
+ for (int i = 0; i < this->length(); i += bytecode_size) {
+ interpreter::Bytecode bytecode = static_cast<interpreter::Bytecode>(get(i));
+ bytecode_size = interpreter::Bytecodes::Size(bytecode);
+
+ SNPrintF(buf, "%p : ", GetFirstBytecodeAddress() + i);
+ os << buf.start();
+ for (int j = 0; j < bytecode_size; j++) {
+ SNPrintF(buf, "%02x ", get(i + j));
+ os << buf.start();
+ }
+ for (int j = bytecode_size; j < interpreter::Bytecodes::kMaximumSize; j++) {
+ os << " ";
+ }
+ os << bytecode;
rmcilroy 2015/07/21 11:25:16 What does this print out, it's hard to see from th
+ }
+}
+
+
// static
void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) {
DCHECK(capacity >= 0);
« src/objects.h ('K') | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698