 Chromium Code Reviews
 Chromium Code Reviews Issue 1230753004:
  [Interpreter] Add BytecodeArray class and add to SharedFunctionInfo.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1230753004:
  [Interpreter] Add BytecodeArray class and add to SharedFunctionInfo.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/objects.cc | 
| diff --git a/src/objects.cc b/src/objects.cc | 
| index d16bd828b43bf310e290840e3a5f9ee1175ef422..9914990b206441401278937aa6234ebf5e4adc18 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,27 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT | 
| #endif // ENABLE_DISASSEMBLER | 
| +void BytecodeArray::Disassemble(std::ostream& os) { | 
| + Vector<char> buf = Vector<char>::New(50); | 
| + int bytecode_size = 0; | 
| 
rmcilroy
2015/07/20 11:39:46
Could you print out frame size / locals count here
 
oth
2015/07/20 13:47:31
Done.
 | 
| + 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); |