WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
122351
JSManagedValue should be able to store non-object JSValues
https://bugs.webkit.org/show_bug.cgi?id=122351
Summary
JSManagedValue should be able to store non-object JSValues
Mark Hahnenberg
Reported
2013-10-04 14:53:08 PDT
We decided not to support this because we thought it didn’t make sense to have a “weak” JSValue that wasn’t an object. Our general thought process was if you have a JSObject-ObjC object pair (i.e. an Obj-C object that you exported to JavaScript-land), it makes more sense to store a non-object JSValue on the JavaScript-land version of the object rather than as an ivar in the Objective-C object. In retrospect, this may not have been a good decision at least w.r.t. consistency in client code. If you’re storing a bag of JSValues off an Obj-C object, you’d like to store all of them either in ObjC-land or JavaScript-land, but doing some in one and some in the other doesn’t sound too good. Also, what if the object you want to hang these values off of doesn’t have a corresponding object in JavaScript-land in which to store them? I think the solution would probably be to fix JSManagedValue to be able to reference non-object JSValues. Right now, all JSManagedValues contain a Weak<JSObject>. To fix this, we should change Weak<T> to allow non-object template parameters (similar to how WriteBarrier has an “Unknown” template specialization). The downside of this option is that it's a tad wasteful, as we’ll allocate some additional, unnecessary state in the JS runtime. The upside is that the virtual machine will clear the Weak field when it goes away, preventing clients from accidentally trying to do something with it later.
Attachments
Patch
(21.41 KB, patch)
2013-10-04 16:28 PDT
,
Mark Hahnenberg
no flags
Details
Formatted Diff
Diff
Patch
(22.45 KB, patch)
2013-10-05 08:20 PDT
,
Mark Hahnenberg
no flags
Details
Formatted Diff
Diff
Patch
(22.36 KB, patch)
2013-10-05 10:27 PDT
,
Mark Hahnenberg
no flags
Details
Formatted Diff
Diff
Patch
(7.02 KB, patch)
2013-10-07 17:04 PDT
,
Mark Hahnenberg
no flags
Details
Formatted Diff
Diff
Patch
(11.56 KB, patch)
2013-10-07 17:58 PDT
,
Mark Hahnenberg
oliver
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Mark Hahnenberg
Comment 1
2013-10-04 14:56:34 PDT
<
rdar://problem/15151935
>
Mark Hahnenberg
Comment 2
2013-10-04 16:28:22 PDT
Created
attachment 213416
[details]
Patch
WebKit Commit Bot
Comment 3
2013-10-04 16:29:50 PDT
Attachment 213416
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/API/JSManagedValue.mm', u'Source/JavaScriptCore/API/tests/testapi.mm', u'Source/JavaScriptCore/ChangeLog', u'Source/JavaScriptCore/heap/Heap.cpp', u'Source/JavaScriptCore/heap/Heap.h', u'Source/JavaScriptCore/heap/Weak.h', u'Source/JavaScriptCore/heap/WeakBlock.cpp', u'Source/JavaScriptCore/heap/WeakImpl.h', u'Source/JavaScriptCore/heap/WeakInlines.h', u'Source/JavaScriptCore/heap/WeakSet.h', u'Source/JavaScriptCore/heap/WeakSetInlines.h', u'Source/JavaScriptCore/runtime/VM.h']" exit_code: 1 Source/JavaScriptCore/heap/Weak.h:64: Missing spaces around && [whitespace/operators] [3] Source/JavaScriptCore/heap/Weak.h:73: Missing spaces around && [whitespace/operators] [3] Total errors found: 2 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 4
2013-10-04 17:11:39 PDT
Comment on
attachment 213416
[details]
Patch
Attachment 213416
[details]
did not pass win-ews (win): Output:
http://webkit-queues.appspot.com/results/3314041
Mark Hahnenberg
Comment 5
2013-10-05 08:20:19 PDT
Created
attachment 213452
[details]
Patch
WebKit Commit Bot
Comment 6
2013-10-05 08:21:38 PDT
Attachment 213452
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/API/JSManagedValue.mm', u'Source/JavaScriptCore/API/tests/testapi.mm', u'Source/JavaScriptCore/ChangeLog', u'Source/JavaScriptCore/heap/Heap.cpp', u'Source/JavaScriptCore/heap/Heap.h', u'Source/JavaScriptCore/heap/Weak.h', u'Source/JavaScriptCore/heap/WeakBlock.cpp', u'Source/JavaScriptCore/heap/WeakImpl.h', u'Source/JavaScriptCore/heap/WeakInlines.h', u'Source/JavaScriptCore/heap/WeakSet.h', u'Source/JavaScriptCore/heap/WeakSetInlines.h', u'Source/JavaScriptCore/runtime/VM.h']" exit_code: 1 Source/JavaScriptCore/heap/WeakInlines.h:83: This { should be at the end of the previous line [whitespace/braces] [4] Source/JavaScriptCore/heap/WeakInlines.h:90: This { should be at the end of the previous line [whitespace/braces] [4] Source/JavaScriptCore/heap/Weak.h:64: Missing spaces around && [whitespace/operators] [3] Source/JavaScriptCore/heap/Weak.h:73: Missing spaces around && [whitespace/operators] [3] Total errors found: 4 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Hahnenberg
Comment 7
2013-10-05 10:27:38 PDT
Created
attachment 213458
[details]
Patch
WebKit Commit Bot
Comment 8
2013-10-05 10:30:10 PDT
Attachment 213458
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/API/JSManagedValue.mm', u'Source/JavaScriptCore/API/tests/testapi.mm', u'Source/JavaScriptCore/ChangeLog', u'Source/JavaScriptCore/heap/Heap.cpp', u'Source/JavaScriptCore/heap/Heap.h', u'Source/JavaScriptCore/heap/Weak.h', u'Source/JavaScriptCore/heap/WeakBlock.cpp', u'Source/JavaScriptCore/heap/WeakImpl.h', u'Source/JavaScriptCore/heap/WeakInlines.h', u'Source/JavaScriptCore/heap/WeakSet.h', u'Source/JavaScriptCore/heap/WeakSetInlines.h', u'Source/JavaScriptCore/runtime/VM.h']" exit_code: 1 Source/JavaScriptCore/heap/WeakInlines.h:90: This { should be at the end of the previous line [whitespace/braces] [4] Source/JavaScriptCore/heap/Weak.h:64: Missing spaces around && [whitespace/operators] [3] Total errors found: 2 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Hahnenberg
Comment 9
2013-10-07 17:04:37 PDT
Created
attachment 213629
[details]
Patch
Mark Hahnenberg
Comment 10
2013-10-07 17:58:36 PDT
Created
attachment 213633
[details]
Patch
Mark Hahnenberg
Comment 11
2013-10-07 18:03:18 PDT
Comment on
attachment 213633
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=213633&action=review
> Source/JavaScriptCore/API/tests/testapi.mm:363 > + checkResult(@"is_ham is nil", ![myPrivateProperties valueForKey:@"is_ham"]); > + checkResult(@"message is nil", ![myPrivateProperties valueForKey:@"message"]);
Need to update the test to check that the other entries are also nil.
Mark Hahnenberg
Comment 12
2013-10-08 10:24:11 PDT
Committed
r157119
: <
http://trac.webkit.org/changeset/157119
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug