On 2015/01/28 10:52:56, Yang wrote:
On 2015/01/28 09:47:30, Yang wrote:
> I will need some more convincing.
>
> Why is this change necessary? The way I see it, you need a way to attach a > boolean metadata to script objects, and retrieve that piece of metadata both
via
> API and in Javascript. The content of that metadata is not interesting to
V8,
as
> it only passes that through.
>
> There are better ways to do this. Script objects are wrapped in JSValue
objects,
> which are JSObjects. As such, you can just manipulate them as normal
Javascript
> objects. You could
> 1) Attach a property to the script object to contain that metadata. If that > property has to be hidden, you can simply use a Symbol as property name. (It > seems to me that this is not a requirement, given that you implemented the
> accessor).
> 2) Use a WeakMap to map script object to the metadata. This is virtually
> equivalent to (1).
>
> Either way, there is no need to make this intrusive change to V8.
>
> Btw. this should actually be done for is_shared_cross_origin as well.
>
> https://codereview.chromium.org/879553002/diff/60001/src/accessors.cc
> File src/accessors.cc (right):
>
>

https://codereview.chromium.org/879553002/diff/60001/src/accessors.cc#newcode794
> src/accessors.cc:794: void Accessors::ScriptIsDebuggerScriptGetter(
> Why is this necessary? I don't see it for the is_shared_cross_origin flag.

Upon closer inspection it seems to me that you would need to get the script
object from the message to be able to use the property. I propose exposing
that
and deprecate ScriptOrigin. I found some bugs in the way we return
ScriptOrigin
values and it just seems to me that there is a lot of redundancy. ScriptOrigin
was intended to pass a set of values to V8, not return from it.

The way we use script metadata from Script/ScriptOrigin in DevTools debugger
doesn't require it to be stored in a JSObject and to be accessible from
javascript. Access that data in DebuggerScript.js [1] just to read the fields later and serialize them as a C++ structure [2]. I don't see why we cannot pass v8::Script or something that would expose accessors to the data stored in Script object internally. That would break debug-debugger.js but if we want to get away
from it towards a better defined C++ API that would be right direction.

[1]
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/bindings/core/v8/DebuggerScript.js&q=debuggerscript.&sq=package:chromium&type=cs&l=201
[2]
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/bindings/core/v8/ScriptDebugServer.cpp&sq=package:chromium&type=cs&l=595&rcl=1422343153


https://codereview.chromium.org/879553002/

--
--
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/d/optout.

Reply via email to