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

Side by Side Diff: src/objects.cc

Issue 1995453002: [stubs] Extend HasProperty stub with dictionary-mode and double-elements objects support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing and cleanup Created 4 years, 6 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 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 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 11087 matching lines...) Expand 10 before | Expand all | Expand 10 after
11098 // be zero. 11098 // be zero.
11099 DCHECK(length > 0); 11099 DCHECK(length > 0);
11100 DCHECK(length <= String::kMaxArrayIndexSize); 11100 DCHECK(length <= String::kMaxArrayIndexSize);
11101 DCHECK(TenToThe(String::kMaxCachedArrayIndexLength) < 11101 DCHECK(TenToThe(String::kMaxCachedArrayIndexLength) <
11102 (1 << String::kArrayIndexValueBits)); 11102 (1 << String::kArrayIndexValueBits));
11103 11103
11104 value <<= String::ArrayIndexValueBits::kShift; 11104 value <<= String::ArrayIndexValueBits::kShift;
11105 value |= length << String::ArrayIndexLengthBits::kShift; 11105 value |= length << String::ArrayIndexLengthBits::kShift;
11106 11106
11107 DCHECK((value & String::kIsNotArrayIndexMask) == 0); 11107 DCHECK((value & String::kIsNotArrayIndexMask) == 0);
11108 DCHECK((length > String::kMaxCachedArrayIndexLength) || 11108 DCHECK_EQ(length <= String::kMaxCachedArrayIndexLength,
11109 (value & String::kContainsCachedArrayIndexMask) == 0); 11109 (value & String::kContainsCachedArrayIndexMask) == 0);
11110 return value; 11110 return value;
11111 } 11111 }
11112 11112
11113 11113
11114 uint32_t StringHasher::GetHashField() { 11114 uint32_t StringHasher::GetHashField() {
11115 if (length_ <= String::kMaxHashCalcLength) { 11115 if (length_ <= String::kMaxHashCalcLength) {
11116 if (is_array_index_) { 11116 if (is_array_index_) {
11117 return MakeArrayIndexHash(array_index_, length_); 11117 return MakeArrayIndexHash(array_index_, length_);
11118 } 11118 }
11119 return (GetHashCore(raw_running_hash_) << String::kHashShift) | 11119 return (GetHashCore(raw_running_hash_) << String::kHashShift) |
(...skipping 4009 matching lines...) Expand 10 before | Expand all | Expand 10 after
15129 os << "\n "; 15129 os << "\n ";
15130 if (k->IsString()) { 15130 if (k->IsString()) {
15131 String::cast(k)->StringPrint(os); 15131 String::cast(k)->StringPrint(os);
15132 } else { 15132 } else {
15133 os << Brief(k); 15133 os << Brief(k);
15134 } 15134 }
15135 os << ": " << Brief(this->ValueAt(i)) << " " << this->DetailsAt(i); 15135 os << ": " << Brief(this->ValueAt(i)) << " " << this->DetailsAt(i);
15136 } 15136 }
15137 } 15137 }
15138 } 15138 }
15139 template <typename Derived, typename Shape, typename Key>
15140 void Dictionary<Derived, Shape, Key>::Print() {
15141 OFStream os(stdout);
15142 Print(os);
15143 }
15139 #endif 15144 #endif
15140 15145
15141 15146
15142 template<typename Derived, typename Shape, typename Key> 15147 template<typename Derived, typename Shape, typename Key>
15143 void Dictionary<Derived, Shape, Key>::CopyValuesTo(FixedArray* elements) { 15148 void Dictionary<Derived, Shape, Key>::CopyValuesTo(FixedArray* elements) {
15144 int pos = 0; 15149 int pos = 0;
15145 int capacity = this->Capacity(); 15150 int capacity = this->Capacity();
15146 DisallowHeapAllocation no_gc; 15151 DisallowHeapAllocation no_gc;
15147 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc); 15152 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
15148 for (int i = 0; i < capacity; i++) { 15153 for (int i = 0; i < capacity; i++) {
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
15860 // EnsureCapacity will guarantee the hash table is never full. 15865 // EnsureCapacity will guarantee the hash table is never full.
15861 uint32_t capacity = this->Capacity(); 15866 uint32_t capacity = this->Capacity();
15862 uint32_t entry = Derived::FirstProbe(key->Hash(), capacity); 15867 uint32_t entry = Derived::FirstProbe(key->Hash(), capacity);
15863 uint32_t count = 1; 15868 uint32_t count = 1;
15864 15869
15865 while (true) { 15870 while (true) {
15866 int index = Derived::EntryToIndex(entry); 15871 int index = Derived::EntryToIndex(entry);
15867 Object* element = this->get(index); 15872 Object* element = this->get(index);
15868 if (element->IsUndefined()) break; // Empty entry. 15873 if (element->IsUndefined()) break; // Empty entry.
15869 if (*key == element) return entry; 15874 if (*key == element) return entry;
15870 if (!element->IsUniqueName() && 15875 DCHECK(element->IsTheHole() || element->IsUniqueName());
15871 !element->IsTheHole() &&
15872 Name::cast(element)->Equals(*key)) {
15873 // Replace a key that is a non-internalized string by the equivalent
15874 // internalized string for faster further lookups.
15875 this->set(index, *key);
15876 return entry;
15877 }
15878 DCHECK(element->IsTheHole() || !Name::cast(element)->Equals(*key));
15879 entry = Derived::NextProbe(entry, count++, capacity); 15876 entry = Derived::NextProbe(entry, count++, capacity);
15880 } 15877 }
15881 return Derived::kNotFound; 15878 return Derived::kNotFound;
15882 } 15879 }
15883 15880
15884 15881
15885 template<typename Derived, typename Shape, typename Key> 15882 template<typename Derived, typename Shape, typename Key>
15886 void HashTable<Derived, Shape, Key>::Rehash( 15883 void HashTable<Derived, Shape, Key>::Rehash(
15887 Handle<Derived> new_table, 15884 Handle<Derived> new_table,
15888 Key key) { 15885 Key key) {
(...skipping 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after
18552 if (cell->value() != *new_value) { 18549 if (cell->value() != *new_value) {
18553 cell->set_value(*new_value); 18550 cell->set_value(*new_value);
18554 Isolate* isolate = cell->GetIsolate(); 18551 Isolate* isolate = cell->GetIsolate();
18555 cell->dependent_code()->DeoptimizeDependentCodeGroup( 18552 cell->dependent_code()->DeoptimizeDependentCodeGroup(
18556 isolate, DependentCode::kPropertyCellChangedGroup); 18553 isolate, DependentCode::kPropertyCellChangedGroup);
18557 } 18554 }
18558 } 18555 }
18559 18556
18560 } // namespace internal 18557 } // namespace internal
18561 } // namespace v8 18558 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('j') | test/cctest/test-code-stub-assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698