Commit ca5b896f authored by cbruni's avatar cbruni Committed by Commit bot

[elements] cleaning up string wrapper elements kind and adding tests

drive-by-fix: unify template parameters

BUG=chromium:586068
LOG=n

Review URL: https://codereview.chromium.org/1857163002

Cr-Commit-Position: refs/heads/master@{#35302}
parent 911a5768
This diff is collapsed.
// Copyright 2016 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.
var limit = 10000;
function testStringWrapper(string) {
assertEquals('a', string[0]);
assertEquals('b', string[1]);
assertEquals('c', string[2]);
}
(function testFastStringWrapperGrow() {
var string = new String("abc");
for (var i = 0; i < limit; i += 2) {
string[i] = {};
}
testStringWrapper(string);
for (var i = limit; i > 0; i -= 2) {
delete string[i];
}
testStringWrapper(string);
})();
(function testSlowStringWrapperGrow() {
var string = new String("abc");
// Force Slow String Wrapper Elements Kind
string[limit] = limit;
for (var i = 0; i < limit; i += 2) {
string[i] = {};
}
testStringWrapper(string);
assertEquals(limit, string[limit]);
for (var i = limit; i > 0; i -= 2) {
delete string[i];
}
testStringWrapper(string);
assertEquals(undefined, string[limit]);
})();
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