Commit 1783cd32 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[mjsunit] Split slow large object literal tests

Change-Id: Ib6ee9d9ce827c2f9f42f09292b0caca922cfde1e
Reviewed-on: https://chromium-review.googlesource.com/512663Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45487}
parent d74ece41
// Copyright 2017 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
(function TestLargeObjectDictionaryLiteral() {
// Create potential large-space object literal.
let properties = [];
// Constant chosen so the dictionary properties store lies in large object
// space.
const max = 0x1ef3e / 3;
for (let i = 0; i < max; i++) {
properties.push("p"+i);
}
let source = "return { __proto__:null, " + properties.join(":'',") + ":''}"
let createObject = new Function(source);
let object = createObject();
%HeapObjectVerify(object);
assertFalse(%HasFastProperties(object));
assertEquals(Object.getPrototypeOf(object ), null);
let keys = Object.keys(object);
// modify original object
object['new_property'] = {};
object[1] = 12;
%HeapObjectVerify(object);
let object2 = createObject();
%HeapObjectVerify(object2);
assertFalse(object2 === object);
assertFalse(%HasFastProperties(object2));
assertEquals(Object.getPrototypeOf(object2), null);
assertEquals(keys, Object.keys(object2));
})();
// Copyright 2017 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
// Test Object literal with large-object elements.
let indices = [];
const max = 0x1ef3e + 100;
for (let i = 0; i < max; i++) {
indices.push(""+i);
}
let source = "return {" + indices.join(":0,") + ":0};"
let largeElementsLiteral = new Function(source);
function TestLargeObjectElements() {
// Corresponds to FixedArray::kMaxRegularLength.
let object = largeElementsLiteral();
%HeapObjectVerify(object);
for (let i = 0; i < max; i++) {
assertEquals(0, object[i]);
}
object[0] = 0xFF;
assertEquals(0xFF, object[0]);
object[1] = 1.23;
assertEquals(1.23, object[1]);
%HeapObjectVerify(object);
}
TestLargeObjectElements();
TestLargeObjectElements();
%OptimizeFunctionOnNextCall(TestLargeObjectElements);
TestLargeObjectElements();
......@@ -104,61 +104,3 @@ function TestSlowLiteralOptimized() {
};
TestSlowLiteralOptimized();
TestSlowLiteralOptimized();
(function TestLargeObjectDictionaryLiteral() {
// Create potential large-space object literal.
let properties = [];
// Constant chosen so the dictionary properties store lies in large object
// space.
const max = 0x1ef3e / 3;
for (let i = 0; i < max; i++) {
properties.push("p"+i);
}
let source = "return { __proto__:null, " + properties.join(":'',") + ":''}"
let createObject = new Function(source);
let object = createObject();
%HeapObjectVerify(object);
assertFalse(%HasFastProperties(object));
assertEquals(Object.getPrototypeOf(object ), null);
let keys = Object.keys(object);
// modify original object
object['new_property'] = {};
object[1] = 12;
%HeapObjectVerify(object);
let object2 = createObject();
%HeapObjectVerify(object2);
assertFalse(object2 === object);
assertFalse(%HasFastProperties(object2));
assertEquals(Object.getPrototypeOf(object2), null);
assertEquals(keys, Object.keys(object2));
})();
// Test Object literal with large-object elements.
let indices = [];
const max = 0x1ef3e + 100;
for (let i = 0; i < max; i++) {
indices.push(""+i);
}
let source = "return {" + indices.join(":0,") + ":0};"
let largeElementsLiteral = new Function(source);
function TestLargeObjectElements() {
// Corresponds to FixedArray::kMaxRegularLength.
let object = largeElementsLiteral();
%HeapObjectVerify(object);
for (let i = 0; i < max; i++) {
assertEquals(0, object[i]);
}
object[0] = 0xFF;
assertEquals(0xFF, object[0]);
object[1] = 1.23;
assertEquals(1.23, object[1]);
%HeapObjectVerify(object);
}
TestLargeObjectElements();
TestLargeObjectElements();
TestLargeObjectElements();
%OptimizeFunctionOnNextCall(TestLargeObjectElements);
TestLargeObjectElements();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment