| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 interpreter::Bytecode bytecode = bytecode_iterator.current_bytecode(); | 57 interpreter::Bytecode bytecode = bytecode_iterator.current_bytecode(); |
| 58 | 58 |
| 59 // Print accumulator. | 59 // Print accumulator. |
| 60 if ((is_input && interpreter::Bytecodes::ReadsAccumulator(bytecode)) || | 60 if ((is_input && interpreter::Bytecodes::ReadsAccumulator(bytecode)) || |
| 61 (!is_input && interpreter::Bytecodes::WritesAccumulator(bytecode))) { | 61 (!is_input && interpreter::Bytecodes::WritesAccumulator(bytecode))) { |
| 62 os << " [ " << kAccumulator << kArrowDirection; | 62 os << " [ " << kAccumulator << kArrowDirection; |
| 63 accumulator->ShortPrint(); | 63 accumulator->ShortPrint(); |
| 64 os << " ]" << std::endl; | 64 os << " ]" << std::endl; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Find the location of the register file. | 67 // Print the registers. |
| 68 JavaScriptFrameIterator frame_iterator( | 68 JavaScriptFrameIterator frame_iterator( |
| 69 bytecode_iterator.bytecode_array()->GetIsolate()); | 69 bytecode_iterator.bytecode_array()->GetIsolate()); |
| 70 JavaScriptFrame* frame = frame_iterator.frame(); | 70 InterpretedFrame* frame = |
| 71 Address register_file = | 71 reinterpret_cast<InterpretedFrame*>(frame_iterator.frame()); |
| 72 frame->fp() + InterpreterFrameConstants::kRegisterFilePointerFromFp; | |
| 73 | |
| 74 // Print the registers. | |
| 75 int operand_count = interpreter::Bytecodes::NumberOfOperands(bytecode); | 72 int operand_count = interpreter::Bytecodes::NumberOfOperands(bytecode); |
| 76 for (int operand_index = 0; operand_index < operand_count; operand_index++) { | 73 for (int operand_index = 0; operand_index < operand_count; operand_index++) { |
| 77 interpreter::OperandType operand_type = | 74 interpreter::OperandType operand_type = |
| 78 interpreter::Bytecodes::GetOperandType(bytecode, operand_index); | 75 interpreter::Bytecodes::GetOperandType(bytecode, operand_index); |
| 79 bool should_print = | 76 bool should_print = |
| 80 is_input | 77 is_input |
| 81 ? interpreter::Bytecodes::IsRegisterInputOperandType(operand_type) | 78 ? interpreter::Bytecodes::IsRegisterInputOperandType(operand_type) |
| 82 : interpreter::Bytecodes::IsRegisterOutputOperandType(operand_type); | 79 : interpreter::Bytecodes::IsRegisterOutputOperandType(operand_type); |
| 83 if (should_print) { | 80 if (should_print) { |
| 84 interpreter::Register first_reg = | 81 interpreter::Register first_reg = |
| 85 bytecode_iterator.GetRegisterOperand(operand_index); | 82 bytecode_iterator.GetRegisterOperand(operand_index); |
| 86 int range = bytecode_iterator.GetRegisterOperandRange(operand_index); | 83 int range = bytecode_iterator.GetRegisterOperandRange(operand_index); |
| 87 for (int reg_index = first_reg.index(); | 84 for (int reg_index = first_reg.index(); |
| 88 reg_index < first_reg.index() + range; reg_index++) { | 85 reg_index < first_reg.index() + range; reg_index++) { |
| 89 Address reg_location = register_file - reg_index * kPointerSize; | 86 Object* reg_object = frame->ReadInterpreterRegister(reg_index); |
| 90 Object* reg_object = Memory::Object_at(reg_location); | |
| 91 os << " [ " << std::setw(kRegFieldWidth) | 87 os << " [ " << std::setw(kRegFieldWidth) |
| 92 << interpreter::Register(reg_index).ToString( | 88 << interpreter::Register(reg_index).ToString( |
| 93 bytecode_iterator.bytecode_array()->parameter_count()) | 89 bytecode_iterator.bytecode_array()->parameter_count()) |
| 94 << kArrowDirection; | 90 << kArrowDirection; |
| 95 reg_object->ShortPrint(os); | 91 reg_object->ShortPrint(os); |
| 96 os << " ]" << std::endl; | 92 os << " ]" << std::endl; |
| 97 } | 93 } |
| 98 } | 94 } |
| 99 } | 95 } |
| 100 if (FLAG_log_colour) { | 96 if (FLAG_log_colour) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { | 163 RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { |
| 168 SealHandleScope shs(isolate); | 164 SealHandleScope shs(isolate); |
| 169 DCHECK_EQ(1, args.length()); | 165 DCHECK_EQ(1, args.length()); |
| 170 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); | 166 CONVERT_ARG_HANDLE_CHECKED(Object, message, 0); |
| 171 isolate->thread_local_top()->pending_message_obj_ = *message; | 167 isolate->thread_local_top()->pending_message_obj_ = *message; |
| 172 return isolate->heap()->undefined_value(); | 168 return isolate->heap()->undefined_value(); |
| 173 } | 169 } |
| 174 | 170 |
| 175 } // namespace internal | 171 } // namespace internal |
| 176 } // namespace v8 | 172 } // namespace v8 |
| OLD | NEW |