summaryrefslogtreecommitdiff
path: root/chromium/v8/src/arraybuffer.js
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-06-18 14:10:49 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-06-18 13:53:24 +0000
commit813fbf95af77a531c57a8c497345ad2c61d475b3 (patch)
tree821b2c8de8365f21b6c9ba17a236fb3006a1d506 /chromium/v8/src/arraybuffer.js
parentaf6588f8d723931a298c995fa97259bb7f7deb55 (diff)
downloadqtwebengine-chromium-813fbf95af77a531c57a8c497345ad2c61d475b3.tar.gz
BASELINE: Update chromium to 44.0.2403.47
Change-Id: Ie056fedba95cf5e5c76b30c4b2c80fca4764aa2f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/v8/src/arraybuffer.js')
-rw-r--r--chromium/v8/src/arraybuffer.js64
1 files changed, 33 insertions, 31 deletions
diff --git a/chromium/v8/src/arraybuffer.js b/chromium/v8/src/arraybuffer.js
index cf00693be7f..3e6e084a7be 100644
--- a/chromium/v8/src/arraybuffer.js
+++ b/chromium/v8/src/arraybuffer.js
@@ -2,25 +2,30 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+(function(global, shared, exports) {
+
"use strict";
-var $ArrayBuffer = global.ArrayBuffer;
+%CheckIsBootstrapping();
+
+var GlobalArrayBuffer = global.ArrayBuffer;
+var GlobalObject = global.Object;
// -------------------------------------------------------------------
function ArrayBufferConstructor(length) { // length = 1
if (%_IsConstructCall()) {
- var byteLength = ToPositiveInteger(length, 'invalid_array_buffer_length');
+ var byteLength = $toPositiveInteger(length, kInvalidArrayBufferLength);
%ArrayBufferInitialize(this, byteLength);
} else {
- throw MakeTypeError('constructor_not_function', ["ArrayBuffer"]);
+ throw MakeTypeError(kConstructorNotFunction, "ArrayBuffer");
}
}
function ArrayBufferGetByteLen() {
if (!IS_ARRAYBUFFER(this)) {
- throw MakeTypeError('incompatible_method_receiver',
- ['ArrayBuffer.prototype.byteLength', this]);
+ throw MakeTypeError(kIncompatibleMethodReceiver,
+ 'ArrayBuffer.prototype.byteLength', this);
}
return %_ArrayBufferGetByteLength(this);
}
@@ -28,8 +33,8 @@ function ArrayBufferGetByteLen() {
// ES6 Draft 15.13.5.5.3
function ArrayBufferSlice(start, end) {
if (!IS_ARRAYBUFFER(this)) {
- throw MakeTypeError('incompatible_method_receiver',
- ['ArrayBuffer.prototype.slice', this]);
+ throw MakeTypeError(kIncompatibleMethodReceiver,
+ 'ArrayBuffer.prototype.slice', this);
}
var relativeStart = TO_INTEGER(start);
@@ -39,16 +44,16 @@ function ArrayBufferSlice(start, end) {
var first;
var byte_length = %_ArrayBufferGetByteLength(this);
if (relativeStart < 0) {
- first = MathMax(byte_length + relativeStart, 0);
+ first = $max(byte_length + relativeStart, 0);
} else {
- first = MathMin(relativeStart, byte_length);
+ first = $min(relativeStart, byte_length);
}
var relativeEnd = IS_UNDEFINED(end) ? byte_length : end;
var fin;
if (relativeEnd < 0) {
- fin = MathMax(byte_length + relativeEnd, 0);
+ fin = $max(byte_length + relativeEnd, 0);
} else {
- fin = MathMin(relativeEnd, byte_length);
+ fin = $min(relativeEnd, byte_length);
}
if (fin < first) {
@@ -56,7 +61,7 @@ function ArrayBufferSlice(start, end) {
}
var newLen = fin - first;
// TODO(dslomov): implement inheritance
- var result = new $ArrayBuffer(newLen);
+ var result = new GlobalArrayBuffer(newLen);
%ArrayBufferSliceImpl(this, result, first);
return result;
@@ -66,29 +71,26 @@ function ArrayBufferIsViewJS(obj) {
return %ArrayBufferIsView(obj);
}
-function SetUpArrayBuffer() {
- %CheckIsBootstrapping();
- // Set up the ArrayBuffer constructor function.
- %SetCode($ArrayBuffer, ArrayBufferConstructor);
- %FunctionSetPrototype($ArrayBuffer, new $Object());
+// Set up the ArrayBuffer constructor function.
+%SetCode(GlobalArrayBuffer, ArrayBufferConstructor);
+%FunctionSetPrototype(GlobalArrayBuffer, new GlobalObject());
- // Set up the constructor property on the ArrayBuffer prototype object.
- %AddNamedProperty(
- $ArrayBuffer.prototype, "constructor", $ArrayBuffer, DONT_ENUM);
+// Set up the constructor property on the ArrayBuffer prototype object.
+%AddNamedProperty(
+ GlobalArrayBuffer.prototype, "constructor", GlobalArrayBuffer, DONT_ENUM);
- %AddNamedProperty($ArrayBuffer.prototype,
- symbolToStringTag, "ArrayBuffer", DONT_ENUM | READ_ONLY);
+%AddNamedProperty(GlobalArrayBuffer.prototype,
+ symbolToStringTag, "ArrayBuffer", DONT_ENUM | READ_ONLY);
- InstallGetter($ArrayBuffer.prototype, "byteLength", ArrayBufferGetByteLen);
+$installGetter(GlobalArrayBuffer.prototype, "byteLength", ArrayBufferGetByteLen);
- InstallFunctions($ArrayBuffer, DONT_ENUM, $Array(
- "isView", ArrayBufferIsViewJS
- ));
+$installFunctions(GlobalArrayBuffer, DONT_ENUM, [
+ "isView", ArrayBufferIsViewJS
+]);
- InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, $Array(
- "slice", ArrayBufferSlice
- ));
-}
+$installFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [
+ "slice", ArrayBufferSlice
+]);
-SetUpArrayBuffer();
+})