In the fix for Issue 608576 , several persistent caches of hidden values were added to avoid the need to call V8HiddenValue::getHiddenValue. Calling this lost much of the performance gain of the optimization, as described in the fix for that bug.
The cost can be demonstrated by replacing the body of WebGLRenderingContextBase::preserveObjectWrapper with the following code:
v8::Isolate* isolate = scriptState->isolate();
v8::Local<v8::Object> sourceWrapper = sourceObject->newLocalWrapper(isolate);
v8::Local<v8::Value> cache = V8HiddenValue::getHiddenValue(scriptState, sourceWrapper, hiddenValueName);
if (cache.IsEmpty()) {
cache = v8::Array::New(isolate);
V8HiddenValue::setHiddenValue(scriptState, sourceWrapper, hiddenValueName, cache);
}
if (targetObject) {
v8::Maybe<bool> result = cache->ToObject(scriptState->context()).ToLocalChecked()->Set(
scriptState->context(), index, targetObject->newLocalWrapper(isolate));
ASSERT_UNUSED(result, result.FromMaybe(true));
} else {
v8::Maybe<bool> result = cache->ToObject(scriptState->context()).ToLocalChecked()->Set(
scriptState->context(), index, v8::Null(isolate));
ASSERT_UNUSED(result, result.FromMaybe(true));
}
and re-running the benchmark:
./tools/perf/run_benchmark --browser=release smoothness.tough_webgl_cases
To run just the desired benchmark, comment out everything but the Animometer test case from ToughWebglCasesPageSet in src/tools/perf/page_sets/tough_webgl_cases.py .
Speeding this up would improve several areas of the DOM bindings.
Comment 1 by bashi@chromium.org
, May 15 2016