Index: src/runtime/runtime-interpreter.cc |
diff --git a/src/runtime/runtime-interpreter.cc b/src/runtime/runtime-interpreter.cc |
index ce71e2c52d5a9d5eae43f310759b3f07d4ba337f..62eee1744f57b258879bfa9e2173697cf1cafadc 100644 |
--- a/src/runtime/runtime-interpreter.cc |
+++ b/src/runtime/runtime-interpreter.cc |
@@ -171,5 +171,19 @@ RUNTIME_FUNCTION(Runtime_InterpreterSetPendingMessage) { |
return isolate->heap()->undefined_value(); |
} |
+RUNTIME_FUNCTION(Runtime_InterpreterAdvanceBytecodeOffset) { |
+ SealHandleScope shs(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(BytecodeArray, bytecode_array, 0); |
+ CONVERT_SMI_ARG_CHECKED(bytecode_offset, 1); |
+ interpreter::BytecodeArrayIterator it(bytecode_array); |
+ int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; |
+ while (it.current_offset() < offset) it.Advance(); |
+ DCHECK_EQ(offset, it.current_offset()); |
+ it.Advance(); // Advance by one bytecode. |
+ offset = it.current_offset() + BytecodeArray::kHeaderSize - kHeapObjectTag; |
+ return Smi::FromInt(offset); |
+} |
+ |
} // namespace internal |
} // namespace v8 |