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

Side by Side Diff: src/code-stub-assembler.h

Issue 2504403005: [stubs] KeyedStoreGeneric: inline dictionary property stores (Closed)
Patch Set: nits Created 4 years 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/builtins/builtins-regexp.cc ('k') | src/code-stub-assembler.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #ifndef V8_CODE_STUB_ASSEMBLER_H_ 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_
6 #define V8_CODE_STUB_ASSEMBLER_H_ 6 #define V8_CODE_STUB_ASSEMBLER_H_
7 7
8 #include <functional> 8 #include <functional>
9 9
10 #include "src/compiler/code-assembler.h" 10 #include "src/compiler/code-assembler.h"
11 #include "src/globals.h" 11 #include "src/globals.h"
12 #include "src/objects.h" 12 #include "src/objects.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 16
17 class CallInterfaceDescriptor; 17 class CallInterfaceDescriptor;
18 class StatsCounter; 18 class StatsCounter;
19 class StubCache; 19 class StubCache;
20 20
21 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; 21 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
22 22
23 #define HEAP_CONSTANT_LIST(V) \ 23 #define HEAP_CONSTANT_LIST(V) \
24 V(BooleanMap, BooleanMap) \ 24 V(AccessorPairMap, AccessorPairMap) \
25 V(CodeMap, CodeMap) \ 25 V(BooleanMap, BooleanMap) \
26 V(empty_string, EmptyString) \ 26 V(CodeMap, CodeMap) \
27 V(EmptyFixedArray, EmptyFixedArray) \ 27 V(empty_string, EmptyString) \
28 V(FalseValue, False) \ 28 V(EmptyFixedArray, EmptyFixedArray) \
29 V(FixedArrayMap, FixedArrayMap) \ 29 V(FalseValue, False) \
30 V(FixedCOWArrayMap, FixedCOWArrayMap) \ 30 V(FixedArrayMap, FixedArrayMap) \
31 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \ 31 V(FixedCOWArrayMap, FixedCOWArrayMap) \
32 V(HeapNumberMap, HeapNumberMap) \ 32 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \
33 V(MinusZeroValue, MinusZero) \ 33 V(FunctionTemplateInfoMap, FunctionTemplateInfoMap) \
34 V(NanValue, Nan) \ 34 V(HeapNumberMap, HeapNumberMap) \
35 V(NullValue, Null) \ 35 V(MinusZeroValue, MinusZero) \
36 V(TheHoleValue, TheHole) \ 36 V(NanValue, Nan) \
37 V(TrueValue, True) \ 37 V(NullValue, Null) \
38 V(TheHoleValue, TheHole) \
39 V(TrueValue, True) \
38 V(UndefinedValue, Undefined) 40 V(UndefinedValue, Undefined)
39 41
40 // Provides JavaScript-specific "macro-assembler" functionality on top of the 42 // Provides JavaScript-specific "macro-assembler" functionality on top of the
41 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, 43 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler,
42 // it's possible to add JavaScript-specific useful CodeAssembler "macros" 44 // it's possible to add JavaScript-specific useful CodeAssembler "macros"
43 // without modifying files in the compiler directory (and requiring a review 45 // without modifying files in the compiler directory (and requiring a review
44 // from a compiler directory OWNER). 46 // from a compiler directory OWNER).
45 class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { 47 class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
46 public: 48 public:
47 CodeStubAssembler(compiler::CodeAssemblerState* state) 49 CodeStubAssembler(compiler::CodeAssemblerState* state)
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 compiler::Node* object, compiler::Node* offset, compiler::Node* value, 352 compiler::Node* object, compiler::Node* offset, compiler::Node* value,
351 MachineRepresentation rep = MachineRepresentation::kTagged); 353 MachineRepresentation rep = MachineRepresentation::kTagged);
352 // Store the Map of an HeapObject. 354 // Store the Map of an HeapObject.
353 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, 355 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object,
354 compiler::Node* map); 356 compiler::Node* map);
355 compiler::Node* StoreObjectFieldRoot(compiler::Node* object, int offset, 357 compiler::Node* StoreObjectFieldRoot(compiler::Node* object, int offset,
356 Heap::RootListIndex root); 358 Heap::RootListIndex root);
357 // Store an array element to a FixedArray. 359 // Store an array element to a FixedArray.
358 compiler::Node* StoreFixedArrayElement( 360 compiler::Node* StoreFixedArrayElement(
359 compiler::Node* object, int index, compiler::Node* value, 361 compiler::Node* object, int index, compiler::Node* value,
360 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, 362 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER) {
361 ParameterMode parameter_mode = INTEGER_PARAMETERS) { 363 return StoreFixedArrayElement(object, IntPtrConstant(index), value,
362 return StoreFixedArrayElement(object, Int32Constant(index), value, 364 barrier_mode, 0, INTPTR_PARAMETERS);
363 barrier_mode, parameter_mode);
364 } 365 }
365 366
366 compiler::Node* StoreFixedArrayElement( 367 compiler::Node* StoreFixedArrayElement(
367 compiler::Node* object, compiler::Node* index, compiler::Node* value, 368 compiler::Node* object, compiler::Node* index, compiler::Node* value,
368 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, 369 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
370 int additional_offset = 0,
369 ParameterMode parameter_mode = INTEGER_PARAMETERS); 371 ParameterMode parameter_mode = INTEGER_PARAMETERS);
370 372
371 compiler::Node* StoreFixedDoubleArrayElement( 373 compiler::Node* StoreFixedDoubleArrayElement(
372 compiler::Node* object, compiler::Node* index, compiler::Node* value, 374 compiler::Node* object, compiler::Node* index, compiler::Node* value,
373 ParameterMode parameter_mode = INTEGER_PARAMETERS); 375 ParameterMode parameter_mode = INTEGER_PARAMETERS);
374 376
375 void StoreFieldsNoWriteBarrier(compiler::Node* start_address, 377 void StoreFieldsNoWriteBarrier(compiler::Node* start_address,
376 compiler::Node* end_address, 378 compiler::Node* end_address,
377 compiler::Node* value); 379 compiler::Node* value);
378 380
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // See Dictionary::EntryToIndex(). 757 // See Dictionary::EntryToIndex().
756 template <typename Dictionary> 758 template <typename Dictionary>
757 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index); 759 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index);
758 template <typename Dictionary> 760 template <typename Dictionary>
759 compiler::Node* EntryToIndex(compiler::Node* entry) { 761 compiler::Node* EntryToIndex(compiler::Node* entry) {
760 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); 762 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex);
761 } 763 }
762 // Calculate a valid size for the a hash table. 764 // Calculate a valid size for the a hash table.
763 compiler::Node* HashTableComputeCapacity(compiler::Node* at_least_space_for); 765 compiler::Node* HashTableComputeCapacity(compiler::Node* at_least_space_for);
764 766
767 template <class Dictionary>
768 compiler::Node* GetNumberOfElements(compiler::Node* dictionary);
769
770 template <class Dictionary>
771 void SetNumberOfElements(compiler::Node* dictionary,
772 compiler::Node* num_elements_smi);
773
774 template <class Dictionary>
775 compiler::Node* GetCapacity(compiler::Node* dictionary);
776
777 template <class Dictionary>
778 compiler::Node* GetNextEnumerationIndex(compiler::Node* dictionary);
779
780 template <class Dictionary>
781 void SetNextEnumerationIndex(compiler::Node* dictionary,
782 compiler::Node* next_enum_index_smi);
783
765 // Looks up an entry in a NameDictionaryBase successor. If the entry is found 784 // Looks up an entry in a NameDictionaryBase successor. If the entry is found
766 // control goes to {if_found} and {var_name_index} contains an index of the 785 // control goes to {if_found} and {var_name_index} contains an index of the
767 // key field of the entry found. If the key is not found control goes to 786 // key field of the entry found. If the key is not found control goes to
768 // {if_not_found}. 787 // {if_not_found}.
769 static const int kInlinedDictionaryProbes = 4; 788 static const int kInlinedDictionaryProbes = 4;
789 enum LookupMode { kFindExisting, kFindInsertionIndex };
770 template <typename Dictionary> 790 template <typename Dictionary>
771 void NameDictionaryLookup(compiler::Node* dictionary, 791 void NameDictionaryLookup(compiler::Node* dictionary,
772 compiler::Node* unique_name, Label* if_found, 792 compiler::Node* unique_name, Label* if_found,
773 Variable* var_name_index, Label* if_not_found, 793 Variable* var_name_index, Label* if_not_found,
774 int inlined_probes = kInlinedDictionaryProbes); 794 int inlined_probes = kInlinedDictionaryProbes,
795 LookupMode mode = kFindExisting);
775 796
776 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); 797 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed);
777 798
778 template <typename Dictionary> 799 template <typename Dictionary>
779 void NumberDictionaryLookup(compiler::Node* dictionary, 800 void NumberDictionaryLookup(compiler::Node* dictionary,
780 compiler::Node* intptr_index, Label* if_found, 801 compiler::Node* intptr_index, Label* if_found,
781 Variable* var_entry, Label* if_not_found); 802 Variable* var_entry, Label* if_not_found);
782 803
804 template <class Dictionary>
805 void FindInsertionEntry(compiler::Node* dictionary, compiler::Node* key,
806 Variable* var_key_index);
807
808 template <class Dictionary>
809 void InsertEntry(compiler::Node* dictionary, compiler::Node* key,
810 compiler::Node* value, compiler::Node* index,
811 compiler::Node* enum_index);
812
813 template <class Dictionary>
814 void Add(compiler::Node* dictionary, compiler::Node* key,
815 compiler::Node* value, Label* bailout);
816
783 // Tries to check if {object} has own {unique_name} property. 817 // Tries to check if {object} has own {unique_name} property.
784 void TryHasOwnProperty(compiler::Node* object, compiler::Node* map, 818 void TryHasOwnProperty(compiler::Node* object, compiler::Node* map,
785 compiler::Node* instance_type, 819 compiler::Node* instance_type,
786 compiler::Node* unique_name, Label* if_found, 820 compiler::Node* unique_name, Label* if_found,
787 Label* if_not_found, Label* if_bailout); 821 Label* if_not_found, Label* if_bailout);
788 822
789 // Tries to get {object}'s own {unique_name} property value. If the property 823 // Tries to get {object}'s own {unique_name} property value. If the property
790 // is an accessor then it also calls a getter. If the property is a double 824 // is an accessor then it also calls a getter. If the property is a double
791 // field it re-wraps value in an immutable heap number. 825 // field it re-wraps value in an immutable heap number.
792 void TryGetOwnProperty(compiler::Node* context, compiler::Node* receiver, 826 void TryGetOwnProperty(compiler::Node* context, compiler::Node* receiver,
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 } 1209 }
1176 #else 1210 #else
1177 #define CSA_SLOW_ASSERT(csa, x) ((void)0) 1211 #define CSA_SLOW_ASSERT(csa, x) ((void)0)
1178 #endif 1212 #endif
1179 1213
1180 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 1214 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
1181 1215
1182 } // namespace internal 1216 } // namespace internal
1183 } // namespace v8 1217 } // namespace v8
1184 #endif // V8_CODE_STUB_ASSEMBLER_H_ 1218 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-regexp.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698