Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js

Issue 10543046: Merge 118955 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js
===================================================================
--- Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js (revision 119657)
+++ Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js (working copy)
@@ -23,42 +23,14 @@
*/
(function() {
-
-var optimizeSetMethod = function(type)
-{
- if (typeof type === 'function' &&
- typeof type.prototype !== 'undefined' &&
- typeof type.prototype.set === 'function') {
- type.prototype.set = (function() {
- var nativeSet = type.prototype.set;
- var f = function(source, offset)
- {
- if (source.constructor === Array) {
- var length = source.length;
- offset = offset || 0;
- if (offset < 0 || offset + length > this.length) {
- return nativeSet.call(this, source, offset);
- }
- for (var i = 0; i < length; i++)
- this[i + offset] = source[i];
- } else
- return nativeSet.call(this, source, offset);
- }
- f.name = "set";
- return f;
- })();
+ return function(source, length, offset) {
+ if (offset == 0) {
+ for (var i = 0; i < length; i++)
+ this[i] = source[i];
+ } else {
+ for (var i = 0; i < length; i++)
+ this[i + offset] = source[i];
+ }
}
-};
-
-optimizeSetMethod(Float32Array);
-optimizeSetMethod(Float64Array);
-optimizeSetMethod(Int8Array);
-optimizeSetMethod(Int16Array);
-optimizeSetMethod(Int32Array);
-optimizeSetMethod(Uint8Array);
-optimizeSetMethod(Uint8ClampedArray);
-optimizeSetMethod(Uint16Array);
-optimizeSetMethod(Uint32Array);
-
})();
« no previous file with comments | « Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698