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

Side by Side Diff: src/js/typedarray.js

Issue 2798403004: [SAB] Fix {newtarget-prototype-is-not-object,proto-from-ctor-realm} tests (Closed)
Patch Set: skip test that fails because of ASAN allocation failure Created 3 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 unified diff | Download patch
« no previous file with comments | « src/bootstrapper.cc ('k') | test/mjsunit/harmony/sharedarraybuffer.js » ('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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 // ES#sec-typedarray-typedarray TypedArray ( typedArray ) 142 // ES#sec-typedarray-typedarray TypedArray ( typedArray )
143 function NAMEConstructByTypedArray(obj, typedArray) { 143 function NAMEConstructByTypedArray(obj, typedArray) {
144 // TODO(littledan): Throw on detached typedArray 144 // TODO(littledan): Throw on detached typedArray
145 var srcData = %TypedArrayGetBuffer(typedArray); 145 var srcData = %TypedArrayGetBuffer(typedArray);
146 var length = %_TypedArrayGetLength(typedArray); 146 var length = %_TypedArrayGetLength(typedArray);
147 var byteLength = %_ArrayBufferViewGetByteLength(typedArray); 147 var byteLength = %_ArrayBufferViewGetByteLength(typedArray);
148 var newByteLength = length * ELEMENT_SIZE; 148 var newByteLength = length * ELEMENT_SIZE;
149 %typed_array_construct_by_array_like(obj, typedArray, length, ELEMENT_SIZE); 149 %typed_array_construct_by_array_like(obj, typedArray, length, ELEMENT_SIZE);
150 var bufferConstructor = SpeciesConstructor(srcData, GlobalArrayBuffer); 150 // The spec requires that constructing a typed array using a SAB-backed typed
151 // array use the ArrayBuffer constructor, not the species constructor. See
152 // https://tc39.github.io/ecma262/#sec-typedarray-typedarray.
153 var bufferConstructor = IS_SHAREDARRAYBUFFER(srcData)
154 ? GlobalArrayBuffer
155 : SpeciesConstructor(srcData, GlobalArrayBuffer);
151 var prototype = bufferConstructor.prototype; 156 var prototype = bufferConstructor.prototype;
152 // TODO(littledan): Use the right prototype based on bufferConstructor's realm 157 // TODO(littledan): Use the right prototype based on bufferConstructor's realm
153 if (IS_RECEIVER(prototype) && prototype !== GlobalArrayBufferPrototype) { 158 if (IS_RECEIVER(prototype) && prototype !== GlobalArrayBufferPrototype) {
154 %InternalSetPrototype(%TypedArrayGetBuffer(obj), prototype); 159 %InternalSetPrototype(%TypedArrayGetBuffer(obj), prototype);
155 } 160 }
156 } 161 }
157 162
158 function NAMEConstructor(arg1, arg2, arg3) { 163 function NAMEConstructor(arg1, arg2, arg3) {
159 if (!IS_UNDEFINED(new.target)) { 164 if (!IS_UNDEFINED(new.target)) {
160 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) { 165 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) {
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 %AddNamedProperty(GlobalNAME.prototype, 694 %AddNamedProperty(GlobalNAME.prototype,
690 "constructor", global.NAME, DONT_ENUM); 695 "constructor", global.NAME, DONT_ENUM);
691 %AddNamedProperty(GlobalNAME.prototype, 696 %AddNamedProperty(GlobalNAME.prototype,
692 "BYTES_PER_ELEMENT", ELEMENT_SIZE, 697 "BYTES_PER_ELEMENT", ELEMENT_SIZE,
693 READ_ONLY | DONT_ENUM | DONT_DELETE); 698 READ_ONLY | DONT_ENUM | DONT_DELETE);
694 endmacro 699 endmacro
695 700
696 TYPED_ARRAYS(SETUP_TYPED_ARRAY) 701 TYPED_ARRAYS(SETUP_TYPED_ARRAY)
697 702
698 }) 703 })
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | test/mjsunit/harmony/sharedarraybuffer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698