1.1 --- a/jitcraft/BytecodeEmitter.cpp Wed Jul 11 01:12:54 2012 -0700
1.2 +++ b/jitcraft/BytecodeEmitter.cpp Thu Jul 12 00:38:00 2012 -0700
1.3 @@ -32,6 +32,8 @@
1.4 oom_(false),
1.5 maxStackDepth_(0)
1.6 {
1.7 + lastCodePosition_ = 0;
1.8 + firstLine_ = 1;
1.9 }
1.10
1.11 bool
1.12 @@ -95,3 +97,18 @@
1.13 oom_ &= oopRecords_.append(record);
1.14 }
1.15
1.16 +void
1.17 +BytecodeEmitter::note_position(const SourcePosition &pos)
1.18 +{
1.19 + assert(pos.line > 0);
1.20 + assert(unsigned(pos.line) >= firstLine_);
1.21 +
1.22 + unsigned lineDelta = unsigned(pos.line) - firstLine_;
1.23 + unsigned pcDelta = unsigned(position()) - lastCodePosition_;
1.24 +
1.25 + sourcemap_.writeUint32(pcDelta);
1.26 + sourcemap_.writeUint32(lineDelta);
1.27 + sourcemap_.writeUint32(pos.col);
1.28 +
1.29 + lastCodePosition_ = unsigned(position());
1.30 +}