OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 function TestByteLengthNotWritable() { | 64 function TestByteLengthNotWritable() { |
65 var sab = new SharedArrayBuffer(1024); | 65 var sab = new SharedArrayBuffer(1024); |
66 assertSame(1024, sab.byteLength); | 66 assertSame(1024, sab.byteLength); |
67 | 67 |
68 assertThrows(function() { "use strict"; sab.byteLength = 42; }, TypeError); | 68 assertThrows(function() { "use strict"; sab.byteLength = 42; }, TypeError); |
69 } | 69 } |
70 | 70 |
71 TestByteLengthNotWritable(); | 71 TestByteLengthNotWritable(); |
72 | 72 |
73 function TestArrayBufferNoSlice() { | |
74 var sab = new SharedArrayBuffer(10); | |
75 assertEquals(undefined, sab.slice); | |
76 } | |
77 | |
78 TestArrayBufferNoSlice(); | |
79 | |
80 // Typed arrays using SharedArrayBuffers | 73 // Typed arrays using SharedArrayBuffers |
81 | 74 |
82 // TODO(binji): how many of these tests are necessary if there are no new | 75 // TODO(binji): how many of these tests are necessary if there are no new |
83 // TypedArray types? | 76 // TypedArray types? |
84 | 77 |
85 function MakeSharedTypedArray(constr, numElements) { | 78 function MakeSharedTypedArray(constr, numElements) { |
86 var sab = new SharedArrayBuffer(constr.BYTES_PER_ELEMENT * numElements); | 79 var sab = new SharedArrayBuffer(constr.BYTES_PER_ELEMENT * numElements); |
87 return new constr(sab); | 80 return new constr(sab); |
88 } | 81 } |
89 | 82 |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 var desc = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'byteLength'); | 576 var desc = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'byteLength'); |
584 s = new SharedArrayBuffer(10); | 577 s = new SharedArrayBuffer(10); |
585 Object.defineProperty(s, 'byteLength', desc); | 578 Object.defineProperty(s, 'byteLength', desc); |
586 assertThrows(function() {s.byteLength}, TypeError); | 579 assertThrows(function() {s.byteLength}, TypeError); |
587 | 580 |
588 desc = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, | 581 desc = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, |
589 'byteLength'); | 582 'byteLength'); |
590 var a = new ArrayBuffer(10); | 583 var a = new ArrayBuffer(10); |
591 Object.defineProperty(a, 'byteLength', desc); | 584 Object.defineProperty(a, 'byteLength', desc); |
592 assertThrows(function() {a.byteLength}, TypeError); | 585 assertThrows(function() {a.byteLength}, TypeError); |
OLD | NEW |