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

Unified Diff: src/interpreter/interpreter.cc

Issue 2079613003: [generators] Implement %GeneratorGetSourcePosition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: enable test Created 4 years, 6 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
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 8aea6c8209815b77e5d2d02d07d2a8600cfe5f96..284dbe34682a0c3e0f7bc8813a312ea873fb3dee 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -1791,7 +1791,8 @@ void Interpreter::DoNop(InterpreterAssembler* assembler) { __ Dispatch(); }
// SuspendGenerator <generator>
//
// Exports the register file and stores it into the generator. Also stores the
-// current context and the state given in the accumulator into the generator.
+// current context, the state given in the accumulator, and the current bytecode
+// offset (for debugging purposes) into the generator.
void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) {
Node* generator_reg = __ BytecodeOperandReg(0);
Node* generator = __ LoadRegister(generator_reg);
@@ -1816,6 +1817,13 @@ void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) {
__ StoreObjectField(generator, JSGeneratorObject::kContextOffset, context);
__ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, state);
+ // The bytecode offsets here are relative to a different base than the ones
+ // used in the source position table, hence the subtraction.
+ Node* offset = __ SmiTag(__ IntPtrSub(
+ __ BytecodeOffset(),
+ __ IntPtrConstant(BytecodeArray::kHeaderSize - kHeapObjectTag)));
+ __ StoreObjectField(generator, JSGeneratorObject::kInputOffset, offset);
rmcilroy 2016/06/20 11:11:26 Could we just store the non-subtracted value in th
+
__ Dispatch();
__ Bind(&if_stepping);

Powered by Google App Engine
This is Rietveld 408576698