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

Unified Diff: src/code-stub-assembler.h

Issue 2688573003: [cleanup] CSA: add helpers for accessing details/value via key_index (Closed)
Patch Set: rebased Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins-handler.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.h
diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h
index edc239352b151458f756488065b189da5c43182d..96ec3cd3efa5299418136764fda65f55b44d25af 100644
--- a/src/code-stub-assembler.h
+++ b/src/code-stub-assembler.h
@@ -885,6 +885,49 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* EntryToIndex(Node* entry) {
return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex);
}
+
+ // Loads the details for the entry with the given key_index.
+ // Returns an untagged int32.
+ template <class ContainerType>
+ Node* LoadDetailsByKeyIndex(Node* container, Node* key_index) {
+ const int kKeyToDetailsOffset =
+ (ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) *
+ kPointerSize;
+ return LoadAndUntagToWord32FixedArrayElement(container, key_index,
+ kKeyToDetailsOffset);
+ }
+
+ // Loads the value for the entry with the given key_index.
+ // Returns a tagged value.
+ template <class ContainerType>
+ Node* LoadValueByKeyIndex(Node* container, Node* key_index) {
+ const int kKeyToValueOffset =
+ (ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) *
+ kPointerSize;
+ return LoadFixedArrayElement(container, key_index, kKeyToValueOffset);
+ }
+
+ // Stores the details for the entry with the given key_index.
+ // |details| must be a Smi.
+ template <class ContainerType>
+ void StoreDetailsByKeyIndex(Node* container, Node* key_index, Node* details) {
+ const int kKeyToDetailsOffset =
+ (ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) *
+ kPointerSize;
+ StoreFixedArrayElement(container, key_index, details, SKIP_WRITE_BARRIER,
+ kKeyToDetailsOffset);
+ }
+
+ // Stores the value for the entry with the given key_index.
+ template <class ContainerType>
+ void StoreValueByKeyIndex(Node* container, Node* key_index, Node* value) {
+ const int kKeyToValueOffset =
+ (ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) *
+ kPointerSize;
+ StoreFixedArrayElement(container, key_index, value, UPDATE_WRITE_BARRIER,
+ kKeyToValueOffset);
+ }
+
// Calculate a valid size for the a hash table.
Node* HashTableComputeCapacity(Node* at_least_space_for);
« no previous file with comments | « src/builtins/builtins-handler.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698