Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 // Flags: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
| 6 | 6 |
| 7 (function () { | 7 (function () { |
| 8 var o = []; | 8 var o = []; |
| 9 o.__proto__ = {}; | 9 o.__proto__ = {}; |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 Object.defineProperty(o, "3", { | 22 Object.defineProperty(o, "3", { |
| 23 get:function() { return 100; }, | 23 get:function() { return 100; }, |
| 24 set:function(v) { set = v; }}); | 24 set:function(v) { set = v; }}); |
| 25 | 25 |
| 26 store(o, 3, 1000); | 26 store(o, 3, 1000); |
| 27 assertEquals(1000, set); | 27 assertEquals(1000, set); |
| 28 assertEquals(100, o[3]); | 28 assertEquals(100, o[3]); |
| 29 })(); | 29 })(); |
| 30 | 30 |
| 31 (function () { | 31 (function () { |
| 32 var o = new Int32Array(); | 32 var o = new Int32Array(1); |
| 33 Object.defineProperty(o, "0", {get: function(){}}); | 33 assertThrows('Object.defineProperty(o, "0", {get: function(){}})'); |
|
Dan Ehrenberg
2016/11/18 16:03:52
Nit: For new tests, pass two arguments: the code t
| |
| 34 assertEquals(undefined, Object.getOwnPropertyDescriptor(o, "0")); | 34 assertEquals({ |
|
caitp
2016/11/17 15:24:42
this old test was wrong per spec, does it still pa
Henrique Ferreiro
2016/11/18 09:27:07
IntegerIndexedElementGet: Step 8. If index < 0 or
caitp
2016/11/18 14:47:51
No, Object.defineProperty should throw here, becau
| |
| 35 value: 0, | |
| 36 writable: true, | |
| 37 enumerable: true, | |
| 38 configurable: false | |
| 39 }, Object.getOwnPropertyDescriptor(o, "0")); | |
| 35 })(); | 40 })(); |
| 36 | 41 |
| 37 (function() { | 42 (function() { |
| 38 function f() { | 43 function f() { |
| 39 var a = new Array(); | 44 var a = new Array(); |
| 40 a[1] = 1.5; | 45 a[1] = 1.5; |
| 41 return a; | 46 return a; |
| 42 } | 47 } |
| 43 | 48 |
| 44 f(); | 49 f(); |
| 45 f(); | 50 f(); |
| 46 %OptimizeFunctionOnNextCall(f); | 51 %OptimizeFunctionOnNextCall(f); |
| 47 var a = f(); | 52 var a = f(); |
| 48 a[2] = 2; | 53 a[2] = 2; |
| 49 assertEquals(3, a.length); | 54 assertEquals(3, a.length); |
| 50 })(); | 55 })(); |
| OLD | NEW |