[webkit-dev] Internal JSON Parsing

2011-12-08 Thread Jarred Nicholls
Hey webkittens,

I'm working on https://bugs.webkit.org/show_bug.cgi?id=73648 to support the
json response entity from XHR.response.  Unless I'm mistaken (the purpose
of this inquiry) we don't appear to have a VM-agnostic interface for
internal JSON parsing, i.e., straight to the parsers.  If so, what does
everyone think about adding in that basic interface?  What I'd like to
avoid is preprocessor branches directly in XHR talking to JSC and V8
directly; instead, what would be ideal I think is an interface to parse and
return a ScriptObject.

Any additional input is surely welcomed.

Thanks,
Jarred
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Internal JSON Parsing

2011-12-08 Thread Adam Barth
Check out InspectorValue.  It should be renamed to JSONValue, but it should
meet your needs.

Adam
 On Dec 8, 2011 8:39 AM, Jarred Nicholls jar...@webkit.org wrote:

 Hey webkittens,

 I'm working on https://bugs.webkit.org/show_bug.cgi?id=73648 to support
 the json response entity from XHR.response.  Unless I'm mistaken (the
 purpose of this inquiry) we don't appear to have a VM-agnostic interface
 for internal JSON parsing, i.e., straight to the parsers.  If so, what does
 everyone think about adding in that basic interface?  What I'd like to
 avoid is preprocessor branches directly in XHR talking to JSC and V8
 directly; instead, what would be ideal I think is an interface to parse and
 return a ScriptObject.

 Any additional input is surely welcomed.

 Thanks,
 Jarred

 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Internal JSON Parsing

2011-12-08 Thread Oliver Hunt
It's not safe to use ScriptObject for values that are kept alive by JS objects 
as it leads to cycles in the collector.

Also the cached value for an attribute should be in the binding classes, not 
the implementation classes.  The easiest way to understand why is to ask 
yourself how a non-js (objc, gobject, etc) binding layer would use the same 
cached value.

I suspect you can probably just kill off the no custom getter+CachedAttribute 
check in the code generator as I think i was simply being conservative when i 
wrote that code.

--Oliver

On Dec 8, 2011, at 8:39 AM, Jarred Nicholls wrote:

 Hey webkittens,
 
 I'm working on https://bugs.webkit.org/show_bug.cgi?id=73648 to support the 
 json response entity from XHR.response.  Unless I'm mistaken (the purpose of 
 this inquiry) we don't appear to have a VM-agnostic interface for internal 
 JSON parsing, i.e., straight to the parsers.  If so, what does everyone think 
 about adding in that basic interface?  What I'd like to avoid is preprocessor 
 branches directly in XHR talking to JSC and V8 directly; instead, what would 
 be ideal I think is an interface to parse and return a ScriptObject.
 
 Any additional input is surely welcomed.
 
 Thanks,
 Jarred
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Internal JSON Parsing

2011-12-08 Thread Pavel Feldman
On Thu, Dec 8, 2011 at 8:51 AM, Adam Barth aba...@webkit.org wrote:

 Check out InspectorValue.  It should be renamed to JSONValue, but it
 should meet your needs.

InspectorValue is not intended to be used as a full fledged JSON parser. It
only covers subset of the standard that is sufficient for the inspector
operation. The spec requires that you Return the result of invoking the
parse function of the JSON object defined in ECMAScript and I wonder why
you are willing to do otherwise.

Pavel


 Adam
  On Dec 8, 2011 8:39 AM, Jarred Nicholls jar...@webkit.org wrote:

 Hey webkittens,

 I'm working on https://bugs.webkit.org/show_bug.cgi?id=73648 to support
 the json response entity from XHR.response.  Unless I'm mistaken (the
 purpose of this inquiry) we don't appear to have a VM-agnostic interface
 for internal JSON parsing, i.e., straight to the parsers.  If so, what does
 everyone think about adding in that basic interface?  What I'd like to
 avoid is preprocessor branches directly in XHR talking to JSC and V8
 directly; instead, what would be ideal I think is an interface to parse and
 return a ScriptObject.

 Any additional input is surely welcomed.

 Thanks,
 Jarred

 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Internal JSON Parsing

2011-12-08 Thread Jarred Nicholls
That's precisely what I wanted to do initially.  I had conflicting feelings
on this, but my first intuition was to cache in the bindings the value
directly parsed and state managed by the respective VM.  I don't see this
value being used by a different binding layer in parallel.

