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

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: 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
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 // Some mutation to prototype or own elements may have occurred in the
1543 // accessor. 1543 // accessor. If so, bailout to slow path.
1544 if (!JSObject::PrototypeHasNoElements(isolate, *receiver)) { 1544 if (*dictionary != receiver->elements() ||
Camillo Bruni 2016/08/04 15:51:57 as long as we stay in dictionary mode (which is al
caitp 2016/08/04 16:13:06 You're saying the elements kind can't change, so j
caitp 2016/08/04 17:01:58 This seems to be untrue, JSObject::ResetElements()
1545 !JSObject::PrototypeHasNoElements(isolate, *receiver)) {
1545 return IncludesValueSlowPath(isolate, receiver, value, k + 1, 1546 return IncludesValueSlowPath(isolate, receiver, value, k + 1,
1546 length); 1547 length);
1547 } 1548 }
1548 break; 1549 break;
1549 } 1550 }
1550 } 1551 }
1551 } 1552 }
1552 return Just(false); 1553 return Just(false);
1553 } 1554 }
1554 }; 1555 };
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
3443 insertion_index += len; 3444 insertion_index += len;
3444 } 3445 }
3445 3446
3446 DCHECK_EQ(insertion_index, result_len); 3447 DCHECK_EQ(insertion_index, result_len);
3447 return result_array; 3448 return result_array;
3448 } 3449 }
3449 3450
3450 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 3451 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
3451 } // namespace internal 3452 } // namespace internal
3452 } // namespace v8 3453 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es7/regress/regress-634273.js » ('j') | test/mjsunit/es7/regress/regress-634273.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698