19258b6bc66e09368ada54001f619d53b4fc976d5ager@chromium.org// Copyright 2008 the V8 project authors. All rights reserved. 29a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Redistribution and use in source and binary forms, with or without 39a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// modification, are permitted provided that the following conditions are 49a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// met: 59a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// 69a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Redistributions of source code must retain the above copyright 79a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// notice, this list of conditions and the following disclaimer. 89a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Redistributions in binary form must reproduce the above 99a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// copyright notice, this list of conditions and the following 109a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// disclaimer in the documentation and/or other materials provided 119a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// with the distribution. 129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Neither the name of Google Inc. nor the names of its 139a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// contributors may be used to endorse or promote products derived 149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// from this software without specific prior written permission. 159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// 169a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 189a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 199a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 209a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 219a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 229a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 239a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 249a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 259a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 269a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 279a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 289a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// This test attempts to test the inline caching for keyed access. 299a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 309a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 319a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Prototype accessor. 329a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 339a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comvar runTest = function() { 349a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var initial_P = 'prototype'; 359a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var P = initial_P; 369a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var H = 'hasOwnProperty'; 379a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 389a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var f = function() {}; 399a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 409a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com function prototypeTest(change_index) { 419a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) { 429a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var property = f[P]; 439a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i <= change_index) { 449a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(f.prototype, property); 459a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } else { 469a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(f.hasOwnProperty, property); 479a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 489a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i == change_index) P = H; 499a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 509a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com P = initial_P; 519a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 529a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 539a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) prototypeTest(i); 549a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 559a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com f.prototype = 43; 569a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 579a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) prototypeTest(i); 589a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 599a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 609a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest(); 619a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 629a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 639a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Array length accessor. 649a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 659a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest = function() { 669a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var initial_L = 'length'; 679a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var L = initial_L; 689a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var zero = '0'; 699a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 709a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var a = new Array(10); 719a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 729a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com function arrayLengthTest(change_index) { 739a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) { 749a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var l = a[L]; 759a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i <= change_index) { 769a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(10, l); 779a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } else { 789a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(undefined, l); 799a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 809a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i == change_index) L = zero; 819a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 829a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com L = initial_L; 839a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 849a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 859a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) arrayLengthTest(i); 869a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 879a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 889a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest(); 899a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 909a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 919a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// String length accessor. 929a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 939a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest = function() { 949a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var initial_L = 'length'; 959a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var L = initial_L; 969a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var zero = '0'; 979a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 989a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var s = "asdf" 999a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1009a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com function stringLengthTest(change_index) { 1019a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) { 1029a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var l = s[L]; 1039a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i <= change_index) { 1049a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(4, l); 1059a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } else { 1069a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals('a', l); 1079a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1089a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i == change_index) L = zero; 1099a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1109a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com L = initial_L; 1119a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1139a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) stringLengthTest(i); 1149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 1159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1169a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest(); 1179a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1189a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 1199a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Field access. 1209a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 1219a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest = function() { 1229a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var o = { x: 42, y: 43 } 1239a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1249a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var initial_X = 'x'; 1259a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var X = initial_X; 1269a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var Y = 'y'; 1279a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1289a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com function fieldTest(change_index) { 1299a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) { 1309a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var property = o[X]; 1319a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i <= change_index) { 1329a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(42, property); 1339a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } else { 1349a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(43, property); 1359a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1369a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i == change_index) X = Y; 1379a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1389a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com X = initial_X; 1399a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com }; 1409a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1419a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) fieldTest(i); 1429a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 1439a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1449a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest(); 1459a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1469a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1479a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 14865dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org// Indexed access. 14965dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org// ---------------------------------------------------------------------- 15065dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.orgrunTest = function() { 15165dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org var o = [ 42, 43 ]; 15265dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org 15365dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org var initial_X = 0; 15465dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org var X = initial_X; 15565dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org var Y = 1; 15665dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org 15765dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org function fieldTest(change_index) { 15865dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org for (var i = 0; i < 10; i++) { 15965dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org var property = o[X]; 16065dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org if (i <= change_index) { 16165dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org assertEquals(42, property); 16265dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org } else { 16365dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org assertEquals(43, property); 16465dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org } 16565dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org if (i == change_index) X = Y; 16665dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org } 16765dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org X = initial_X; 16865dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org }; 16965dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org 17065dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org for (var i = 0; i < 10; i++) fieldTest(i); 17165dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org} 17265dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org 17365dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.orgrunTest(); 17465dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org 17565dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org 17665dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org// ---------------------------------------------------------------------- 1779a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Constant function access. 1789a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 1799a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest = function() { 1809a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com function fun() { }; 1819a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1829a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var o = new Object(); 1839a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com o.f = fun; 1849a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com o.x = 42; 1859a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1869a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var initial_F = 'f'; 1879a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var F = initial_F; 1889a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var X = 'x' 1899a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1909a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com function constantFunctionTest(change_index) { 1919a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) { 1929a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var property = o[F]; 1939a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i <= change_index) { 1949a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(fun, property); 1959a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } else { 1969a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(42, property); 1979a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1989a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i == change_index) F = X; 1999a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 2009a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com F = initial_F; 2019a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com }; 2029a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 2039a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) constantFunctionTest(i); 2049a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 2059a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 2069a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest(); 2079a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 2089a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 2099a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Keyed store field. 2109a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// ---------------------------------------------------------------------- 2119a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 2129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest = function() { 2139a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var o = { x: 42, y: 43 } 2149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 2159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var initial_X = 'x'; 2169a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var X = initial_X; 2179a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var Y = 'y'; 2189a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 2199a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com function fieldTest(change_index) { 2209a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) { 2219a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com o[X] = X; 2229a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var property = o[X]; 2239a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i <= change_index) { 2249a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals('x', property); 2259a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } else { 2269a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals('y', property); 2279a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 2289a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (i == change_index) X = Y; 2299a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 2309a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com X = initial_X; 2319a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com }; 2329a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 2339a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < 10; i++) fieldTest(i); 2349a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 2359a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 2369a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comrunTest(); 237