Trying to track down error in source location reporting

63 views
Skip to first unread message

Ashley Chekhov

unread,
Apr 8, 2024, 4:22:42 AM4/8/24
to v8-dev
I've been trying to track down a bug in reported location of source code that causes errors in node's error reporting (i.e. The wrong part of the code is shown). I have discovered that it is due to optimizations/jit, as the error does not occur when I preface the test code with "eval("");". Do you think this is even salvageable or is it just an inherent limitation of translation to machine code? If not, do you have any advice on where I should look for a solution?

Jakob Kummerow

unread,
Apr 8, 2024, 4:34:41 AM4/8/24
to v8-...@googlegroups.com
I think we generally expect reported source locations to be correct, including from optimized code. I don't know where the bug might be when that isn't working.

Ashley Chekhov

unread,
Apr 8, 2024, 2:51:51 PM4/8/24
to v8-dev
It's good to know that this isn't a necessary evil then. Will keep looking, thanks =)

Ashley Chekhov

unread,
Apr 10, 2024, 2:35:51 PM4/10/24
to v8-dev
So I've learned that the issue is caused by a missing SourcePosition from the SourcePositionTable. Does anybody know where the SourcePositionTable is created (where the actual data is specified) for UnoptimizedFrame? This problem shows up during a call to UnoptimizedFrame::Summarize, but it's indicative of an issue occurring earlier on in the compilation process.

Andreas Haas

unread,
Apr 11, 2024, 4:14:01 AM4/11/24
to v8-...@googlegroups.com
Hi Ashley,

The generation of source positions depends on the compiler that generated the code, at least for WebAssembly. In Liftoff, the compiler explicitly emits source positions where needed, see e.g. [1]. In TurboFan and Turboshaft the compiler generates source positions for all nodes, but then filters them in the instruction selector [2] and only emits source positions for some nodes.

I guess your code object was generated from a different compiler, but maybe these code pointers help you anyways.

Cheers, Andreas


--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/5f1e3102-cb24-41e1-b9de-b23b779e20b8n%40googlegroups.com.


--

Andreas Haas

Software Engineer

ah...@google.com


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Liana Sebastian

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.

    

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.


Ashley Chekhov

unread,
Apr 11, 2024, 11:24:47 AM4/11/24
to v8-...@googlegroups.com
This is not WebAssembly, it's a JavaScript issue, does the same still hold true? The issue shows itself to already exist during or before generation of bytecode, due to the fact that this is the SourcePositionTable for the bytecode.

I will look the resources you linked, thank you.

You received this message because you are subscribed to a topic in the Google Groups "v8-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-dev/O2lbGJJh3ak/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CAELSTvctXK%3D4nKfrr_omH4o4UPsQw174M7QpoP2ebx-Qv2ksOQ%40mail.gmail.com.

Leszek Swirski

unread,
Apr 11, 2024, 11:32:43 AM4/11/24
to v8-...@googlegroups.com
Source positions for unoptimized JavaScript are computed lazily, by the Compiler::CollectSourcePositions function, which is called by SharedFunctionInfo::EnsureSourcePositionsAvailable as needed. Maybe somewhere there's a missing call to these? 

Reply all
Reply to author
Forward
0 new messages