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

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: Fix pedantic build (take2). 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
« no previous file with comments | « 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 5b7a9a7a1fd78f8d58071633ce36ea62fb72df02..40797d06cd88010f0fdff953e10941bc2a406261 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"
@@ -1273,6 +1274,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;
@@ -1499,6 +1503,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;
@@ -11612,6 +11617,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;
+ }
+}
+
+
// static
void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) {
DCHECK(capacity >= 0);
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698