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

Unified Diff: src/arraybuffer.js

Issue 1082703003: Wrap typed array implementations in functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « src/array-iterator.js ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arraybuffer.js
diff --git a/src/arraybuffer.js b/src/arraybuffer.js
index e4d332b060cbc6d7be90d274a25e302898754078..86b13927aa42071d091dbae4a200bbd9a5f8666b 100644
--- a/src/arraybuffer.js
+++ b/src/arraybuffer.js
@@ -2,9 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+(function() {
+
"use strict";
-var $ArrayBuffer = global.ArrayBuffer;
+%CheckIsBootstrapping();
+
+var GlobalArrayBuffer = global.ArrayBuffer;
+var GlobalObject = global.Object;
// -------------------------------------------------------------------
@@ -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, [
- "isView", ArrayBufferIsViewJS
- ]);
+InstallFunctions(GlobalArrayBuffer, DONT_ENUM, [
+ "isView", ArrayBufferIsViewJS
+]);
- InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, [
- "slice", ArrayBufferSlice
- ]);
-}
+InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [
+ "slice", ArrayBufferSlice
+]);
-SetUpArrayBuffer();
+})();
« no previous file with comments | « src/array-iterator.js ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698