Bug 89042
Summary: | [V8] V8ArrayBufferViewCustom.cpp uses unnecessary v8::Script::Compile | ||
---|---|---|---|
Product: | WebKit | Reporter: | Erik Arvidsson <arv> |
Component: | DOM | Assignee: | Kenneth Russell <kbr> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | kbr, ulan |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Erik Arvidsson
This code looks suspicious.
v8::Handle<v8::Value> installHiddenCopyMethod(v8::Handle<v8::Object> prototype) {
v8::TryCatch tryCatch;
tryCatch.SetVerbose(true);
String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js),
sizeof(V8ArrayBufferViewCustomScript_js));
v8::Handle<v8::Script> script = v8::Script::Compile(v8String(source));
v8::Handle<v8::Value> value = script->Run();
v8::Handle<v8::String> key = v8::String::New(hiddenCopyMethodName);
prototype->SetHiddenValue(key, value);
return value;
}
We should not invoke the compiler for this. We can just write the same code in C++.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Kenneth Russell
This code inserts a JavaScript-side shim developed by Ulan Degenbaev which provides a large speedup for setting a typed array from a JavaScript array. The same code in C++ is hugely slower due to the need to go across the V8 API for every incoming array element.
I'm closing this as WontFix. If I misunderstood why this bug was filed, please reopen it.
Erik Arvidsson
OK. Thanks for the clarification.