mirror of https://github.com/lukechilds/node.git
Trevor Norris
11 years ago
36 changed files with 529 additions and 152 deletions
@ -0,0 +1,45 @@ |
|||||
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
|
// Redistribution and use in source and binary forms, with or without
|
||||
|
// modification, are permitted provided that the following conditions are
|
||||
|
// met:
|
||||
|
//
|
||||
|
// * Redistributions of source code must retain the above copyright
|
||||
|
// notice, this list of conditions and the following disclaimer.
|
||||
|
// * Redistributions in binary form must reproduce the above
|
||||
|
// copyright notice, this list of conditions and the following
|
||||
|
// disclaimer in the documentation and/or other materials provided
|
||||
|
// with the distribution.
|
||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||
|
// contributors may be used to endorse or promote products derived
|
||||
|
// from this software without specific prior written permission.
|
||||
|
//
|
||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
//
|
||||
|
// Flags: --allow-natives-syntax
|
||||
|
|
||||
|
var __v_7 = { }; |
||||
|
function __f_8(base, condition) { |
||||
|
__v_7[base + 3] = 0; |
||||
|
__v_7[base + 4] = 0; |
||||
|
if (condition) { |
||||
|
__v_7[base + 0] = 0; |
||||
|
__v_7[base + 5] = 0; |
||||
|
} else { |
||||
|
__v_7[base + 0] = 0; |
||||
|
__v_7[base + 18] = 0; |
||||
|
} |
||||
|
} |
||||
|
__f_8(1, true); |
||||
|
__f_8(1, false); |
||||
|
%OptimizeFunctionOnNextCall(__f_8); |
||||
|
__f_8(5, false); |
@ -0,0 +1,51 @@ |
|||||
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
|
// Redistribution and use in source and binary forms, with or without
|
||||
|
// modification, are permitted provided that the following conditions are
|
||||
|
// met:
|
||||
|
//
|
||||
|
// * Redistributions of source code must retain the above copyright
|
||||
|
// notice, this list of conditions and the following disclaimer.
|
||||
|
// * Redistributions in binary form must reproduce the above
|
||||
|
// copyright notice, this list of conditions and the following
|
||||
|
// disclaimer in the documentation and/or other materials provided
|
||||
|
// with the distribution.
|
||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||
|
// contributors may be used to endorse or promote products derived
|
||||
|
// from this software without specific prior written permission.
|
||||
|
//
|
||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
||||
|
// Flags: --allow-natives-syntax --expose-gc
|
||||
|
|
||||
|
function __f_4(i1) { |
||||
|
return __v_3[i1] * __v_3[0]; |
||||
|
} |
||||
|
function __f_3(i1) { |
||||
|
__f_4(i1); |
||||
|
__f_4(i1 + 16); |
||||
|
__f_4(i1 + 32); |
||||
|
%OptimizeFunctionOnNextCall(__f_4); |
||||
|
var x = __f_4(i1 + 993); |
||||
|
return x; |
||||
|
} |
||||
|
function __f_5() { |
||||
|
__v_3[0] = +__v_3[0]; |
||||
|
gc(); |
||||
|
__f_3(0) | 0; |
||||
|
__v_3 = /\u23a1|x/; |
||||
|
return 0; |
||||
|
} |
||||
|
var __v_3 = new Float32Array(1000); |
||||
|
__f_5(); |
||||
|
__f_5(); |
||||
|
__f_5(); |
@ -0,0 +1,74 @@ |
|||||
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||
|
// found in the LICENSE file.
|
||||
|
|
||||
|
// Flags: --allow-natives-syntax
|
||||
|
|
||||
|
var buffer1 = new ArrayBuffer(100 * 1024); |
||||
|
|
||||
|
var array1 = new Uint8Array(buffer1, {valueOf : function() { |
||||
|
%ArrayBufferNeuter(buffer1); |
||||
|
return 0; |
||||
|
}}); |
||||
|
|
||||
|
assertEquals(0, array1.length); |
||||
|
|
||||
|
var buffer2 = new ArrayBuffer(100 * 1024); |
||||
|
|
||||
|
assertThrows(function() { |
||||
|
var array2 = new Uint8Array(buffer2, 0, {valueOf : function() { |
||||
|
%ArrayBufferNeuter(buffer2); |
||||
|
return 100 * 1024; |
||||
|
}}); |
||||
|
}, RangeError); |
||||
|
|
||||
|
|
||||
|
var buffer3 = new ArrayBuffer(100 * 1024 * 1024); |
||||
|
var dataView1 = new DataView(buffer3, {valueOf : function() { |
||||
|
%ArrayBufferNeuter(buffer3); |
||||
|
return 0; |
||||
|
}}); |
||||
|
|
||||
|
assertEquals(0, dataView1.byteLength); |
||||
|
|
||||
|
var buffer4 = new ArrayBuffer(100 * 1024); |
||||
|
assertThrows(function() { |
||||
|
var dataView2 = new DataView(buffer4, 0, {valueOf : function() { |
||||
|
%ArrayBufferNeuter(buffer4); |
||||
|
return 100 * 1024 * 1024; |
||||
|
}}); |
||||
|
}, RangeError); |
||||
|
|
||||
|
|
||||
|
var buffer5 = new ArrayBuffer(100 * 1024); |
||||
|
var buffer6 = buffer5.slice({valueOf : function() { |
||||
|
%ArrayBufferNeuter(buffer5); |
||||
|
return 0; |
||||
|
}}, 100 * 1024 * 1024); |
||||
|
assertEquals(0, buffer6.byteLength); |
||||
|
|
||||
|
|
||||
|
var buffer7 = new ArrayBuffer(100 * 1024 * 1024); |
||||
|
var buffer8 = buffer7.slice(0, {valueOf : function() { |
||||
|
%ArrayBufferNeuter(buffer7); |
||||
|
return 100 * 1024 * 1024; |
||||
|
}}); |
||||
|
assertEquals(0, buffer8.byteLength); |
||||
|
|
||||
|
var buffer9 = new ArrayBuffer(1024); |
||||
|
var array9 = new Uint8Array(buffer9); |
||||
|
var array10 = array9.subarray({valueOf : function() { |
||||
|
%ArrayBufferNeuter(buffer9); |
||||
|
return 0; |
||||
|
}}, 1024); |
||||
|
assertEquals(0, array9.length); |
||||
|
assertEquals(0, array10.length); |
||||
|
|
||||
|
var buffer11 = new ArrayBuffer(1024); |
||||
|
var array11 = new Uint8Array(buffer11); |
||||
|
var array12 = array11.subarray(0, {valueOf : function() { |
||||
|
%ArrayBufferNeuter(buffer11); |
||||
|
return 1024; |
||||
|
}}); |
||||
|
assertEquals(0, array11.length); |
||||
|
assertEquals(0, array12.length); |
@ -0,0 +1,33 @@ |
|||||
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||
|
// found in the LICENSE file.
|
||||
|
|
||||
|
// Flags: --allow-natives-syntax
|
||||
|
|
||||
|
var dummy = new Int32Array(100); |
||||
|
array = new Int32Array(100); |
||||
|
var dummy2 = new Int32Array(100); |
||||
|
|
||||
|
array[-17] = 0; |
||||
|
function fun(base,cond) { |
||||
|
array[base - 1] = 1; |
||||
|
array[base - 2] = 2; |
||||
|
if (cond) { |
||||
|
array[base - 4] = 3; |
||||
|
array[base - 5] = 4; |
||||
|
} else { |
||||
|
array[base - 6] = 5; |
||||
|
array[base - 100] = 777; |
||||
|
} |
||||
|
} |
||||
|
fun(5,true); |
||||
|
fun(7,false); |
||||
|
%OptimizeFunctionOnNextCall(fun); |
||||
|
fun(7,false); |
||||
|
|
||||
|
for (var i = 0; i < dummy.length; i++) { |
||||
|
assertEquals(0, dummy[i]); |
||||
|
} |
||||
|
for (var i = 0; i < dummy2.length; i++) { |
||||
|
assertEquals(0, dummy2[i]); |
||||
|
} |
Loading…
Reference in new issue