Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created May 24, 2019 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/569ec70040abc74b5f85471a06370bbd to your computer and use it in GitHub Desktop.
Save jasonLaster/569ec70040abc74b5f85471a06370bbd to your computer and use it in GitHub Desktop.
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp
index 52441b211160..aa9eb1387788 100644
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -515,7 +515,7 @@ bool BytecodeEmitter::updateLineNumberNotes(uint32_t offset) {
* unsigned delta_ wrap to a very large number, which triggers a
* SRC_SETLINE.
*/
- bytecodeSection().setCurrentLine(line);
+ bytecodeSection().setCufrentLine(line);
if (delta >= LengthOfSetLine(line)) {
if (!newSrcNote2(SRC_SETLINE, ptrdiff_t(line))) {
return false;
@@ -7458,8 +7458,10 @@ bool BytecodeEmitter::emitCallOrNew(
coordNode = &calleeNode->as<PropertyAccess>().key();
break;
case ParseNodeKind::Name:
- // Use the start of callee names.
- coordNode = calleeNode;
+ if (!isLastPositionASeparator(calleeNode.beginPos)) {
+ // Use the start of callee names.
+ coordNode = calleeNode;
+ }
break;
default:
break;
diff --git a/js/src/frontend/BytecodeSection.h b/js/src/frontend/BytecodeSection.h
index 34d6d21c24d7..87cebfbbf888 100644
--- a/js/src/frontend/BytecodeSection.h
+++ b/js/src/frontend/BytecodeSection.h
@@ -210,6 +210,12 @@ class BytecodeSection {
lastSeparatorColumn_ == lastColumn_;
}
+ // given this location, is this a separator point
+ bool isLastSeparator(loc) const {
+ return lastSeparatorLine_ == currentLine_ &&
+ lastSeparatorColumn_ == lastColumn_;
+ }
+
// ---- JIT ----
uint32_t numICEntries() const { return numICEntries_; }
diff --git a/js/src/jit-test/tests/debug/Script-getPossibleBreakpoints.js b/js/src/jit-test/tests/debug/Script-getPossibleBreakpoints.js
index f94f5ebbb9f9..adb9f809a17e 100644
--- a/js/src/jit-test/tests/debug/Script-getPossibleBreakpoints.js
+++ b/js/src/jit-test/tests/debug/Script-getPossibleBreakpoints.js
@@ -6,7 +6,7 @@ assertBreakpoints(`
// ExpressionStatement with calls
assertBreakpoints(`
- /*S*/a();
+ /*S*/a/*B*/();
/*S*/obj./*B*/prop();
`);
@@ -341,7 +341,7 @@ assertBreakpoints(`
function assertBreakpoints(expected) {
const input = expected.replace(/\/\*[BS]\*\//g, "");
- var global = newGlobal({newCompartment: true});
+ var global = newGlobal({ newCompartment: true });
var dbg = Debugger(global);
dbg.onDebuggerStatement = function(frame) {
const fScript = frame.environment.parent.getVariable("f").script;
@@ -382,7 +382,12 @@ function annotateOffsets(code, positions) {
for (const { lineNumber, columnNumber, isStepStart } of positions) {
const offset = offsetLookup(lineNumber, columnNumber);
- output = "/*" + (isStepStart ? "S" : "B") + "*/" + code.slice(offset, last) + output;
+ output =
+ "/*" +
+ (isStepStart ? "S" : "B") +
+ "*/" +
+ code.slice(offset, last) +
+ output;
last = offset;
}
return code.slice(0, last) + output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment