summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-10-31 16:06:17 +0100
committerMichaël Zasso <targos@protonmail.com>2019-11-08 15:53:34 +0100
commit186f15771c7a83d32c9589b7ff8f055b318c9589 (patch)
tree278f870d00af0970298f1929887017c6c9e21383 /deps
parenta9bed0b72b088b5ae8eef625a41b76225686c3f7 (diff)
downloadandroid-node-v8-186f15771c7a83d32c9589b7ff8f055b318c9589.tar.gz
android-node-v8-186f15771c7a83d32c9589b7ff8f055b318c9589.tar.bz2
android-node-v8-186f15771c7a83d32c9589b7ff8f055b318c9589.zip
deps: V8: backport 5e755c6ee6d3
Original commit message: [objects] Move functions to inline headers This moves a series of functions from dictionary.h and hash-table.h to resp. dictionary-inl.h and hash-table-inl.h. The functions that were moved all somehow use other functions that are defined in -inl.h files. This change fixes the Node.js Windows builds. Change-Id: I0bbf0222beb3619a5e6f1fb451bc78691025de65 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1893346 Reviewed-by: Peter Marshall <petermarshall@chromium.org> Commit-Queue: Michaël Zasso <mic.besace@gmail.com> Cr-Commit-Position: refs/heads/master@{#64709} Refs: https://github.com/v8/v8/commit/5e755c6ee6d3ab81b2f6daf2f0b04418f91fed9b PR-URL: https://github.com/nodejs/node/pull/30020 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r--deps/v8/src/objects/dictionary-inl.h73
-rw-r--r--deps/v8/src/objects/dictionary.h57
-rw-r--r--deps/v8/src/objects/hash-table-inl.h22
-rw-r--r--deps/v8/src/objects/hash-table.h18
4 files changed, 109 insertions, 61 deletions
diff --git a/deps/v8/src/objects/dictionary-inl.h b/deps/v8/src/objects/dictionary-inl.h
index 92c1d0940f..18b2ee67a4 100644
--- a/deps/v8/src/objects/dictionary-inl.h
+++ b/deps/v8/src/objects/dictionary-inl.h
@@ -7,8 +7,10 @@
#include "src/objects/dictionary.h"
+#include "src/execution/isolate-utils-inl.h"
#include "src/numbers/hash-seed-inl.h"
#include "src/objects/hash-table-inl.h"
+#include "src/objects/objects-inl.h"
#include "src/objects/oddball.h"
#include "src/objects/property-cell-inl.h"
@@ -28,9 +30,61 @@ Dictionary<Derived, Shape>::Dictionary(Address ptr)
: HashTable<Derived, Shape>(ptr) {}
template <typename Derived, typename Shape>
+Object Dictionary<Derived, Shape>::ValueAt(int entry) {
+ Isolate* isolate = GetIsolateForPtrCompr(*this);
+ return ValueAt(isolate, entry);
+}
+
+template <typename Derived, typename Shape>
+Object Dictionary<Derived, Shape>::ValueAt(Isolate* isolate, int entry) {
+ return this->get(isolate, DerivedHashTable::EntryToIndex(entry) + 1);
+}
+
+template <typename Derived, typename Shape>
+void Dictionary<Derived, Shape>::ValueAtPut(int entry, Object value) {
+ this->set(DerivedHashTable::EntryToIndex(entry) + 1, value);
+}
+
+template <typename Derived, typename Shape>
+PropertyDetails Dictionary<Derived, Shape>::DetailsAt(int entry) {
+ return Shape::DetailsAt(Derived::cast(*this), entry);
+}
+
+template <typename Derived, typename Shape>
+void Dictionary<Derived, Shape>::DetailsAtPut(Isolate* isolate, int entry,
+ PropertyDetails value) {
+ Shape::DetailsAtPut(isolate, Derived::cast(*this), entry, value);
+}
+
+template <typename Derived, typename Shape>
BaseNameDictionary<Derived, Shape>::BaseNameDictionary(Address ptr)
: Dictionary<Derived, Shape>(ptr) {}
+template <typename Derived, typename Shape>
+void BaseNameDictionary<Derived, Shape>::SetNextEnumerationIndex(int index) {
+ DCHECK_NE(0, index);
+ this->set(kNextEnumerationIndexIndex, Smi::FromInt(index));
+}
+
+template <typename Derived, typename Shape>
+int BaseNameDictionary<Derived, Shape>::NextEnumerationIndex() {
+ return Smi::ToInt(this->get(kNextEnumerationIndexIndex));
+}
+
+template <typename Derived, typename Shape>
+void BaseNameDictionary<Derived, Shape>::SetHash(int hash) {
+ DCHECK(PropertyArray::HashField::is_valid(hash));
+ this->set(kObjectHashIndex, Smi::FromInt(hash));
+}
+
+template <typename Derived, typename Shape>
+int BaseNameDictionary<Derived, Shape>::Hash() const {
+ Object hash_obj = this->get(kObjectHashIndex);
+ int hash = Smi::ToInt(hash_obj);
+ DCHECK(PropertyArray::HashField::is_valid(hash));
+ return hash;
+}
+
GlobalDictionary::GlobalDictionary(Address ptr)
: BaseNameDictionary<GlobalDictionary, GlobalDictionaryShape>(ptr) {
SLOW_DCHECK(IsGlobalDictionary());
@@ -90,6 +144,25 @@ void Dictionary<Derived, Shape>::SetEntry(Isolate* isolate, int entry,
if (Shape::kHasDetails) DetailsAtPut(isolate, entry, details);
}
+template <typename Key>
+template <typename Dictionary>
+PropertyDetails BaseDictionaryShape<Key>::DetailsAt(Dictionary dict,
+ int entry) {
+ STATIC_ASSERT(Dictionary::kEntrySize == 3);
+ DCHECK_GE(entry, 0); // Not found is -1, which is not caught by get().
+ return PropertyDetails(Smi::cast(dict.get(Dictionary::EntryToIndex(entry) +
+ Dictionary::kEntryDetailsIndex)));
+}
+
+template <typename Key>
+template <typename Dictionary>
+void BaseDictionaryShape<Key>::DetailsAtPut(Isolate* isolate, Dictionary dict,
+ int entry, PropertyDetails value) {
+ STATIC_ASSERT(Dictionary::kEntrySize == 3);
+ dict.set(Dictionary::EntryToIndex(entry) + Dictionary::kEntryDetailsIndex,
+ value.AsSmi());
+ }
+
Object GlobalDictionaryShape::Unwrap(Object object) {
return PropertyCell::cast(object).name();
}
diff --git a/deps/v8/src/objects/dictionary.h b/deps/v8/src/objects/dictionary.h
index 957c06d8ec..35137c7d94 100644
--- a/deps/v8/src/objects/dictionary.h
+++ b/deps/v8/src/objects/dictionary.h
@@ -31,28 +31,17 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) Dictionary
public:
using Key = typename Shape::Key;
// Returns the value at entry.
- Object ValueAt(int entry) {
- Isolate* isolate = GetIsolateForPtrCompr(*this);
- return ValueAt(isolate, entry);
- }
- Object ValueAt(Isolate* isolate, int entry) {
- return this->get(isolate, DerivedHashTable::EntryToIndex(entry) + 1);
- }
+ inline Object ValueAt(int entry);
+ inline Object ValueAt(Isolate* isolate, int entry);
// Set the value for entry.
- void ValueAtPut(int entry, Object value) {
- this->set(DerivedHashTable::EntryToIndex(entry) + 1, value);
- }
+ inline void ValueAtPut(int entry, Object value);
// Returns the property details for the property at entry.
- PropertyDetails DetailsAt(int entry) {
- return Shape::DetailsAt(Derived::cast(*this), entry);
- }
+ inline PropertyDetails DetailsAt(int entry);
// Set the details for entry.
- void DetailsAtPut(Isolate* isolate, int entry, PropertyDetails value) {
- Shape::DetailsAtPut(isolate, Derived::cast(*this), entry, value);
- }
+ inline void DetailsAtPut(Isolate* isolate, int entry, PropertyDetails value);
// Delete a property from the dictionary.
V8_WARN_UNUSED_RESULT static Handle<Derived> DeleteEntry(
@@ -100,20 +89,11 @@ class BaseDictionaryShape : public BaseShape<Key> {
public:
static const bool kHasDetails = true;
template <typename Dictionary>
- static inline PropertyDetails DetailsAt(Dictionary dict, int entry) {
- STATIC_ASSERT(Dictionary::kEntrySize == 3);
- DCHECK_GE(entry, 0); // Not found is -1, which is not caught by get().
- return PropertyDetails(Smi::cast(dict.get(Dictionary::EntryToIndex(entry) +
- Dictionary::kEntryDetailsIndex)));
- }
+ static inline PropertyDetails DetailsAt(Dictionary dict, int entry);
template <typename Dictionary>
static inline void DetailsAtPut(Isolate* isolate, Dictionary dict, int entry,
- PropertyDetails value) {
- STATIC_ASSERT(Dictionary::kEntrySize == 3);
- dict.set(Dictionary::EntryToIndex(entry) + Dictionary::kEntryDetailsIndex,
- value.AsSmi());
- }
+ PropertyDetails value);
};
class NameDictionaryShape : public BaseDictionaryShape<Handle<Name>> {
@@ -141,26 +121,11 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) BaseNameDictionary
static const int kEntryValueIndex = 1;
// Accessors for next enumeration index.
- void SetNextEnumerationIndex(int index) {
- DCHECK_NE(0, index);
- this->set(kNextEnumerationIndexIndex, Smi::FromInt(index));
- }
+ inline void SetNextEnumerationIndex(int index);
+ inline int NextEnumerationIndex();
- int NextEnumerationIndex() {
- return Smi::ToInt(this->get(kNextEnumerationIndexIndex));
- }
-
- void SetHash(int hash) {
- DCHECK(PropertyArray::HashField::is_valid(hash));
- this->set(kObjectHashIndex, Smi::FromInt(hash));
- }
-
- int Hash() const {
- Object hash_obj = this->get(kObjectHashIndex);
- int hash = Smi::ToInt(hash_obj);
- DCHECK(PropertyArray::HashField::is_valid(hash));
- return hash;
- }
+ inline void SetHash(int hash);
+ inline int Hash() const;
// Creates a new dictionary.
V8_WARN_UNUSED_RESULT static Handle<Derived> New(
diff --git a/deps/v8/src/objects/hash-table-inl.h b/deps/v8/src/objects/hash-table-inl.h
index b807851d85..d4c96f4df4 100644
--- a/deps/v8/src/objects/hash-table-inl.h
+++ b/deps/v8/src/objects/hash-table-inl.h
@@ -7,6 +7,7 @@
#include "src/objects/hash-table.h"
+#include "src/execution/isolate-utils-inl.h"
#include "src/heap/heap.h"
#include "src/objects/fixed-array-inl.h"
#include "src/objects/heap-object-inl.h"
@@ -179,6 +180,17 @@ bool HashTable<Derived, Shape>::ToKey(Isolate* isolate, int entry,
}
template <typename Derived, typename Shape>
+Object HashTable<Derived, Shape>::KeyAt(int entry) {
+ Isolate* isolate = GetIsolateForPtrCompr(*this);
+ return KeyAt(isolate, entry);
+}
+
+template <typename Derived, typename Shape>
+Object HashTable<Derived, Shape>::KeyAt(Isolate* isolate, int entry) {
+ return get(isolate, EntryToIndex(entry) + kEntryKeyIndex);
+}
+
+template <typename Derived, typename Shape>
void HashTable<Derived, Shape>::set_key(int index, Object value) {
DCHECK(!IsEphemeronHashTable());
FixedArray::set(index, value);
@@ -191,6 +203,16 @@ void HashTable<Derived, Shape>::set_key(int index, Object value,
FixedArray::set(index, value, mode);
}
+template <typename Derived, typename Shape>
+void HashTable<Derived, Shape>::SetCapacity(int capacity) {
+ // To scale a computed hash code to fit within the hash table, we
+ // use bit-wise AND with a mask, so the capacity must be positive
+ // and non-zero.
+ DCHECK_GT(capacity, 0);
+ DCHECK_LE(capacity, kMaxCapacity);
+ set(kCapacityIndex, Smi::FromInt(capacity));
+}
+
template <typename KeyT>
bool BaseShape<KeyT>::IsKey(ReadOnlyRoots roots, Object key) {
return IsLive(roots, key);
diff --git a/deps/v8/src/objects/hash-table.h b/deps/v8/src/objects/hash-table.h
index ed2c645f82..5cdeb0c0ec 100644
--- a/deps/v8/src/objects/hash-table.h
+++ b/deps/v8/src/objects/hash-table.h
@@ -164,13 +164,8 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) HashTable
inline bool ToKey(Isolate* isolate, int entry, Object* out_k);
// Returns the key at entry.
- Object KeyAt(int entry) {
- Isolate* isolate = GetIsolateForPtrCompr(*this);
- return KeyAt(isolate, entry);
- }
- Object KeyAt(Isolate* isolate, int entry) {
- return get(isolate, EntryToIndex(entry) + kEntryKeyIndex);
- }
+ inline Object KeyAt(int entry);
+ inline Object KeyAt(Isolate* isolate, int entry);
static const int kElementsStartIndex = kPrefixStartIndex + Shape::kPrefixSize;
static const int kEntrySize = Shape::kEntrySize;
@@ -239,14 +234,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) HashTable
kMaxRegularHeapObjectSize);
// Sets the capacity of the hash table.
- void SetCapacity(int capacity) {
- // To scale a computed hash code to fit within the hash table, we
- // use bit-wise AND with a mask, so the capacity must be positive
- // and non-zero.
- DCHECK_GT(capacity, 0);
- DCHECK_LE(capacity, kMaxCapacity);
- set(kCapacityIndex, Smi::FromInt(capacity));
- }
+ inline void SetCapacity(int capacity);
// Returns _expected_ if one of entries given by the first _probe_ probes is
// equal to _expected_. Otherwise, returns the entry given by the probe