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

Side by Side Diff: src/typedarray.js

Issue 1136553006: Implement SharedArrayBuffer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge master Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-typedarray.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 for (var i = 0; i < l; i++) { 120 for (var i = 0; i < l; i++) {
121 // It is crucial that we let any execptions from arrayLike[i] 121 // It is crucial that we let any execptions from arrayLike[i]
122 // propagate outside the function. 122 // propagate outside the function.
123 obj[i] = arrayLike[i]; 123 obj[i] = arrayLike[i];
124 } 124 }
125 } 125 }
126 } 126 }
127 127
128 function NAMEConstructor(arg1, arg2, arg3) { 128 function NAMEConstructor(arg1, arg2, arg3) {
129 if (%_IsConstructCall()) { 129 if (%_IsConstructCall()) {
130 if (IS_ARRAYBUFFER(arg1)) { 130 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) {
131 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3); 131 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3);
132 } else if (IS_NUMBER(arg1) || IS_STRING(arg1) || 132 } else if (IS_NUMBER(arg1) || IS_STRING(arg1) ||
133 IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) { 133 IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) {
134 NAMEConstructByLength(this, arg1); 134 NAMEConstructByLength(this, arg1);
135 } else { 135 } else {
136 NAMEConstructByArrayLike(this, arg1); 136 NAMEConstructByArrayLike(this, arg1);
137 } 137 }
138 } else { 138 } else {
139 throw MakeTypeError(kConstructorNotFunction, "NAME") 139 throw MakeTypeError(kConstructorNotFunction, "NAME")
140 } 140 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 "set", TypedArraySet 340 "set", TypedArraySet
341 ]); 341 ]);
342 endmacro 342 endmacro
343 343
344 TYPED_ARRAYS(SETUP_TYPED_ARRAY) 344 TYPED_ARRAYS(SETUP_TYPED_ARRAY)
345 345
346 // --------------------------- DataView ----------------------------- 346 // --------------------------- DataView -----------------------------
347 347
348 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3 348 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3
349 if (%_IsConstructCall()) { 349 if (%_IsConstructCall()) {
350 // TODO(binji): support SharedArrayBuffers?
350 if (!IS_ARRAYBUFFER(buffer)) throw MakeTypeError(kDataViewNotArrayBuffer); 351 if (!IS_ARRAYBUFFER(buffer)) throw MakeTypeError(kDataViewNotArrayBuffer);
351 if (!IS_UNDEFINED(byteOffset)) { 352 if (!IS_UNDEFINED(byteOffset)) {
352 byteOffset = $toPositiveInteger(byteOffset, kInvalidDataViewOffset); 353 byteOffset = $toPositiveInteger(byteOffset, kInvalidDataViewOffset);
353 } 354 }
354 if (!IS_UNDEFINED(byteLength)) { 355 if (!IS_UNDEFINED(byteLength)) {
355 byteLength = TO_INTEGER(byteLength); 356 byteLength = TO_INTEGER(byteLength);
356 } 357 }
357 358
358 var bufferByteLength = %_ArrayBufferGetByteLength(buffer); 359 var bufferByteLength = %_ArrayBufferGetByteLength(buffer);
359 360
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 "setUint32", DataViewSetUint32JS, 466 "setUint32", DataViewSetUint32JS,
466 467
467 "getFloat32", DataViewGetFloat32JS, 468 "getFloat32", DataViewGetFloat32JS,
468 "setFloat32", DataViewSetFloat32JS, 469 "setFloat32", DataViewSetFloat32JS,
469 470
470 "getFloat64", DataViewGetFloat64JS, 471 "getFloat64", DataViewGetFloat64JS,
471 "setFloat64", DataViewSetFloat64JS 472 "setFloat64", DataViewSetFloat64JS
472 ]); 473 ]);
473 474
474 }) 475 })
OLDNEW
« no previous file with comments | « src/runtime/runtime-typedarray.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698