Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: test/cctest/test-elements-kind.cc

Issue 1479543002: [proxies] Implement [[Delete]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(jochen): Remove this after the setting is turned on globally. 5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi, 307 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
308 NONE) 308 NONE)
309 .Check(); 309 .Check();
310 // no change in elements_kind => no map transition 310 // no change in elements_kind => no map transition
311 CHECK_EQ(array->map(), *previous_map); 311 CHECK_EQ(array->map(), *previous_map);
312 CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS); 312 CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS);
313 CHECK_EQ(1, Smi::cast(array->length())->value()); 313 CHECK_EQ(1, Smi::cast(array->length())->value());
314 314
315 // `delete array[0]` does not alter length, but changes the elments_kind 315 // `delete array[0]` does not alter length, but changes the elments_kind
316 name = MakeString("0"); 316 name = MakeString("0");
317 JSReceiver::DeletePropertyOrElement(array, name).Check(); 317 CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
318 CHECK_NE(array->map(), *previous_map); 318 CHECK_NE(array->map(), *previous_map);
319 CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_SMI_ELEMENTS); 319 CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_SMI_ELEMENTS);
320 CHECK_EQ(1, Smi::cast(array->length())->value()); 320 CHECK_EQ(1, Smi::cast(array->length())->value());
321 previous_map = handle(array->map()); 321 previous_map = handle(array->map());
322 322
323 // add a couple of elements again 323 // add a couple of elements again
324 name = MakeString("0"); 324 name = MakeString("0");
325 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi, 325 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
326 NONE) 326 NONE)
327 .Check(); 327 .Check();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi, 380 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
381 NONE) 381 NONE)
382 .Check(); 382 .Check();
383 // no change in elements_kind => no map transition 383 // no change in elements_kind => no map transition
384 CHECK_EQ(array->map(), *previous_map); 384 CHECK_EQ(array->map(), *previous_map);
385 CHECK_EQ(array->map()->elements_kind(), FAST_ELEMENTS); 385 CHECK_EQ(array->map()->elements_kind(), FAST_ELEMENTS);
386 CHECK_EQ(1, Smi::cast(array->length())->value()); 386 CHECK_EQ(1, Smi::cast(array->length())->value());
387 387
388 // `delete array[0]` does not alter length, but changes the elments_kind 388 // `delete array[0]` does not alter length, but changes the elments_kind
389 name = MakeString("0"); 389 name = MakeString("0");
390 JSReceiver::DeletePropertyOrElement(array, name).Check(); 390 CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
391 CHECK_NE(array->map(), *previous_map); 391 CHECK_NE(array->map(), *previous_map);
392 CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS); 392 CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
393 CHECK_EQ(1, Smi::cast(array->length())->value()); 393 CHECK_EQ(1, Smi::cast(array->length())->value());
394 previous_map = handle(array->map()); 394 previous_map = handle(array->map());
395 395
396 // add a couple of elements, elements_kind stays HOLEY 396 // add a couple of elements, elements_kind stays HOLEY
397 name = MakeString("0"); 397 name = MakeString("0");
398 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_string, 398 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_string,
399 NONE) 399 NONE)
400 .Check(); 400 .Check();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 name = MakeString("1"); 437 name = MakeString("1");
438 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi, 438 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
439 NONE) 439 NONE)
440 .Check(); 440 .Check();
441 CHECK_EQ(array->map(), *previous_map); 441 CHECK_EQ(array->map(), *previous_map);
442 CHECK_EQ(array->map()->elements_kind(), FAST_DOUBLE_ELEMENTS); 442 CHECK_EQ(array->map()->elements_kind(), FAST_DOUBLE_ELEMENTS);
443 CHECK_EQ(2, Smi::cast(array->length())->value()); 443 CHECK_EQ(2, Smi::cast(array->length())->value());
444 444
445 // `delete array[0]` does not alter length, but changes the elments_kind 445 // `delete array[0]` does not alter length, but changes the elments_kind
446 name = MakeString("0"); 446 name = MakeString("0");
447 JSReceiver::DeletePropertyOrElement(array, name).Check(); 447 CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
448 CHECK_NE(array->map(), *previous_map); 448 CHECK_NE(array->map(), *previous_map);
449 CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_DOUBLE_ELEMENTS); 449 CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_DOUBLE_ELEMENTS);
450 CHECK_EQ(2, Smi::cast(array->length())->value()); 450 CHECK_EQ(2, Smi::cast(array->length())->value());
451 previous_map = handle(array->map()); 451 previous_map = handle(array->map());
452 452
453 // filling the hole `array[0] = value_smi` again doesn't transition back 453 // filling the hole `array[0] = value_smi` again doesn't transition back
454 name = MakeString("0"); 454 name = MakeString("0");
455 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double, 455 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double,
456 NONE) 456 NONE)
457 .Check(); 457 .Check();
(...skipping 11 matching lines...) Expand all
469 CHECK_EQ(2, Smi::cast(array->length())->value()); 469 CHECK_EQ(2, Smi::cast(array->length())->value());
470 previous_map = handle(array->map()); 470 previous_map = handle(array->map());
471 471
472 // Adding a double doesn't change the map 472 // Adding a double doesn't change the map
473 name = MakeString("0"); 473 name = MakeString("0");
474 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double, 474 JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double,
475 NONE) 475 NONE)
476 .Check(); 476 .Check();
477 CHECK_EQ(array->map(), *previous_map); 477 CHECK_EQ(array->map(), *previous_map);
478 } 478 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698