[vm/bytecode] Add source positions for more bytecode instructions

Also, correct source position for CheckStack instruction in the prologue of
a closure.

Change-Id: I175e5398296f17a1f67a223d45725206e65e0e8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105040
Reviewed-by: RĂ©gis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
diff --git a/pkg/vm/lib/bytecode/assembler.dart b/pkg/vm/lib/bytecode/assembler.dart
index 6401815..387db94 100644
--- a/pkg/vm/lib/bytecode/assembler.dart
+++ b/pkg/vm/lib/bytecode/assembler.dart
@@ -282,6 +282,7 @@
   }
 
   void emitJump(Label label) {
+    emitSourcePosition();
     _emitJumpInstruction(Opcode.kJump, label);
     isUnreachable = true;
   }
@@ -319,6 +320,7 @@
   }
 
   void emitReturnTOS() {
+    emitSourcePosition();
     _emitInstruction0(Opcode.kReturnTOS);
     isUnreachable = true;
   }
@@ -352,10 +354,12 @@
   }
 
   void emitStoreLocal(int rx) {
+    emitSourcePosition();
     _emitInstructionX(Opcode.kStoreLocal, rx);
   }
 
   void emitPopLocal(int rx) {
+    emitSourcePosition();
     _emitInstructionX(Opcode.kPopLocal, rx);
   }
 
diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart
index 01a941d..ba4f75e 100644
--- a/pkg/vm/lib/bytecode/gen_bytecode.dart
+++ b/pkg/vm/lib/bytecode/gen_bytecode.dart
@@ -1732,8 +1732,8 @@
 
     final int closureFunctionIndex = cp.addClosureFunction(closureIndex);
 
-    _genPrologue(node, function);
     _recordSourcePosition(function.fileOffset);
+    _genPrologue(node, function);
 
     Label continuationSwitchLabel;
     int continuationSwitchVar;