Bug 103331

Summary: [V8] Replace toWebCoreString()/toWebCoreAtomicString() with V8Parameter
Product: WebKit Reporter: Kentaro Hara <haraken>
Component: WebCore JavaScriptAssignee: Kentaro Hara <haraken>
Status: RESOLVED INVALID    
Severity: Normal CC: abarth
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 103340, 103341, 103367, 103391, 103397, 103404    
Bug Blocks:    
Attachments:
Description Flags
micro benchmarks none

Description Kentaro Hara 2012-11-26 17:23:14 PST
V8ParameterBase is slow. V8ParameterBase is being used in hot call paths.

  // Code A
  AtomicString str = toWebCoreAtomicString(v8Object); // Assume that v8Object is v8::String or v8::Int32
  imp->setAttribute(HTMLNames::idAttr, str);

  // Code B
  STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, v8Object); // Assume that v8Object is v8::String or v8::Int32
  imp->setAttribute(HTMLNames::idAttr, str);

Code B is 10% slower than Code A. Ideally Code A should be as fast as Code B.

Then we can replace all toWebCoreAtomicString()s and toWebCoreString()s with V8ParameterBase; i.e. we can always use V8ParameterBase regardless of String or AtomicString.
Comment 1 Kentaro Hara 2012-11-26 17:53:38 PST
Created attachment 176130 [details]
micro benchmarks

Hmm, it looks like 10% slowness was placebo. The perf is a bit flaky.

As far as I test with the micro benchmarks attached to this bug and Bindings/id-setter.html a lot of times, there is no observable perf diff between V8Parameter and toWebCoreString()/toWebCoreAtomicString().

So the conclusion is that V8Parameter is as fast as toWebCoreString()/toWebCoreAtomicString(), and thus we can replace toWebCoreString()/toWebCoreAtomicString() with V8Parameter without regressing performance.
Comment 2 Brian Burg 2014-12-16 00:48:03 PST
Closing some V8-related work items.