forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathes5array_arrayproto_opt.js
More file actions
33 lines (25 loc) · 954 Bytes
/
es5array_arrayproto_opt.js
File metadata and controls
33 lines (25 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
function test(obj, i)
{
obj[i] = 1;
WScript.Echo(obj[i]);
}
function test2(obj)
{
obj[0] = 1;
WScript.Echo(obj[0]);
}
// Populate the profile with any array that we are growing a segment length
test2([]);
Object.defineProperty(Array.prototype, "0", { value:"blah", writable: false });
// Test the jitted code with the array type check elimination
test2([]);
var arr = [];
arr[1] = 2;
// Populate the profile to not filling a missing value.
test(arr, 1);
// Test the jitted code with the array type check elimitation
test(arr, 0);