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

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

Issue 2430273007: [runtime] Object.create(null) creates a slow object (Closed)
Patch Set: fix GC mole issue Created 4 years, 1 month 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-object.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"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 compiler::Node* HashSeed(); 102 compiler::Node* HashSeed();
103 compiler::Node* StaleRegisterConstant(); 103 compiler::Node* StaleRegisterConstant();
104 104
105 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); 105 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode);
106 106
107 compiler::Node* IntPtrAddFoldConstants(compiler::Node* left, 107 compiler::Node* IntPtrAddFoldConstants(compiler::Node* left,
108 compiler::Node* right); 108 compiler::Node* right);
109 compiler::Node* IntPtrSubFoldConstants(compiler::Node* left, 109 compiler::Node* IntPtrSubFoldConstants(compiler::Node* left,
110 compiler::Node* right); 110 compiler::Node* right);
111 // Round the 32bits payload of the provided word up to the next power of two.
112 compiler::Node* IntPtrRoundUpToPowerOfTwo32(compiler::Node* value);
113 compiler::Node* IntPtrMax(compiler::Node* left, compiler::Node* right);
111 114
112 // Float64 operations. 115 // Float64 operations.
113 compiler::Node* Float64Ceil(compiler::Node* x); 116 compiler::Node* Float64Ceil(compiler::Node* x);
114 compiler::Node* Float64Floor(compiler::Node* x); 117 compiler::Node* Float64Floor(compiler::Node* x);
115 compiler::Node* Float64Round(compiler::Node* x); 118 compiler::Node* Float64Round(compiler::Node* x);
116 compiler::Node* Float64Trunc(compiler::Node* x); 119 compiler::Node* Float64Trunc(compiler::Node* x);
117 120
118 // Tag a Word as a Smi value. 121 // Tag a Word as a Smi value.
119 compiler::Node* SmiTag(compiler::Node* value); 122 compiler::Node* SmiTag(compiler::Node* value);
120 // Untag a Smi value as a Word. 123 // Untag a Smi value as a Word.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 163
161 void Assert(compiler::Node* condition, const char* string = nullptr, 164 void Assert(compiler::Node* condition, const char* string = nullptr,
162 const char* file = nullptr, int line = 0); 165 const char* file = nullptr, int line = 0);
163 166
164 // Check a value for smi-ness 167 // Check a value for smi-ness
165 compiler::Node* TaggedIsSmi(compiler::Node* a); 168 compiler::Node* TaggedIsSmi(compiler::Node* a);
166 // Check that the value is a non-negative smi. 169 // Check that the value is a non-negative smi.
167 compiler::Node* WordIsPositiveSmi(compiler::Node* a); 170 compiler::Node* WordIsPositiveSmi(compiler::Node* a);
168 // Check that a word has a word-aligned address. 171 // Check that a word has a word-aligned address.
169 compiler::Node* WordIsWordAligned(compiler::Node* word); 172 compiler::Node* WordIsWordAligned(compiler::Node* word);
173 compiler::Node* WordIsPowerOfTwo(compiler::Node* value);
170 174
171 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, 175 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true,
172 Label* if_false) { 176 Label* if_false) {
173 Branch(SmiEqual(a, b), if_true, if_false); 177 Branch(SmiEqual(a, b), if_true, if_false);
174 } 178 }
175 179
176 void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true, 180 void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true,
177 Label* if_false) { 181 Label* if_false) {
178 Branch(SmiLessThan(a, b), if_true, if_false); 182 Branch(SmiLessThan(a, b), if_true, if_false);
179 } 183 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // Load the inobject properties count of a Map (valid only for JSObjects). 283 // Load the inobject properties count of a Map (valid only for JSObjects).
280 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); 284 compiler::Node* LoadMapInobjectProperties(compiler::Node* map);
281 // Load the constructor function index of a Map (only for primitive maps). 285 // Load the constructor function index of a Map (only for primitive maps).
282 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); 286 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map);
283 // Load the constructor of a Map (equivalent to Map::GetConstructor()). 287 // Load the constructor of a Map (equivalent to Map::GetConstructor()).
284 compiler::Node* LoadMapConstructor(compiler::Node* map); 288 compiler::Node* LoadMapConstructor(compiler::Node* map);
285 // Check whether the map is for an object with special properties, such as a 289 // Check whether the map is for an object with special properties, such as a
286 // JSProxy or an object with interceptors. 290 // JSProxy or an object with interceptors.
287 compiler::Node* IsSpecialReceiverMap(compiler::Node* map); 291 compiler::Node* IsSpecialReceiverMap(compiler::Node* map);
288 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); 292 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type);
293 // Check if the map is set for slow properties.
294 compiler::Node* IsDictionaryMap(compiler::Node* map);
289 295
290 // Load the hash field of a name as an uint32 value. 296 // Load the hash field of a name as an uint32 value.
291 compiler::Node* LoadNameHashField(compiler::Node* name); 297 compiler::Node* LoadNameHashField(compiler::Node* name);
292 // Load the hash value of a name as an uint32 value. 298 // Load the hash value of a name as an uint32 value.
293 // If {if_hash_not_computed} label is specified then it also checks if 299 // If {if_hash_not_computed} label is specified then it also checks if
294 // hash is actually computed. 300 // hash is actually computed.
295 compiler::Node* LoadNameHash(compiler::Node* name, 301 compiler::Node* LoadNameHash(compiler::Node* name,
296 Label* if_hash_not_computed = nullptr); 302 Label* if_hash_not_computed = nullptr);
297 303
298 // Load length field of a String object. 304 // Load length field of a String object.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 compiler::Node* StoreObjectFieldNoWriteBarrier( 359 compiler::Node* StoreObjectFieldNoWriteBarrier(
354 compiler::Node* object, compiler::Node* offset, compiler::Node* value, 360 compiler::Node* object, compiler::Node* offset, compiler::Node* value,
355 MachineRepresentation rep = MachineRepresentation::kTagged); 361 MachineRepresentation rep = MachineRepresentation::kTagged);
356 // Store the Map of an HeapObject. 362 // Store the Map of an HeapObject.
357 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, 363 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object,
358 compiler::Node* map); 364 compiler::Node* map);
359 compiler::Node* StoreObjectFieldRoot(compiler::Node* object, int offset, 365 compiler::Node* StoreObjectFieldRoot(compiler::Node* object, int offset,
360 Heap::RootListIndex root); 366 Heap::RootListIndex root);
361 // Store an array element to a FixedArray. 367 // Store an array element to a FixedArray.
362 compiler::Node* StoreFixedArrayElement( 368 compiler::Node* StoreFixedArrayElement(
369 compiler::Node* object, int index, compiler::Node* value,
370 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
371 ParameterMode parameter_mode = INTEGER_PARAMETERS) {
372 return StoreFixedArrayElement(object, Int32Constant(index), value,
373 barrier_mode, parameter_mode);
374 }
375
376 compiler::Node* StoreFixedArrayElement(
363 compiler::Node* object, compiler::Node* index, compiler::Node* value, 377 compiler::Node* object, compiler::Node* index, compiler::Node* value,
364 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, 378 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
365 ParameterMode parameter_mode = INTEGER_PARAMETERS); 379 ParameterMode parameter_mode = INTEGER_PARAMETERS);
366 380
367 compiler::Node* StoreFixedDoubleArrayElement( 381 compiler::Node* StoreFixedDoubleArrayElement(
368 compiler::Node* object, compiler::Node* index, compiler::Node* value, 382 compiler::Node* object, compiler::Node* index, compiler::Node* value,
369 ParameterMode parameter_mode = INTEGER_PARAMETERS); 383 ParameterMode parameter_mode = INTEGER_PARAMETERS);
370 384
371 void StoreFieldsNoWriteBarrier(compiler::Node* start_address, 385 void StoreFieldsNoWriteBarrier(compiler::Node* start_address,
372 compiler::Node* end_address, 386 compiler::Node* end_address,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 438
425 // Allocate a RegExpResult with the given length (the number of captures, 439 // Allocate a RegExpResult with the given length (the number of captures,
426 // including the match itself), index (the index where the match starts), 440 // including the match itself), index (the index where the match starts),
427 // and input string. |length| and |index| are expected to be tagged, and 441 // and input string. |length| and |index| are expected to be tagged, and
428 // |input| must be a string. 442 // |input| must be a string.
429 compiler::Node* AllocateRegExpResult(compiler::Node* context, 443 compiler::Node* AllocateRegExpResult(compiler::Node* context,
430 compiler::Node* length, 444 compiler::Node* length,
431 compiler::Node* index, 445 compiler::Node* index,
432 compiler::Node* input); 446 compiler::Node* input);
433 447
448 compiler::Node* AllocateNameDictionary(int capacity);
449 compiler::Node* AllocateNameDictionary(compiler::Node* capacity);
450
434 compiler::Node* AllocateJSObjectFromMap(compiler::Node* map, 451 compiler::Node* AllocateJSObjectFromMap(compiler::Node* map,
435 compiler::Node* properties = nullptr, 452 compiler::Node* properties = nullptr,
436 compiler::Node* elements = nullptr); 453 compiler::Node* elements = nullptr);
437 454
438 void InitializeJSObjectFromMap(compiler::Node* object, compiler::Node* map, 455 void InitializeJSObjectFromMap(compiler::Node* object, compiler::Node* map,
439 compiler::Node* size, 456 compiler::Node* size,
440 compiler::Node* properties = nullptr, 457 compiler::Node* properties = nullptr,
441 compiler::Node* elements = nullptr); 458 compiler::Node* elements = nullptr);
442 459
443 void InitializeJSObjectBody(compiler::Node* object, compiler::Node* map, 460 void InitializeJSObjectBody(compiler::Node* object, compiler::Node* map,
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 Label* if_keyisunique, Label* if_bailout); 732 Label* if_keyisunique, Label* if_bailout);
716 733
717 // Calculates array index for given dictionary entry and entry field. 734 // Calculates array index for given dictionary entry and entry field.
718 // See Dictionary::EntryToIndex(). 735 // See Dictionary::EntryToIndex().
719 template <typename Dictionary> 736 template <typename Dictionary>
720 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index); 737 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index);
721 template <typename Dictionary> 738 template <typename Dictionary>
722 compiler::Node* EntryToIndex(compiler::Node* entry) { 739 compiler::Node* EntryToIndex(compiler::Node* entry) {
723 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); 740 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex);
724 } 741 }
742 // Calculate a valid size for the a hash table.
743 compiler::Node* HashTableComputeCapacity(compiler::Node* at_least_space_for);
725 744
726 // Looks up an entry in a NameDictionaryBase successor. If the entry is found 745 // Looks up an entry in a NameDictionaryBase successor. If the entry is found
727 // control goes to {if_found} and {var_name_index} contains an index of the 746 // control goes to {if_found} and {var_name_index} contains an index of the
728 // key field of the entry found. If the key is not found control goes to 747 // key field of the entry found. If the key is not found control goes to
729 // {if_not_found}. 748 // {if_not_found}.
730 static const int kInlinedDictionaryProbes = 4; 749 static const int kInlinedDictionaryProbes = 4;
731 template <typename Dictionary> 750 template <typename Dictionary>
732 void NameDictionaryLookup(compiler::Node* dictionary, 751 void NameDictionaryLookup(compiler::Node* dictionary,
733 compiler::Node* unique_name, Label* if_found, 752 compiler::Node* unique_name, Label* if_found,
734 Variable* var_name_index, Label* if_not_found, 753 Variable* var_name_index, Label* if_not_found,
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 static const int kElementLoopUnrollThreshold = 8; 1144 static const int kElementLoopUnrollThreshold = 8;
1126 }; 1145 };
1127 1146
1128 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) 1147 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__)
1129 1148
1130 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 1149 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
1131 1150
1132 } // namespace internal 1151 } // namespace internal
1133 } // namespace v8 1152 } // namespace v8
1134 #endif // V8_CODE_STUB_ASSEMBLER_H_ 1153 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-object.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698