Diff
Modified: trunk/ChangeLog (94782 => 94783)
--- trunk/ChangeLog 2011-09-08 19:44:57 UTC (rev 94782)
+++ trunk/ChangeLog 2011-09-08 19:55:20 UTC (rev 94783)
@@ -1,3 +1,25 @@
+2011-09-08 Ulan Degenbaev <u...@chromium.org>
+
+ [v8] Improve performance of typed array set() taking Array
+ https://bugs.webkit.org/show_bug.cgi?id=63644
+
+ Reviewed by Kenneth Russell.
+
+ Overwrite the native 'set' method of the type arrays with JS
+ implementation after initialization of the global context.
+
+ Add tests for invalid and boundary offsets. No performance tests.
+
+ * LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt:
+ * LayoutTests/fast/canvas/webgl/array-unit-tests.html:
+ * Source/WebCore/WebCore.gyp/WebCore.gyp:
+ * Source/WebCore/WebCore.gypi:
+ * Source/WebCore/bindings/v8/V8BindingScripts.cpp: Added.
+ * Source/WebCore/bindings/v8/V8BindingScripts.h: Added.
+ * Source/WebCore/bindings/v8/V8DOMWindowShell.cpp:
+ * Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp:
+ * Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js: Added.
+
2011-09-08 Varun Jain <varunj...@google.com>
Split Tap gesture detection into TapDown and Tap.
Modified: trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt (94782 => 94783)
--- trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt 2011-09-08 19:44:57 UTC (rev 94782)
+++ trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt 2011-09-08 19:55:20 UTC (rev 94783)
@@ -43,8 +43,16 @@
PASS array.subarray(-2).length is 2
PASS array.subarray(-2147483648).length is (32 / typeSize)
PASS Setting Float32Array from array with out-of-range offset was caught
+PASS Setting Float32Array from Float32Array with out-of-range offset was caught
+PASS Setting Float32Array from array with negative offset was caught
+PASS Setting Float32Array from Float32Array with negative offset was caught
+PASS Setting Float32Array from array with -0 offset
+PASS Setting Float32Array from Float32Array with -0 offset
+PASS Setting Float32Array from array with boundary offset
+PASS Setting Float32Array from Float32Array with boundary offset
+PASS Setting Float32Array from array with non-integer offset
+PASS Setting Float32Array from Float32Array with non-integer offset
PASS Setting Float32Array from fake array with invalid length was caught
-PASS Setting Float32Array from Float32Array with out-of-range offset was caught
PASS array.get is undefined.
PASS array.set(0, 1) threw exception.
PASS test storing NaN in Float32Array
@@ -89,8 +97,16 @@
PASS array.subarray(-2).length is 2
PASS array.subarray(-2147483648).length is (32 / typeSize)
PASS Setting Float64Array from array with out-of-range offset was caught
+PASS Setting Float64Array from Float64Array with out-of-range offset was caught
+PASS Setting Float64Array from array with negative offset was caught
+PASS Setting Float64Array from Float64Array with negative offset was caught
+PASS Setting Float64Array from array with -0 offset
+PASS Setting Float64Array from Float64Array with -0 offset
+PASS Setting Float64Array from array with boundary offset
+PASS Setting Float64Array from Float64Array with boundary offset
+PASS Setting Float64Array from array with non-integer offset
+PASS Setting Float64Array from Float64Array with non-integer offset
PASS Setting Float64Array from fake array with invalid length was caught
-PASS Setting Float64Array from Float64Array with out-of-range offset was caught
PASS array.get is undefined.
PASS array.set(0, 1) threw exception.
PASS test storing NaN in Float64Array
@@ -131,8 +147,16 @@
PASS array.subarray(-2).length is 2
PASS array.subarray(-2147483648).length is (32 / typeSize)
PASS Setting Int8Array from array with out-of-range offset was caught
+PASS Setting Int8Array from Int8Array with out-of-range offset was caught
+PASS Setting Int8Array from array with negative offset was caught
+PASS Setting Int8Array from Int8Array with negative offset was caught
+PASS Setting Int8Array from array with -0 offset
+PASS Setting Int8Array from Int8Array with -0 offset
+PASS Setting Int8Array from array with boundary offset
+PASS Setting Int8Array from Int8Array with boundary offset
+PASS Setting Int8Array from array with non-integer offset
+PASS Setting Int8Array from Int8Array with non-integer offset
PASS Setting Int8Array from fake array with invalid length was caught
-PASS Setting Int8Array from Int8Array with out-of-range offset was caught
PASS array.get is undefined.
PASS array.set(0, 1) threw exception.
PASS test storing NaN in Int8Array
@@ -178,8 +202,16 @@
PASS array.subarray(-2).length is 2
PASS array.subarray(-2147483648).length is (32 / typeSize)
PASS Setting Int16Array from array with out-of-range offset was caught
+PASS Setting Int16Array from Int16Array with out-of-range offset was caught
+PASS Setting Int16Array from array with negative offset was caught
+PASS Setting Int16Array from Int16Array with negative offset was caught
+PASS Setting Int16Array from array with -0 offset
+PASS Setting Int16Array from Int16Array with -0 offset
+PASS Setting Int16Array from array with boundary offset
+PASS Setting Int16Array from Int16Array with boundary offset
+PASS Setting Int16Array from array with non-integer offset
+PASS Setting Int16Array from Int16Array with non-integer offset
PASS Setting Int16Array from fake array with invalid length was caught
-PASS Setting Int16Array from Int16Array with out-of-range offset was caught
PASS array.get is undefined.
PASS array.set(0, 1) threw exception.
PASS test storing NaN in Int16Array
@@ -225,8 +257,16 @@
PASS array.subarray(-2).length is 2
PASS array.subarray(-2147483648).length is (32 / typeSize)
PASS Setting Int32Array from array with out-of-range offset was caught
+PASS Setting Int32Array from Int32Array with out-of-range offset was caught
+PASS Setting Int32Array from array with negative offset was caught
+PASS Setting Int32Array from Int32Array with negative offset was caught
+PASS Setting Int32Array from array with -0 offset
+PASS Setting Int32Array from Int32Array with -0 offset
+PASS Setting Int32Array from array with boundary offset
+PASS Setting Int32Array from Int32Array with boundary offset
+PASS Setting Int32Array from array with non-integer offset
+PASS Setting Int32Array from Int32Array with non-integer offset
PASS Setting Int32Array from fake array with invalid length was caught
-PASS Setting Int32Array from Int32Array with out-of-range offset was caught
PASS array.get is undefined.
PASS array.set(0, 1) threw exception.
PASS test storing NaN in Int32Array
@@ -267,8 +307,16 @@
PASS array.subarray(-2).length is 2
PASS array.subarray(-2147483648).length is (32 / typeSize)
PASS Setting Uint8Array from array with out-of-range offset was caught
+PASS Setting Uint8Array from Uint8Array with out-of-range offset was caught
+PASS Setting Uint8Array from array with negative offset was caught
+PASS Setting Uint8Array from Uint8Array with negative offset was caught
+PASS Setting Uint8Array from array with -0 offset
+PASS Setting Uint8Array from Uint8Array with -0 offset
+PASS Setting Uint8Array from array with boundary offset
+PASS Setting Uint8Array from Uint8Array with boundary offset
+PASS Setting Uint8Array from array with non-integer offset
+PASS Setting Uint8Array from Uint8Array with non-integer offset
PASS Setting Uint8Array from fake array with invalid length was caught
-PASS Setting Uint8Array from Uint8Array with out-of-range offset was caught
PASS array.get is undefined.
PASS array.set(0, 1) threw exception.
PASS test storing NaN in Uint8Array
@@ -314,8 +362,16 @@
PASS array.subarray(-2).length is 2
PASS array.subarray(-2147483648).length is (32 / typeSize)
PASS Setting Uint16Array from array with out-of-range offset was caught
+PASS Setting Uint16Array from Uint16Array with out-of-range offset was caught
+PASS Setting Uint16Array from array with negative offset was caught
+PASS Setting Uint16Array from Uint16Array with negative offset was caught
+PASS Setting Uint16Array from array with -0 offset
+PASS Setting Uint16Array from Uint16Array with -0 offset
+PASS Setting Uint16Array from array with boundary offset
+PASS Setting Uint16Array from Uint16Array with boundary offset
+PASS Setting Uint16Array from array with non-integer offset
+PASS Setting Uint16Array from Uint16Array with non-integer offset
PASS Setting Uint16Array from fake array with invalid length was caught
-PASS Setting Uint16Array from Uint16Array with out-of-range offset was caught
PASS array.get is undefined.
PASS array.set(0, 1) threw exception.
PASS test storing NaN in Uint16Array
@@ -361,8 +417,16 @@
PASS array.subarray(-2).length is 2
PASS array.subarray(-2147483648).length is (32 / typeSize)
PASS Setting Uint32Array from array with out-of-range offset was caught
+PASS Setting Uint32Array from Uint32Array with out-of-range offset was caught
+PASS Setting Uint32Array from array with negative offset was caught
+PASS Setting Uint32Array from Uint32Array with negative offset was caught
+PASS Setting Uint32Array from array with -0 offset
+PASS Setting Uint32Array from Uint32Array with -0 offset
+PASS Setting Uint32Array from array with boundary offset
+PASS Setting Uint32Array from Uint32Array with boundary offset
+PASS Setting Uint32Array from array with non-integer offset
+PASS Setting Uint32Array from Uint32Array with non-integer offset
PASS Setting Uint32Array from fake array with invalid length was caught
-PASS Setting Uint32Array from Uint32Array with out-of-range offset was caught
PASS array.get is undefined.
PASS array.set(0, 1) threw exception.
PASS test storing NaN in Uint32Array
Modified: trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html (94782 => 94783)
--- trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html 2011-09-08 19:44:57 UTC (rev 94782)
+++ trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html 2011-09-08 19:55:20 UTC (rev 94783)
@@ -616,20 +616,95 @@
}
}
-function testSettingFromArrayWithOutOfRangeOffset(type, name) {
- var webglArray = new type(32);
- var array = [];
- for (var i = 0; i < 16; i++) {
- array.push(i);
+function setWithInvalidOffset(type, name, length,
+ sourceType, sourceName, sourceLength,
+ offset, offsetDescription) {
+ var webglArray = new type(length);
+ var sourceArray = new sourceType(sourceLength);
+ for (var i = 0; i < sourceLength; i++)
+ sourceArray[i] = 42 + i;
+ try {
+ webglArray.set(sourceArray, offset);
+ testFailed("Setting " + name + " from " + sourceName + " with " +
+ offsetDescription + " offset was not caught");
+ } catch (e) {
+ testPassed("Setting " + name + " from " + sourceName + " with " +
+ offsetDescription + " offset was caught");
}
+}
+
+function setWithValidOffset(type, name, length,
+ sourceType, sourceName, sourceLength,
+ offset, offsetDescription) {
+ running("Setting " + name + " from " + sourceName + " with " +
+ offsetDescription + " offset");
+ var webglArray = new type(length);
+ var sourceArray = new sourceType(sourceLength);
+ for (var i = 0; i < sourceLength; i++)
+ sourceArray[i] = 42 + i;
try {
- webglArray.set(array, 0x7FFFFFF8);
- testFailed("Setting " + name + " from array with out-of-range offset was not caught");
+ webglArray.set(sourceArray, offset);
+ offset = Math.floor(offset);
+ for (var i = 0; i < sourceLength; i++) {
+ assertEq("Element " + i + offset, sourceArray[i], webglArray[i + offset]);
+ }
+ pass();
} catch (e) {
- testPassed("Setting " + name + " from array with out-of-range offset was caught");
+ fail(e);
}
}
+
+function testSettingFromArrayWithOutOfRangeOffset(type, name) {
+ setWithInvalidOffset(type, name, 32, Array, "array", 16,
+ 0x7FFFFFF8, "out-of-range");
+}
+
+function testSettingFromTypedArrayWithOutOfRangeOffset(type, name) {
+ setWithInvalidOffset(type, name, 32, type, name, 16,
+ 0x7FFFFFF8, "out-of-range");
+}
+
+function testSettingFromArrayWithNegativeOffset(type, name) {
+ setWithInvalidOffset(type, name, 32, Array, "array", 16,
+ -1, "negative");
+}
+
+function testSettingFromTypedArrayWithNegativeOffset(type, name) {
+ setWithInvalidOffset(type, name, 32, type, name, 16,
+ -1, "negative");
+}
+
+function testSettingFromArrayWithMinusZeroOffset(type, name) {
+ setWithValidOffset(type, name, 32, Array, "array", 16,
+ -0, "-0");
+}
+
+function testSettingFromTypedArrayWithMinusZeroOffset(type, name) {
+ setWithValidOffset(type, name, 32, type, name, 16,
+ -0, "-0");
+}
+
+function testSettingFromArrayWithBoundaryOffset(type, name) {
+ setWithValidOffset(type, name, 32, Array, "array", 16,
+ 16, "boundary");
+}
+
+function testSettingFromTypedArrayWithBoundaryOffset(type, name) {
+ setWithValidOffset(type, name, 32, type, name, 16,
+ 16, "boundary");
+}
+
+function testSettingFromArrayWithNonIntegerOffset(type, name) {
+ setWithValidOffset(type, name, 32, Array, "array", 16,
+ 16.999, "non-integer");
+}
+
+function testSettingFromTypedArrayWithNonIntegerOffset(type, name) {
+ setWithValidOffset(type, name, 32, type, name, 16,
+ 16.999, "non-integer");
+}
+
function testSettingFromFakeArrayWithOutOfRangeLength(type, name) {
var webglArray = new type(32);
var array = {};
@@ -642,19 +717,6 @@
}
}
-function testSettingFromTypedArrayWithOutOfRangeOffset(type, name) {
- var webglArray = new type(32);
- var srcArray = new type(16);
- for (var i = 0; i < 16; i++) {
- srcArray[i] = i;
- }
- try {
- webglArray.set(srcArray, 0x7FFFFFF8);
- testFailed("Setting " + name + " from " + name + " with out-of-range offset was not caught");
- } catch (e) {
- testPassed("Setting " + name + " from " + name + " with out-of-range offset was caught");
- }
-}
function negativeTestGetAndSetMethods(type, name) {
array = new type([2, 3]);
@@ -872,8 +934,16 @@
testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes);
testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes);
testSettingFromArrayWithOutOfRangeOffset(type, name);
+ testSettingFromTypedArrayWithOutOfRangeOffset(type, name);
+ testSettingFromArrayWithNegativeOffset(type, name);
+ testSettingFromTypedArrayWithNegativeOffset(type, name);
+ testSettingFromArrayWithMinusZeroOffset(type, name);
+ testSettingFromTypedArrayWithMinusZeroOffset(type, name);
+ testSettingFromArrayWithBoundaryOffset(type, name);
+ testSettingFromTypedArrayWithBoundaryOffset(type, name);
+ testSettingFromArrayWithNonIntegerOffset(type, name);
+ testSettingFromTypedArrayWithNonIntegerOffset(type, name);
testSettingFromFakeArrayWithOutOfRangeLength(type, name);
- testSettingFromTypedArrayWithOutOfRangeOffset(type, name);
negativeTestGetAndSetMethods(type, name);
testNaNConversion(type, name);
}
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (94782 => 94783)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2011-09-08 19:44:57 UTC (rev 94782)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2011-09-08 19:55:20 UTC (rev 94783)
@@ -480,6 +480,23 @@
'actions': [
# Actions to build derived sources.
{
+ 'action_name': 'generateV8ArrayBufferViewCustomScript',
+ 'inputs': [
+ '../bindings/v8/custom/V8ArrayBufferViewCustomScript.js',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/V8ArrayBufferViewCustomScript.h',
+ ],
+ 'action': [
+ 'perl',
+ '../inspector/xxd.pl',
+ 'V8ArrayBufferViewCustomScript_js',
+ '<@(_inputs)',
+ '<@(_outputs)'
+ ],
+ 'message': 'Generating V8ArrayBufferViewCustomScript.h from V8ArrayBufferViewCustomScript.js',
+ },
+ {
'action_name': 'generateXMLViewerCSS',
'inputs': [
'../xml/XMLViewer.css',
Modified: trunk/Source/WebCore/WebCore.gypi (94782 => 94783)
--- trunk/Source/WebCore/WebCore.gypi 2011-09-08 19:44:57 UTC (rev 94782)
+++ trunk/Source/WebCore/WebCore.gypi 2011-09-08 19:55:20 UTC (rev 94783)
@@ -2063,6 +2063,8 @@
'bindings/v8/V8AbstractEventListener.h',
'bindings/v8/V8Binding.cpp',
'bindings/v8/V8Binding.h',
+ 'bindings/v8/V8BindingScripts.cpp',
+ 'bindings/v8/V8BindingScripts.h',
'bindings/v8/V8Collection.cpp',
'bindings/v8/V8Collection.h',
'bindings/v8/V8DOMMap.cpp',
Added: trunk/Source/WebCore/bindings/v8/V8BindingScripts.cpp (0 => 94783)
--- trunk/Source/WebCore/bindings/v8/V8BindingScripts.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/v8/V8BindingScripts.cpp 2011-09-08 19:55:20 UTC (rev 94783)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "V8BindingScripts.h"
+
+#include "V8ArrayBufferViewCustomScript.h"
+#include "V8Binding.h"
+
+namespace WebCore {
+
+void V8BindingScripts::runScripts(v8::Handle<v8::Context> v8Context)
+{
+ v8::Context::Scope contextScope(v8Context);
+ String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js),
+ sizeof(V8ArrayBufferViewCustomScript_js));
+ v8::Handle<v8::Script> script = v8::Script::Compile(v8String(source));
+ script->Run();
+}
+
+}
Added: trunk/Source/WebCore/bindings/v8/V8BindingScripts.h (0 => 94783)
--- trunk/Source/WebCore/bindings/v8/V8BindingScripts.h (rev 0)
+++ trunk/Source/WebCore/bindings/v8/V8BindingScripts.h 2011-09-08 19:55:20 UTC (rev 94783)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef V8BindingScripts_h
+#define V8BindingScripts_h
+
+#include "v8.h"
+
+namespace WebCore {
+
+class V8BindingScripts {
+public:
+ // Runs custom scripts that set up V8 bindings in global context.
+ // Precondition: the specified V8 context is initialized and contains the
+ // global object.
+ static void runScripts(v8::Handle<v8::Context>);
+};
+
+}
+
+#endif
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (94782 => 94783)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2011-09-08 19:44:57 UTC (rev 94782)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2011-09-08 19:55:20 UTC (rev 94783)
@@ -1,10 +1,10 @@
/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
- *
+ * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -46,6 +46,7 @@
#include "SecurityOrigin.h"
#include "StorageNamespace.h"
#include "V8Binding.h"
+#include "V8BindingScripts.h"
#include "V8BindingState.h"
#include "V8Collection.h"
#include "V8DOMMap.h"
@@ -339,6 +340,8 @@
setSecurityToken();
+ V8BindingScripts::runScripts(v8Context);
+
m_frame->loader()->client()->didCreateScriptContextForFrame();
// FIXME: This is wrong. We should actually do this for the proper world once
Modified: trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp (94782 => 94783)
--- trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp 2011-09-08 19:44:57 UTC (rev 94782)
+++ trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp 2011-09-08 19:55:20 UTC (rev 94783)
@@ -41,6 +41,7 @@
#include "SharedWorker.h"
#include "SharedWorkerContext.h"
#include "V8Binding.h"
+#include "V8BindingScripts.h"
#include "V8DOMMap.h"
#include "V8DedicatedWorkerContext.h"
#include "V8Proxy.h"
@@ -174,6 +175,9 @@
// Insert the object instance as the prototype of the shadow object.
v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype());
globalObject->SetPrototype(jsWorkerContext);
+
+ V8BindingScripts::runScripts(context);
+
return true;
}
Added: trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js (0 => 94783)
--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js (rev 0)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustomScript.js 2011-09-08 19:55:20 UTC (rev 94783)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+(function() {
+
+var optimizeSetMethod = function(type)
+{
+ 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);
+ }
+ return f;
+ })();
+};
+
+optimizeSetMethod(Float32Array);
+optimizeSetMethod(Float64Array);
+optimizeSetMethod(Int8Array);
+optimizeSetMethod(Int16Array);
+optimizeSetMethod(Int32Array);
+optimizeSetMethod(Uint8Array);
+optimizeSetMethod(Uint16Array);
+optimizeSetMethod(Uint32Array);
+
+})();
+