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

Side by Side Diff: src/elements.cc

Issue 2212963002: [elements] update Dictionary in IncludesValue if own elements change (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add test for other related failure Created 4 years, 4 months 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
« no previous file with comments | « no previous file | test/mjsunit/es7/regress/regress-634273.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/elements.h" 5 #include "src/elements.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 SeededNumberDictionary::cast(receiver->elements()), isolate); 1512 SeededNumberDictionary::cast(receiver->elements()), isolate);
1513 // Iterate through entire range, as accessing elements out of order is 1513 // Iterate through entire range, as accessing elements out of order is
1514 // observable 1514 // observable
1515 for (uint32_t k = start_from; k < length; ++k) { 1515 for (uint32_t k = start_from; k < length; ++k) {
1516 int entry = dictionary->FindEntry(k); 1516 int entry = dictionary->FindEntry(k);
1517 if (entry == SeededNumberDictionary::kNotFound) { 1517 if (entry == SeededNumberDictionary::kNotFound) {
1518 if (search_for_hole) return Just(true); 1518 if (search_for_hole) return Just(true);
1519 continue; 1519 continue;
1520 } 1520 }
1521 1521
1522 PropertyDetails details = GetDetailsImpl(receiver->elements(), entry); 1522 PropertyDetails details = GetDetailsImpl(*dictionary, entry);
1523 switch (details.kind()) { 1523 switch (details.kind()) {
1524 case kData: { 1524 case kData: {
1525 Object* element_k = dictionary->ValueAt(entry); 1525 Object* element_k = dictionary->ValueAt(entry);
1526 if (value->SameValueZero(element_k)) return Just(true); 1526 if (value->SameValueZero(element_k)) return Just(true);
1527 break; 1527 break;
1528 } 1528 }
1529 case kAccessor: { 1529 case kAccessor: {
1530 LookupIterator it(isolate, receiver, k, 1530 LookupIterator it(isolate, receiver, k,
1531 LookupIterator::OWN_SKIP_INTERCEPTOR); 1531 LookupIterator::OWN_SKIP_INTERCEPTOR);
1532 DCHECK(it.IsFound()); 1532 DCHECK(it.IsFound());
1533 DCHECK_EQ(it.state(), LookupIterator::ACCESSOR); 1533 DCHECK_EQ(it.state(), LookupIterator::ACCESSOR);
1534 Handle<Object> element_k; 1534 Handle<Object> element_k;
1535 1535
1536 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 1536 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
1537 isolate, element_k, JSObject::GetPropertyWithAccessor(&it), 1537 isolate, element_k, JSObject::GetPropertyWithAccessor(&it),
1538 Nothing<bool>()); 1538 Nothing<bool>());
1539 1539
1540 if (value->SameValueZero(*element_k)) return Just(true); 1540 if (value->SameValueZero(*element_k)) return Just(true);
1541 1541
1542 // Some mutation to the prototype elements may have occurred in 1542 // Bailout to slow path if elements on prototype changed
1543 // accessor.
1544 if (!JSObject::PrototypeHasNoElements(isolate, *receiver)) { 1543 if (!JSObject::PrototypeHasNoElements(isolate, *receiver)) {
1545 return IncludesValueSlowPath(isolate, receiver, value, k + 1, 1544 return IncludesValueSlowPath(isolate, receiver, value, k + 1,
1546 length); 1545 length);
1547 } 1546 }
1547
1548 // Continue if elements unchanged
1549 if (*dictionary == receiver->elements()) continue;
1550
1551 // Otherwise, bailout or update elements
1552 if (receiver->GetElementsKind() != DICTIONARY_ELEMENTS) {
1553 if (receiver->map()->GetInitialElements() == receiver->elements()) {
1554 // If switched to initial elements, return true if searching for
1555 // undefined, and false otherwise.
1556 return Just(search_for_hole);
1557 }
1558 // Otherwise, switch to slow path.
1559 return IncludesValueSlowPath(isolate, receiver, value, k + 1,
1560 length);
1561 }
1562 dictionary = handle(
1563 SeededNumberDictionary::cast(receiver->elements()), isolate);
1548 break; 1564 break;
1549 } 1565 }
1550 } 1566 }
1551 } 1567 }
1552 return Just(false); 1568 return Just(false);
1553 } 1569 }
1554 }; 1570 };
1555 1571
1556 1572
1557 // Super class for all fast element arrays. 1573 // Super class for all fast element arrays.
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 insertion_index += len; 3465 insertion_index += len;
3450 } 3466 }
3451 3467
3452 DCHECK_EQ(insertion_index, result_len); 3468 DCHECK_EQ(insertion_index, result_len);
3453 return result_array; 3469 return result_array;
3454 } 3470 }
3455 3471
3456 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 3472 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
3457 } // namespace internal 3473 } // namespace internal
3458 } // namespace v8 3474 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es7/regress/regress-634273.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698