| 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 var a = new Int32Array(100); | 7 var a = new Int32Array(100); |
| 8 a.__proto__ = null; | 8 a.__proto__ = null; |
| 9 | 9 |
| 10 function get(a) { | 10 function get(a) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 return a.length; | 101 return a.length; |
| 102 } | 102 } |
| 103 | 103 |
| 104 assertEquals("blah", get(a)); | 104 assertEquals("blah", get(a)); |
| 105 assertEquals("blah", get(a)); | 105 assertEquals("blah", get(a)); |
| 106 assertEquals("blah", get(a)); | 106 assertEquals("blah", get(a)); |
| 107 %OptimizeFunctionOnNextCall(get); | 107 %OptimizeFunctionOnNextCall(get); |
| 108 assertEquals("blah", get(a)); | 108 assertEquals("blah", get(a)); |
| 109 })(); | 109 })(); |
| 110 | 110 |
| 111 // Ensure we cannot delete length, byteOffset, byteLength. | 111 // Ensure we can delete length, byteOffset, byteLength. |
| 112 assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("length")); | 112 assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("length")); |
| 113 assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("byteOffset")); | 113 assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("byteOffset")); |
| 114 assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("byteLength")); | 114 assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("byteLength")); |
| 115 assertFalse(delete Int32Array.prototype.__proto__.length); | 115 assertTrue(delete Int32Array.prototype.__proto__.length); |
| 116 assertFalse(delete Int32Array.prototype.__proto__.byteOffset); | 116 assertTrue(delete Int32Array.prototype.__proto__.byteOffset); |
| 117 assertFalse(delete Int32Array.prototype.__proto__.byteLength); | 117 assertTrue(delete Int32Array.prototype.__proto__.byteLength); |
| 118 | 118 |
| 119 a = new Int32Array(100); | 119 a = new Int32Array(100); |
| 120 | 120 |
| 121 get = function(a) { | 121 get = function(a) { |
| 122 return a.length; | 122 return a.length; |
| 123 } | 123 } |
| 124 | 124 |
| 125 assertEquals(100, get(a)); | 125 assertEquals(undefined, get(a)); |
| 126 assertEquals(100, get(a)); | 126 assertEquals(undefined, get(a)); |
| 127 assertEquals(100, get(a)); | 127 assertEquals(undefined, get(a)); |
| 128 %OptimizeFunctionOnNextCall(get); | 128 %OptimizeFunctionOnNextCall(get); |
| 129 assertEquals(100, get(a)); | 129 assertEquals(undefined, get(a)); |
| 130 | 130 |
| 131 get = function(a) { | 131 get = function(a) { |
| 132 return a.byteLength; | 132 return a.byteLength; |
| 133 } | 133 } |
| 134 | 134 |
| 135 assertEquals(400, get(a)); | 135 assertEquals(undefined, get(a)); |
| 136 assertEquals(400, get(a)); | 136 assertEquals(undefined, get(a)); |
| 137 assertEquals(400, get(a)); | 137 assertEquals(undefined, get(a)); |
| 138 %OptimizeFunctionOnNextCall(get); | 138 %OptimizeFunctionOnNextCall(get); |
| 139 assertEquals(400, get(a)); | 139 assertEquals(undefined, get(a)); |
| 140 | 140 |
| 141 get = function(a) { | 141 get = function(a) { |
| 142 return a.byteOffset; | 142 return a.byteOffset; |
| 143 } | 143 } |
| 144 | 144 |
| 145 assertEquals(0, get(a)); | 145 assertEquals(undefined, get(a)); |
| 146 assertEquals(0, get(a)); | 146 assertEquals(undefined, get(a)); |
| 147 assertEquals(0, get(a)); | 147 assertEquals(undefined, get(a)); |
| 148 %OptimizeFunctionOnNextCall(get); | 148 %OptimizeFunctionOnNextCall(get); |
| 149 assertEquals(0, get(a)); | 149 assertEquals(undefined, get(a)); |
| OLD | NEW |