Changeset 94783 in webkit
- Timestamp:
- Sep 8, 2011 12:55:20 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r94772 r94783 1 2011-09-08 Ulan Degenbaev <ulan@chromium.org> 2 3 [v8] Improve performance of typed array set() taking Array 4 https://bugs.webkit.org/show_bug.cgi?id=63644 5 6 Reviewed by Kenneth Russell. 7 8 Overwrite the native 'set' method of the type arrays with JS 9 implementation after initialization of the global context. 10 11 Add tests for invalid and boundary offsets. No performance tests. 12 13 * LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt: 14 * LayoutTests/fast/canvas/webgl/array-unit-tests.html: 15 * Source/WebCore/WebCore.gyp/WebCore.gyp: 16 * Source/WebCore/WebCore.gypi: 17 * Source/WebCore/bindings/v8/V8BindingScripts.cpp: Added. 18 * Source/WebCore/bindings/v8/V8BindingScripts.h: Added. 19 * Source/WebCore/bindings/v8/V8DOMWindowShell.cpp: 20 * Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp: 21 * Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js: Added. 22 1 23 2011-09-08 Varun Jain <varunjain@google.com> 2 24 -
trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt
r91803 r94783 44 44 PASS array.subarray(-2147483648).length is (32 / typeSize) 45 45 PASS Setting Float32Array from array with out-of-range offset was caught 46 PASS Setting Float32Array from Float32Array with out-of-range offset was caught 47 PASS Setting Float32Array from array with negative offset was caught 48 PASS Setting Float32Array from Float32Array with negative offset was caught 49 PASS Setting Float32Array from array with -0 offset 50 PASS Setting Float32Array from Float32Array with -0 offset 51 PASS Setting Float32Array from array with boundary offset 52 PASS Setting Float32Array from Float32Array with boundary offset 53 PASS Setting Float32Array from array with non-integer offset 54 PASS Setting Float32Array from Float32Array with non-integer offset 46 55 PASS Setting Float32Array from fake array with invalid length was caught 47 PASS Setting Float32Array from Float32Array with out-of-range offset was caught48 56 PASS array.get is undefined. 49 57 PASS array.set(0, 1) threw exception. … … 90 98 PASS array.subarray(-2147483648).length is (32 / typeSize) 91 99 PASS Setting Float64Array from array with out-of-range offset was caught 100 PASS Setting Float64Array from Float64Array with out-of-range offset was caught 101 PASS Setting Float64Array from array with negative offset was caught 102 PASS Setting Float64Array from Float64Array with negative offset was caught 103 PASS Setting Float64Array from array with -0 offset 104 PASS Setting Float64Array from Float64Array with -0 offset 105 PASS Setting Float64Array from array with boundary offset 106 PASS Setting Float64Array from Float64Array with boundary offset 107 PASS Setting Float64Array from array with non-integer offset 108 PASS Setting Float64Array from Float64Array with non-integer offset 92 109 PASS Setting Float64Array from fake array with invalid length was caught 93 PASS Setting Float64Array from Float64Array with out-of-range offset was caught94 110 PASS array.get is undefined. 95 111 PASS array.set(0, 1) threw exception. … … 132 148 PASS array.subarray(-2147483648).length is (32 / typeSize) 133 149 PASS Setting Int8Array from array with out-of-range offset was caught 150 PASS Setting Int8Array from Int8Array with out-of-range offset was caught 151 PASS Setting Int8Array from array with negative offset was caught 152 PASS Setting Int8Array from Int8Array with negative offset was caught 153 PASS Setting Int8Array from array with -0 offset 154 PASS Setting Int8Array from Int8Array with -0 offset 155 PASS Setting Int8Array from array with boundary offset 156 PASS Setting Int8Array from Int8Array with boundary offset 157 PASS Setting Int8Array from array with non-integer offset 158 PASS Setting Int8Array from Int8Array with non-integer offset 134 159 PASS Setting Int8Array from fake array with invalid length was caught 135 PASS Setting Int8Array from Int8Array with out-of-range offset was caught136 160 PASS array.get is undefined. 137 161 PASS array.set(0, 1) threw exception. … … 179 203 PASS array.subarray(-2147483648).length is (32 / typeSize) 180 204 PASS Setting Int16Array from array with out-of-range offset was caught 205 PASS Setting Int16Array from Int16Array with out-of-range offset was caught 206 PASS Setting Int16Array from array with negative offset was caught 207 PASS Setting Int16Array from Int16Array with negative offset was caught 208 PASS Setting Int16Array from array with -0 offset 209 PASS Setting Int16Array from Int16Array with -0 offset 210 PASS Setting Int16Array from array with boundary offset 211 PASS Setting Int16Array from Int16Array with boundary offset 212 PASS Setting Int16Array from array with non-integer offset 213 PASS Setting Int16Array from Int16Array with non-integer offset 181 214 PASS Setting Int16Array from fake array with invalid length was caught 182 PASS Setting Int16Array from Int16Array with out-of-range offset was caught183 215 PASS array.get is undefined. 184 216 PASS array.set(0, 1) threw exception. … … 226 258 PASS array.subarray(-2147483648).length is (32 / typeSize) 227 259 PASS Setting Int32Array from array with out-of-range offset was caught 260 PASS Setting Int32Array from Int32Array with out-of-range offset was caught 261 PASS Setting Int32Array from array with negative offset was caught 262 PASS Setting Int32Array from Int32Array with negative offset was caught 263 PASS Setting Int32Array from array with -0 offset 264 PASS Setting Int32Array from Int32Array with -0 offset 265 PASS Setting Int32Array from array with boundary offset 266 PASS Setting Int32Array from Int32Array with boundary offset 267 PASS Setting Int32Array from array with non-integer offset 268 PASS Setting Int32Array from Int32Array with non-integer offset 228 269 PASS Setting Int32Array from fake array with invalid length was caught 229 PASS Setting Int32Array from Int32Array with out-of-range offset was caught230 270 PASS array.get is undefined. 231 271 PASS array.set(0, 1) threw exception. … … 268 308 PASS array.subarray(-2147483648).length is (32 / typeSize) 269 309 PASS Setting Uint8Array from array with out-of-range offset was caught 310 PASS Setting Uint8Array from Uint8Array with out-of-range offset was caught 311 PASS Setting Uint8Array from array with negative offset was caught 312 PASS Setting Uint8Array from Uint8Array with negative offset was caught 313 PASS Setting Uint8Array from array with -0 offset 314 PASS Setting Uint8Array from Uint8Array with -0 offset 315 PASS Setting Uint8Array from array with boundary offset 316 PASS Setting Uint8Array from Uint8Array with boundary offset 317 PASS Setting Uint8Array from array with non-integer offset 318 PASS Setting Uint8Array from Uint8Array with non-integer offset 270 319 PASS Setting Uint8Array from fake array with invalid length was caught 271 PASS Setting Uint8Array from Uint8Array with out-of-range offset was caught272 320 PASS array.get is undefined. 273 321 PASS array.set(0, 1) threw exception. … … 315 363 PASS array.subarray(-2147483648).length is (32 / typeSize) 316 364 PASS Setting Uint16Array from array with out-of-range offset was caught 365 PASS Setting Uint16Array from Uint16Array with out-of-range offset was caught 366 PASS Setting Uint16Array from array with negative offset was caught 367 PASS Setting Uint16Array from Uint16Array with negative offset was caught 368 PASS Setting Uint16Array from array with -0 offset 369 PASS Setting Uint16Array from Uint16Array with -0 offset 370 PASS Setting Uint16Array from array with boundary offset 371 PASS Setting Uint16Array from Uint16Array with boundary offset 372 PASS Setting Uint16Array from array with non-integer offset 373 PASS Setting Uint16Array from Uint16Array with non-integer offset 317 374 PASS Setting Uint16Array from fake array with invalid length was caught 318 PASS Setting Uint16Array from Uint16Array with out-of-range offset was caught319 375 PASS array.get is undefined. 320 376 PASS array.set(0, 1) threw exception. … … 362 418 PASS array.subarray(-2147483648).length is (32 / typeSize) 363 419 PASS Setting Uint32Array from array with out-of-range offset was caught 420 PASS Setting Uint32Array from Uint32Array with out-of-range offset was caught 421 PASS Setting Uint32Array from array with negative offset was caught 422 PASS Setting Uint32Array from Uint32Array with negative offset was caught 423 PASS Setting Uint32Array from array with -0 offset 424 PASS Setting Uint32Array from Uint32Array with -0 offset 425 PASS Setting Uint32Array from array with boundary offset 426 PASS Setting Uint32Array from Uint32Array with boundary offset 427 PASS Setting Uint32Array from array with non-integer offset 428 PASS Setting Uint32Array from Uint32Array with non-integer offset 364 429 PASS Setting Uint32Array from fake array with invalid length was caught 365 PASS Setting Uint32Array from Uint32Array with out-of-range offset was caught366 430 PASS array.get is undefined. 367 431 PASS array.set(0, 1) threw exception. -
trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html
r91803 r94783 617 617 } 618 618 619 function setWithInvalidOffset(type, name, length, 620 sourceType, sourceName, sourceLength, 621 offset, offsetDescription) { 622 var webglArray = new type(length); 623 var sourceArray = new sourceType(sourceLength); 624 for (var i = 0; i < sourceLength; i++) 625 sourceArray[i] = 42 + i; 626 try { 627 webglArray.set(sourceArray, offset); 628 testFailed("Setting " + name + " from " + sourceName + " with " + 629 offsetDescription + " offset was not caught"); 630 } catch (e) { 631 testPassed("Setting " + name + " from " + sourceName + " with " + 632 offsetDescription + " offset was caught"); 633 } 634 } 635 636 function setWithValidOffset(type, name, length, 637 sourceType, sourceName, sourceLength, 638 offset, offsetDescription) { 639 running("Setting " + name + " from " + sourceName + " with " + 640 offsetDescription + " offset"); 641 var webglArray = new type(length); 642 var sourceArray = new sourceType(sourceLength); 643 for (var i = 0; i < sourceLength; i++) 644 sourceArray[i] = 42 + i; 645 try { 646 webglArray.set(sourceArray, offset); 647 offset = Math.floor(offset); 648 for (var i = 0; i < sourceLength; i++) { 649 assertEq("Element " + i + offset, sourceArray[i], webglArray[i + offset]); 650 } 651 pass(); 652 } catch (e) { 653 fail(e); 654 } 655 } 656 657 619 658 function testSettingFromArrayWithOutOfRangeOffset(type, name) { 620 var webglArray = new type(32); 621 var array = []; 622 for (var i = 0; i < 16; i++) { 623 array.push(i); 624 } 625 try { 626 webglArray.set(array, 0x7FFFFFF8); 627 testFailed("Setting " + name + " from array with out-of-range offset was not caught"); 628 } catch (e) { 629 testPassed("Setting " + name + " from array with out-of-range offset was caught"); 630 } 659 setWithInvalidOffset(type, name, 32, Array, "array", 16, 660 0x7FFFFFF8, "out-of-range"); 661 } 662 663 function testSettingFromTypedArrayWithOutOfRangeOffset(type, name) { 664 setWithInvalidOffset(type, name, 32, type, name, 16, 665 0x7FFFFFF8, "out-of-range"); 666 } 667 668 function testSettingFromArrayWithNegativeOffset(type, name) { 669 setWithInvalidOffset(type, name, 32, Array, "array", 16, 670 -1, "negative"); 671 } 672 673 function testSettingFromTypedArrayWithNegativeOffset(type, name) { 674 setWithInvalidOffset(type, name, 32, type, name, 16, 675 -1, "negative"); 676 } 677 678 function testSettingFromArrayWithMinusZeroOffset(type, name) { 679 setWithValidOffset(type, name, 32, Array, "array", 16, 680 -0, "-0"); 681 } 682 683 function testSettingFromTypedArrayWithMinusZeroOffset(type, name) { 684 setWithValidOffset(type, name, 32, type, name, 16, 685 -0, "-0"); 686 } 687 688 function testSettingFromArrayWithBoundaryOffset(type, name) { 689 setWithValidOffset(type, name, 32, Array, "array", 16, 690 16, "boundary"); 691 } 692 693 function testSettingFromTypedArrayWithBoundaryOffset(type, name) { 694 setWithValidOffset(type, name, 32, type, name, 16, 695 16, "boundary"); 696 } 697 698 function testSettingFromArrayWithNonIntegerOffset(type, name) { 699 setWithValidOffset(type, name, 32, Array, "array", 16, 700 16.999, "non-integer"); 701 } 702 703 function testSettingFromTypedArrayWithNonIntegerOffset(type, name) { 704 setWithValidOffset(type, name, 32, type, name, 16, 705 16.999, "non-integer"); 631 706 } 632 707 … … 643 718 } 644 719 645 function testSettingFromTypedArrayWithOutOfRangeOffset(type, name) {646 var webglArray = new type(32);647 var srcArray = new type(16);648 for (var i = 0; i < 16; i++) {649 srcArray[i] = i;650 }651 try {652 webglArray.set(srcArray, 0x7FFFFFF8);653 testFailed("Setting " + name + " from " + name + " with out-of-range offset was not caught");654 } catch (e) {655 testPassed("Setting " + name + " from " + name + " with out-of-range offset was caught");656 }657 }658 720 659 721 function negativeTestGetAndSetMethods(type, name) { … … 873 935 testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes); 874 936 testSettingFromArrayWithOutOfRangeOffset(type, name); 937 testSettingFromTypedArrayWithOutOfRangeOffset(type, name); 938 testSettingFromArrayWithNegativeOffset(type, name); 939 testSettingFromTypedArrayWithNegativeOffset(type, name); 940 testSettingFromArrayWithMinusZeroOffset(type, name); 941 testSettingFromTypedArrayWithMinusZeroOffset(type, name); 942 testSettingFromArrayWithBoundaryOffset(type, name); 943 testSettingFromTypedArrayWithBoundaryOffset(type, name); 944 testSettingFromArrayWithNonIntegerOffset(type, name); 945 testSettingFromTypedArrayWithNonIntegerOffset(type, name); 875 946 testSettingFromFakeArrayWithOutOfRangeLength(type, name); 876 testSettingFromTypedArrayWithOutOfRangeOffset(type, name);877 947 negativeTestGetAndSetMethods(type, name); 878 948 testNaNConversion(type, name); -
trunk/Source/WebCore/WebCore.gyp/WebCore.gyp
r94694 r94783 481 481 # Actions to build derived sources. 482 482 { 483 'action_name': 'generateV8ArrayBufferViewCustomScript', 484 'inputs': [ 485 '../bindings/v8/custom/V8ArrayBufferViewCustomScript.js', 486 ], 487 'outputs': [ 488 '<(SHARED_INTERMEDIATE_DIR)/webkit/V8ArrayBufferViewCustomScript.h', 489 ], 490 'action': [ 491 'perl', 492 '../inspector/xxd.pl', 493 'V8ArrayBufferViewCustomScript_js', 494 '<@(_inputs)', 495 '<@(_outputs)' 496 ], 497 'message': 'Generating V8ArrayBufferViewCustomScript.h from V8ArrayBufferViewCustomScript.js', 498 }, 499 { 483 500 'action_name': 'generateXMLViewerCSS', 484 501 'inputs': [ -
trunk/Source/WebCore/WebCore.gypi
r94703 r94783 2064 2064 'bindings/v8/V8Binding.cpp', 2065 2065 'bindings/v8/V8Binding.h', 2066 'bindings/v8/V8BindingScripts.cpp', 2067 'bindings/v8/V8BindingScripts.h', 2066 2068 'bindings/v8/V8Collection.cpp', 2067 2069 'bindings/v8/V8Collection.h', -
trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
r94275 r94783 1 1 /* 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.3 * 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 5 * modification, are permitted provided that the following conditions are 6 6 * met: 7 * 7 * 8 8 * * Redistributions of source code must retain the above copyright 9 9 * notice, this list of conditions and the following disclaimer. … … 15 15 * contributors may be used to endorse or promote products derived from 16 16 * this software without specific prior written permission. 17 * 17 * 18 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT … … 47 47 #include "StorageNamespace.h" 48 48 #include "V8Binding.h" 49 #include "V8BindingScripts.h" 49 50 #include "V8BindingState.h" 50 51 #include "V8Collection.h" … … 340 341 setSecurityToken(); 341 342 343 V8BindingScripts::runScripts(v8Context); 344 342 345 m_frame->loader()->client()->didCreateScriptContextForFrame(); 343 346 -
trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
r92694 r94783 42 42 #include "SharedWorkerContext.h" 43 43 #include "V8Binding.h" 44 #include "V8BindingScripts.h" 44 45 #include "V8DOMMap.h" 45 46 #include "V8DedicatedWorkerContext.h" … … 175 176 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype()); 176 177 globalObject->SetPrototype(jsWorkerContext); 178 179 V8BindingScripts::runScripts(context); 180 177 181 return true; 178 182 }
Note: See TracChangeset
for help on using the changeset viewer.