On Thu, Dec 8, 2011 at 12:08 PM, Oliver Hunt oli...@apple.com wrote:

 It's not safe to use ScriptObject for values that are kept alive by JS
 objects as it leads to cycles in the collector.

 Also the cached value for an attribute should be in the binding classes,
 not the implementation classes.  The easiest way to understand why is to
 ask yourself how a non-js (objc, gobject, etc) binding layer would use the
 same cached value.

 I suspect you can probably just kill off the no custom
 getter+CachedAttribute check in the code generator as I think i was simply
 being conservative when i wrote that code.

 --Oliver

 On Dec 8, 2011, at 8:39 AM, Jarred Nicholls wrote:

 Hey webkittens,

 I'm working on https://bugs.webkit.org/show_bug.cgi?id=73648 to support
 the json response entity from XHR.response.  Unless I'm mistaken (the
 purpose of this inquiry) we don't appear to have a VM-agnostic interface
 for internal JSON parsing, i.e., straight to the parsers.  If so, what does
 everyone think about adding in that basic interface?  What I'd like to
 avoid is preprocessor branches directly in XHR talking to JSC and V8
 directly; instead, what would be ideal I think is an interface to parse and
 return a ScriptObject.

 Any additional input is surely welcomed.

 Thanks,
 Jarred
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev



___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Internal JSON Parsing

2011-12-08 Thread Adam Barth
On Thu, Dec 8, 2011 at 9:16 AM, Pavel Feldman pfeld...@chromium.org wrote:
 On Thu, Dec 8, 2011 at 8:51 AM, Adam Barth aba...@webkit.org wrote:

 Check out InspectorValue.  It should be renamed to JSONValue, but it
 should meet your needs.

 InspectorValue is not intended to be used as a full fledged JSON parser. It
 only covers subset of the standard that is sufficient for the inspector
 operation. The spec requires that you Return the result of invoking the
 parse function of the JSON object defined in ECMAScript and I wonder why
 you are willing to do otherwise.

Which spec?  Is that text in http://www.ietf.org/rfc/rfc4627 ?

Adam
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Internal JSON Parsing

2011-12-08 Thread Adam Barth
On Thu, Dec 8, 2011 at 9:52 AM, Pavel Feldman pfeld...@chromium.org wrote:

 On Thu, Dec 8, 2011 at 9:34 AM, Adam Barth aba...@webkit.org wrote:

 On Thu, Dec 8, 2011 at 9:16 AM, Pavel Feldman pfeld...@chromium.org
 wrote:
  On Thu, Dec 8, 2011 at 8:51 AM, Adam Barth aba...@webkit.org wrote:
 
  Check out InspectorValue.  It should be renamed to JSONValue, but it
  should meet your needs.
 
  InspectorValue is not intended to be used as a full fledged JSON parser.
  It
  only covers subset of the standard that is sufficient for the inspector
  operation. The spec requires that you Return the result of invoking the
  parse function of the JSON object defined in ECMAScript and I wonder
  why
  you are willing to do otherwise.

 Which spec?  Is that text in http://www.ietf.org/rfc/rfc4627 ?


 I was referring to
 the http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#json-response-entity-body mentioned
 in the bug this thread is about.

Ah.  That spec is likely wrong.  I'll email the working group.

Adam
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Internal JSON Parsing

2011-12-08 Thread Adam Barth
On Thu, Dec 8, 2011 at 9:55 AM, Adam Barth aba...@webkit.org wrote:
 On Thu, Dec 8, 2011 at 9:52 AM, Pavel Feldman pfeld...@chromium.org wrote:

 On Thu, Dec 8, 2011 at 9:34 AM, Adam Barth aba...@webkit.org wrote:

 On Thu, Dec 8, 2011 at 9:16 AM, Pavel Feldman pfeld...@chromium.org
 wrote:
  On Thu, Dec 8, 2011 at 8:51 AM, Adam Barth aba...@webkit.org wrote:
 
  Check out InspectorValue.  It should be renamed to JSONValue, but it
  should meet your needs.
 
  InspectorValue is not intended to be used as a full fledged JSON parser.
  It
  only covers subset of the standard that is sufficient for the inspector
  operation. The spec requires that you Return the result of invoking the
  parse function of the JSON object defined in ECMAScript and I wonder
  why
  you are willing to do otherwise.

 Which spec?  Is that text in http://www.ietf.org/rfc/rfc4627 ?


 I was referring to
 the http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#json-response-entity-body mentioned
 in the bug this thread is about.

 Ah.  That spec is likely wrong.  I'll email the working group.

Actually, I take it back.  You're right.  We need to use the
engine-specific JSON parsing implementation because we're returning
these objects to the JavaScript engine.

It's likely the correct way to handle this with custom bindings, sadly.

Adam
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev