Bug 94571 - [V8] Move String related code in V8Binding to a separate file
Summary: [V8] Move String related code in V8Binding to a separate file
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kentaro Hara
URL:
Keywords:
Depends on: 94605
Blocks: 93095
  Show dependency treegraph
 
Reported: 2012-08-20 21:50 PDT by Kentaro Hara
Modified: 2012-08-21 21:42 PDT (History)
6 users (show)

See Also:


Attachments
Patch (21.66 KB, patch)
2012-08-20 22:03 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff
patch for landing (21.64 KB, patch)
2012-08-21 03:21 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff
patch for landing (21.50 KB, patch)
2012-08-21 20:47 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kentaro Hara 2012-08-20 21:50:44 PDT
We can move V8Parameter, V8ParameterBase and String related code in V8Binding to a separate file.
Comment 1 Kentaro Hara 2012-08-20 22:03:35 PDT
Created attachment 159618 [details]
Patch
Comment 2 Kentaro Hara 2012-08-20 22:07:21 PDT
I'll do the following things in follow-up patches:

- Remove V8ParameterBase. It's redundant. Only V8Parameter will work.
- Rename V8Parameter to V8GenericString, because it's an adapter class for String and AtomicString.
Comment 3 Adam Barth 2012-08-20 23:13:32 PDT
Comment on attachment 159618 [details]
Patch

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

> Source/WebCore/bindings/v8/V8StringResource.cpp:35
> +

I'd remove this blank line.

> Source/WebCore/bindings/v8/V8StringResource.cpp:52
> +        String result = String::createUninitialized(length, buffer);

Does this really use int as the type for length?

> Source/WebCore/bindings/v8/V8StringResource.cpp:75
> +        String tmp = String::createUninitialized(length, buffer);

tmp -> string ?

> Source/WebCore/bindings/v8/V8StringResource.cpp:88
> +    int length = v8String->Length();

Oh, V8 uses int for the length of a string?

> Source/WebCore/bindings/v8/V8StringResource.cpp:91
> +        return StringImpl::empty();

Is this ok for background threads?  Typically we can't use these sorts of functions if we're not on the main thread.
Comment 4 Kentaro Hara 2012-08-21 03:21:05 PDT
Created attachment 159640 [details]
patch for landing
Comment 5 Kentaro Hara 2012-08-21 03:23:15 PDT
Committed r126150: <http://trac.webkit.org/changeset/126150>
Comment 6 Kentaro Hara 2012-08-21 03:24:01 PDT
(In reply to comment #3)
> (From update of attachment 159618 [details])
> > Source/WebCore/bindings/v8/V8StringResource.cpp:35
> > +
> 
> I'd remove this blank line.
> 
> > Source/WebCore/bindings/v8/V8StringResource.cpp:75
> > +        String tmp = String::createUninitialized(length, buffer);
> 
> tmp -> string ?
> 
> > Source/WebCore/bindings/v8/V8StringResource.cpp:91
> > +        return StringImpl::empty();
> 
> Is this ok for background threads?  Typically we can't use these sorts of functions if we're not on the main thread.

Done. Replaced with String().
Comment 7 WebKit Review Bot 2012-08-21 08:20:01 PDT
Re-opened since this is blocked by 94605
Comment 8 Kentaro Hara 2012-08-21 20:47:23 PDT
Created attachment 159852 [details]
patch for landing
Comment 9 Kentaro Hara 2012-08-21 20:49:43 PDT
(In reply to comment #6)
> > > Source/WebCore/bindings/v8/V8StringResource.cpp:91
> > > +        return StringImpl::empty();
> > 
> > Is this ok for background threads?  Typically we can't use these sorts of functions if we're not on the main thread.
> 
> Replaced with String().

This was the cause of the crashes.

I replaced it with String(""). Given that this is not a fast path of v8String(), it would be OK to create String("") every time.
Comment 10 WebKit Review Bot 2012-08-21 21:42:01 PDT
Comment on attachment 159852 [details]
patch for landing

Clearing flags on attachment: 159852

Committed r126262: <http://trac.webkit.org/changeset/126262>
Comment 11 WebKit Review Bot 2012-08-21 21:42:07 PDT
All reviewed patches have been landed.  Closing bug.