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

Unified Diff: src/js/typedarray.js

Issue 1712163002: [builtins] Migrate the DataView constructor to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/crankshaft/hydrogen.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/typedarray.js
diff --git a/src/js/typedarray.js b/src/js/typedarray.js
index 2b63973b9f5aa01c4e93019e6f2f4f2db48d4d2e..3d500a379ec8786d324600b6c9a77b8f54199b61 100644
--- a/src/js/typedarray.js
+++ b/src/js/typedarray.js
@@ -847,36 +847,6 @@ TYPED_ARRAYS(SETUP_TYPED_ARRAY)
// --------------------------- DataView -----------------------------
-function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3
- if (IS_UNDEFINED(new.target)) {
- throw MakeTypeError(kConstructorNotFunction, "DataView");
- }
-
- // TODO(binji): support SharedArrayBuffers?
- if (!IS_ARRAYBUFFER(buffer)) throw MakeTypeError(kDataViewNotArrayBuffer);
- if (!IS_UNDEFINED(byteOffset)) {
- byteOffset = ToPositiveInteger(byteOffset, kInvalidDataViewOffset);
- }
- if (!IS_UNDEFINED(byteLength)) {
- byteLength = TO_INTEGER(byteLength);
- }
-
- var bufferByteLength = %_ArrayBufferGetByteLength(buffer);
-
- var offset = IS_UNDEFINED(byteOffset) ? 0 : byteOffset;
- if (offset > bufferByteLength) throw MakeRangeError(kInvalidDataViewOffset);
-
- var length = IS_UNDEFINED(byteLength)
- ? bufferByteLength - offset
- : byteLength;
- if (length < 0 || offset + length > bufferByteLength) {
- throw new MakeRangeError(kInvalidDataViewLength);
- }
- var result = %NewObject(GlobalDataView, new.target);
- %_DataViewInitialize(result, buffer, offset, length);
- return result;
-}
-
function DataViewGetBufferJS() {
if (!IS_DATAVIEW(this)) {
throw MakeTypeError(kIncompatibleMethodReceiver, 'DataView.buffer', this);
@@ -939,7 +909,6 @@ endmacro
DATA_VIEW_TYPES(DATA_VIEW_GETTER_SETTER)
// Setup the DataView constructor.
-%SetCode(GlobalDataView, DataViewConstructor);
%FunctionSetPrototype(GlobalDataView, new GlobalObject);
// Set up constructor property on the DataView prototype.
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698