Bug 93315

Summary: [V8] Pass Isolate to ArrayValue and Dictionary
Product: WebKit Reporter: Kentaro Hara <haraken>
Component: WebCore JavaScriptAssignee: Kentaro Hara <haraken>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, dglazkov, japhet, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 84074    
Attachments:
Description Flags
Patch
none
Patch
none
patch for landing
none
Patch none

Description Kentaro Hara 2012-08-06 18:15:06 PDT
We should pass Isolate to ArrayValue and Dictionary.

Rationale 1: We want to replace V8Proxy::throwError(ExceptionCode) with setDOMException(ExceptionCode, Isolate*). For the replacement, we need to pass Isolate to V8Utilities::extractTransferables(). To pass Isolate to V8Utilities::extractTransferables(), ( ...omitted... ), we need to pass Isolate* to ArrayValue and Dictionary.

Rationale 2: JSC already passes ExecState to ArrayValue and Dictionary.
Comment 1 Kentaro Hara 2012-08-06 18:17:55 PDT
Created attachment 156818 [details]
Patch
Comment 2 WebKit Review Bot 2012-08-06 18:33:44 PDT
Comment on attachment 156818 [details]
Patch

Attachment 156818 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13451204
Comment 3 Kentaro Hara 2012-08-06 18:53:02 PDT
Created attachment 156825 [details]
Patch
Comment 4 Adam Barth 2012-08-07 15:01:32 PDT
Comment on attachment 156825 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=156825&action=review

> Source/WebCore/bindings/v8/ArrayValue.h:60
> +    v8::Isolate* m_isolate;

Is it ok to store a long-lived pointer to an isolate?  How do we know this pointer remains valid?
Comment 5 Kentaro Hara 2012-08-07 18:32:00 PDT
Created attachment 157078 [details]
patch for landing
Comment 6 Kentaro Hara 2012-08-07 18:33:02 PDT
Created attachment 157079 [details]
Patch
Comment 7 Kentaro Hara 2012-08-07 18:38:34 PDT
(In reply to comment #4)
> > Source/WebCore/bindings/v8/ArrayValue.h:60
> > +    v8::Isolate* m_isolate;
> 
> Is it ok to store a long-lived pointer to an isolate?  How do we know this pointer remains valid?

I think it's ok. Dictionary and ArrayValue are designed based on the assumption that they are allocated on stack. In fact,

- Dictionary already has m_options of type Local<Value>. ArrayValue already has m_array of type Local<Array>.

- JSC already stores ExecState in Dictionary and ArrayValue.

Just in case, I added ASSERT(m_isolate == v8::Isolate::Current()) to the patch.
Comment 8 Adam Barth 2012-08-07 22:32:22 PDT
Comment on attachment 157079 [details]
Patch

Makes sense.  Thanks.
Comment 9 WebKit Review Bot 2012-08-08 00:06:39 PDT
Comment on attachment 157079 [details]
Patch

Rejecting attachment 157079 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
-merging Tools/ChangeLog
Failed to merge in the changes.
Patch failed at 0001 Optimize ChildNode{Insertion,Removal}Notifier::notify() by lazily taking a snapshot of child nodes

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

rebase refs/remotes/origin/master: command returned error: 1

Died at Tools/Scripts/update-webkit line 164.

Full output: http://queues.webkit.org/results/13459119
Comment 10 WebKit Review Bot 2012-08-08 02:45:39 PDT
Comment on attachment 157079 [details]
Patch

Clearing flags on attachment: 157079

Committed r125012: <http://trac.webkit.org/changeset/125012>
Comment 11 WebKit Review Bot 2012-08-08 02:45:43 PDT
All reviewed patches have been landed.  Closing bug.