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

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: Drive-by fix: replace Load()s with LoadObjectField()s 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
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('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 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 11278 matching lines...) Expand 10 before | Expand all | Expand 10 after
11289 // be zero. 11289 // be zero.
11290 DCHECK(length > 0); 11290 DCHECK(length > 0);
11291 DCHECK(length <= String::kMaxArrayIndexSize); 11291 DCHECK(length <= String::kMaxArrayIndexSize);
11292 DCHECK(TenToThe(String::kMaxCachedArrayIndexLength) < 11292 DCHECK(TenToThe(String::kMaxCachedArrayIndexLength) <
11293 (1 << String::kArrayIndexValueBits)); 11293 (1 << String::kArrayIndexValueBits));
11294 11294
11295 value <<= String::ArrayIndexValueBits::kShift; 11295 value <<= String::ArrayIndexValueBits::kShift;
11296 value |= length << String::ArrayIndexLengthBits::kShift; 11296 value |= length << String::ArrayIndexLengthBits::kShift;
11297 11297
11298 DCHECK((value & String::kIsNotArrayIndexMask) == 0); 11298 DCHECK((value & String::kIsNotArrayIndexMask) == 0);
11299 DCHECK((length > String::kMaxCachedArrayIndexLength) || 11299 DCHECK_EQ(length <= String::kMaxCachedArrayIndexLength,
11300 (value & String::kContainsCachedArrayIndexMask) == 0); 11300 (value & String::kContainsCachedArrayIndexMask) == 0);
11301 return value; 11301 return value;
11302 } 11302 }
11303 11303
11304 11304
11305 uint32_t StringHasher::GetHashField() { 11305 uint32_t StringHasher::GetHashField() {
11306 if (length_ <= String::kMaxHashCalcLength) { 11306 if (length_ <= String::kMaxHashCalcLength) {
11307 if (is_array_index_) { 11307 if (is_array_index_) {
11308 return MakeArrayIndexHash(array_index_, length_); 11308 return MakeArrayIndexHash(array_index_, length_);
11309 } 11309 }
11310 return (GetHashCore(raw_running_hash_) << String::kHashShift) | 11310 return (GetHashCore(raw_running_hash_) << String::kHashShift) |
(...skipping 4009 matching lines...) Expand 10 before | Expand all | Expand 10 after
15320 os << "\n "; 15320 os << "\n ";
15321 if (k->IsString()) { 15321 if (k->IsString()) {
15322 String::cast(k)->StringPrint(os); 15322 String::cast(k)->StringPrint(os);
15323 } else { 15323 } else {
15324 os << Brief(k); 15324 os << Brief(k);
15325 } 15325 }
15326 os << ": " << Brief(this->ValueAt(i)) << " " << this->DetailsAt(i); 15326 os << ": " << Brief(this->ValueAt(i)) << " " << this->DetailsAt(i);
15327 } 15327 }
15328 } 15328 }
15329 } 15329 }
15330 template <typename Derived, typename Shape, typename Key>
15331 void Dictionary<Derived, Shape, Key>::Print() {
15332 OFStream os(stdout);
15333 Print(os);
15334 }
15330 #endif 15335 #endif
15331 15336
15332 15337
15333 template<typename Derived, typename Shape, typename Key> 15338 template<typename Derived, typename Shape, typename Key>
15334 void Dictionary<Derived, Shape, Key>::CopyValuesTo(FixedArray* elements) { 15339 void Dictionary<Derived, Shape, Key>::CopyValuesTo(FixedArray* elements) {
15335 int pos = 0; 15340 int pos = 0;
15336 int capacity = this->Capacity(); 15341 int capacity = this->Capacity();
15337 DisallowHeapAllocation no_gc; 15342 DisallowHeapAllocation no_gc;
15338 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc); 15343 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
15339 for (int i = 0; i < capacity; i++) { 15344 for (int i = 0; i < capacity; i++) {
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
16051 // EnsureCapacity will guarantee the hash table is never full. 16056 // EnsureCapacity will guarantee the hash table is never full.
16052 uint32_t capacity = this->Capacity(); 16057 uint32_t capacity = this->Capacity();
16053 uint32_t entry = Derived::FirstProbe(key->Hash(), capacity); 16058 uint32_t entry = Derived::FirstProbe(key->Hash(), capacity);
16054 uint32_t count = 1; 16059 uint32_t count = 1;
16055 16060
16056 while (true) { 16061 while (true) {
16057 int index = Derived::EntryToIndex(entry); 16062 int index = Derived::EntryToIndex(entry);
16058 Object* element = this->get(index); 16063 Object* element = this->get(index);
16059 if (element->IsUndefined()) break; // Empty entry. 16064 if (element->IsUndefined()) break; // Empty entry.
16060 if (*key == element) return entry; 16065 if (*key == element) return entry;
16061 if (!element->IsUniqueName() && 16066 DCHECK(element->IsTheHole() || element->IsUniqueName());
16062 !element->IsTheHole() &&
16063 Name::cast(element)->Equals(*key)) {
16064 // Replace a key that is a non-internalized string by the equivalent
16065 // internalized string for faster further lookups.
16066 this->set(index, *key);
16067 return entry;
16068 }
16069 DCHECK(element->IsTheHole() || !Name::cast(element)->Equals(*key));
16070 entry = Derived::NextProbe(entry, count++, capacity); 16067 entry = Derived::NextProbe(entry, count++, capacity);
16071 } 16068 }
16072 return Derived::kNotFound; 16069 return Derived::kNotFound;
16073 } 16070 }
16074 16071
16075 16072
16076 template<typename Derived, typename Shape, typename Key> 16073 template<typename Derived, typename Shape, typename Key>
16077 void HashTable<Derived, Shape, Key>::Rehash( 16074 void HashTable<Derived, Shape, Key>::Rehash(
16078 Handle<Derived> new_table, 16075 Handle<Derived> new_table,
16079 Key key) { 16076 Key key) {
(...skipping 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after
18743 if (cell->value() != *new_value) { 18740 if (cell->value() != *new_value) {
18744 cell->set_value(*new_value); 18741 cell->set_value(*new_value);
18745 Isolate* isolate = cell->GetIsolate(); 18742 Isolate* isolate = cell->GetIsolate();
18746 cell->dependent_code()->DeoptimizeDependentCodeGroup( 18743 cell->dependent_code()->DeoptimizeDependentCodeGroup(
18747 isolate, DependentCode::kPropertyCellChangedGroup); 18744 isolate, DependentCode::kPropertyCellChangedGroup);
18748 } 18745 }
18749 } 18746 }
18750 18747
18751 } // namespace internal 18748 } // namespace internal
18752 } // namespace v8 18749 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698