Status: New
Owner: [email protected]
CC: [email protected], [email protected], [email protected], [email protected]
Labels: Type-FeatureRequest Priority-Medium OS-All

New issue 2948 by [email protected]: Support //# sourceURL= and //# sourceMappingURL= in v8's parser
http://code.google.com/p/v8/issues/detail?id=2948

For better debugging experience modern JS debuggers support special directive for labeling eval'ed scripts. The directive is a comment in the form "//# sourceURL=foo.js" added to the bottom of the script [1]. It is supported in all major browsers. Also Source map v.3 specification[2] defines a directive for linking generated code to source maps.

Both directive are currently supported in Chrome DevTools and implemented in 2 places: in v8's ScriptNameOrSourceURL function [3] which is called to format stack traces in v8 in accord with the specified sourceURL and in Blink on every compilation event if script starts at (0,0) position [4]. Apart from the code duplication parsing sourceURL in Blink caused some performance issues (see http://crbug.com/289714).

Integrating sourceURL and sourceMappingURL detection into v8's parser and exposing these URLs on v8::Script would reduce code duplication and resolve the performance issues. Since the directives are top level comments at the bottom of the script and the parser need to scan through the whole script anyways I don't think finding them would have a measurable performance effect on the parser.


[1] http://www.softwareishard.com/blog/firebug/firebug-tip-label-dynamic-scripts-with-sourceurl-directive/ [2] https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.lmz475t4mvbx [3] https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/messages.js&q=sourceURL%20file:v8&sq=package:chromium&type=cs&l=565 [4] https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp&q=ContentSearchUtils::findSourceURL%20file:inspector.*cpp&sq=package:chromium&type=cs&l=930

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to