Changeset 95157 in webkit
- Timestamp:
- Sep 14, 2011 8:28:43 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r95119 r95157 1 2011-09-14 Ulan Degenbaev <ulan@chromium.org> 2 3 [v8] Improve performance of typed array copy constructor taking Array 4 https://bugs.webkit.org/show_bug.cgi?id=68015 5 6 Reviewed by Kenneth Russell. 7 8 Invoke the 'set' method of the constructed array instead of 9 copying the elements of the source array one by one. 10 11 Copy constructor tests already exist. 12 13 * ../../Source/WebCore/WebCore.gypi: 14 * ../../Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp: Added. 15 * ../../Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h: 16 1 17 2011-09-14 Csaba Osztrogonác <ossy@webkit.org> 2 18 -
trunk/Source/WebCore/WebCore.gypi
r95029 r95157 2117 2117 'bindings/v8/WrapperTypeInfo.h', 2118 2118 'bindings/v8/custom/V8ArrayBufferCustom.cpp', 2119 'bindings/v8/custom/V8ArrayBufferViewCustom.cpp', 2119 2120 'bindings/v8/custom/V8ArrayBufferViewCustom.h', 2120 2121 'bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp', -
trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
r94357 r95157 1 1 /* 2 * Copyright (C) 2009 Google Inc. All rights reserved.2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 33 33 34 34 #include "ArrayBuffer.h" 35 #include "ExceptionCode.h" 35 36 36 37 #include "V8ArrayBuffer.h" … … 39 40 40 41 namespace WebCore { 42 43 44 // Copy the elements from the source array to the typed destination array by 45 // invoking the 'set' method of the destination array in JS. 46 void copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray); 41 47 42 48 // Template function used by the ArrayBufferView*Constructor callbacks. … … 148 154 return throwError("ArrayBufferView size is not a small enough positive integer.", V8Proxy::RangeError); 149 155 150 if (!srcArray.IsEmpty()) {151 // Need to copy the incoming array into the newly created ArrayBufferView.152 for (unsigned i = 0; i < len; i++) {153 v8::Local<v8::Value> val = srcArray->Get(i);154 array->set(i, val->NumberValue());155 }156 }157 156 158 157 // Transform the holder into a wrapper object for the array. 159 158 V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get()); 160 159 args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length()); 160 161 if (!srcArray.IsEmpty()) 162 copyElements(args.Holder(), srcArray); 163 161 164 return toV8(array.release(), args.Holder(), MarkIndependent); 162 165 }
Note: See TracChangeset
for help on using the changeset viewer.