OLD | NEW |
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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex); | 151 return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex); |
152 } | 152 } |
153 | 153 |
154 Node* CodeStubAssembler::StaleRegisterConstant() { | 154 Node* CodeStubAssembler::StaleRegisterConstant() { |
155 return LoadRoot(Heap::kStaleRegisterRootIndex); | 155 return LoadRoot(Heap::kStaleRegisterRootIndex); |
156 } | 156 } |
157 | 157 |
158 Node* CodeStubAssembler::IntPtrOrSmiConstant(int value, ParameterMode mode) { | 158 Node* CodeStubAssembler::IntPtrOrSmiConstant(int value, ParameterMode mode) { |
159 if (mode == SMI_PARAMETERS) { | 159 if (mode == SMI_PARAMETERS) { |
160 return SmiConstant(Smi::FromInt(value)); | 160 return SmiConstant(Smi::FromInt(value)); |
161 } else if (mode == INTPTR_PARAMETERS) { | 161 } else { |
| 162 DCHECK_EQ(INTPTR_PARAMETERS, mode); |
162 return IntPtrConstant(value); | 163 return IntPtrConstant(value); |
163 } else { | |
164 DCHECK_EQ(INTEGER_PARAMETERS, mode); | |
165 return Int32Constant(value); | |
166 } | 164 } |
167 } | 165 } |
168 | 166 |
169 Node* CodeStubAssembler::IntPtrAddFoldConstants(Node* left, Node* right) { | 167 Node* CodeStubAssembler::IntPtrAddFoldConstants(Node* left, Node* right) { |
170 int32_t left_constant; | 168 int32_t left_constant; |
171 bool is_left_constant = ToInt32Constant(left, left_constant); | 169 bool is_left_constant = ToInt32Constant(left, left_constant); |
172 int32_t right_constant; | 170 int32_t right_constant; |
173 bool is_right_constant = ToInt32Constant(right, right_constant); | 171 bool is_right_constant = ToInt32Constant(right, right_constant); |
174 if (is_left_constant) { | 172 if (is_left_constant) { |
175 if (is_right_constant) { | 173 if (is_right_constant) { |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 empty_array); | 1855 empty_array); |
1858 StoreObjectFieldNoWriteBarrier(result, JSArray::kElementsOffset, empty_array); | 1856 StoreObjectFieldNoWriteBarrier(result, JSArray::kElementsOffset, empty_array); |
1859 StoreObjectFieldNoWriteBarrier(result, JSArray::kLengthOffset, length); | 1857 StoreObjectFieldNoWriteBarrier(result, JSArray::kLengthOffset, length); |
1860 | 1858 |
1861 StoreObjectFieldNoWriteBarrier(result, JSRegExpResult::kIndexOffset, index); | 1859 StoreObjectFieldNoWriteBarrier(result, JSRegExpResult::kIndexOffset, index); |
1862 StoreObjectField(result, JSRegExpResult::kInputOffset, input); | 1860 StoreObjectField(result, JSRegExpResult::kInputOffset, input); |
1863 | 1861 |
1864 Node* const zero = IntPtrConstant(0); | 1862 Node* const zero = IntPtrConstant(0); |
1865 Node* const length_intptr = SmiUntag(length); | 1863 Node* const length_intptr = SmiUntag(length); |
1866 const ElementsKind elements_kind = FAST_ELEMENTS; | 1864 const ElementsKind elements_kind = FAST_ELEMENTS; |
1867 const ParameterMode parameter_mode = INTPTR_PARAMETERS; | |
1868 | 1865 |
1869 Node* const elements = | 1866 Node* const elements = AllocateFixedArray(elements_kind, length_intptr); |
1870 AllocateFixedArray(elements_kind, length_intptr, parameter_mode); | |
1871 StoreObjectField(result, JSArray::kElementsOffset, elements); | 1867 StoreObjectField(result, JSArray::kElementsOffset, elements); |
1872 | 1868 |
1873 // Fill in the elements with undefined. | 1869 // Fill in the elements with undefined. |
1874 FillFixedArrayWithValue(elements_kind, elements, zero, length_intptr, | 1870 FillFixedArrayWithValue(elements_kind, elements, zero, length_intptr, |
1875 Heap::kUndefinedValueRootIndex, parameter_mode); | 1871 Heap::kUndefinedValueRootIndex); |
1876 | 1872 |
1877 return result; | 1873 return result; |
1878 } | 1874 } |
1879 | 1875 |
1880 Node* CodeStubAssembler::AllocateNameDictionary(int at_least_space_for) { | 1876 Node* CodeStubAssembler::AllocateNameDictionary(int at_least_space_for) { |
1881 return AllocateNameDictionary(IntPtrConstant(at_least_space_for)); | 1877 return AllocateNameDictionary(IntPtrConstant(at_least_space_for)); |
1882 } | 1878 } |
1883 | 1879 |
1884 Node* CodeStubAssembler::AllocateNameDictionary(Node* at_least_space_for) { | 1880 Node* CodeStubAssembler::AllocateNameDictionary(Node* at_least_space_for) { |
1885 CSA_ASSERT(this, UintPtrLessThanOrEqual( | 1881 CSA_ASSERT(this, UintPtrLessThanOrEqual( |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3158 | 3154 |
3159 // Check if the {code} is a one-byte char code. | 3155 // Check if the {code} is a one-byte char code. |
3160 Label if_codeisonebyte(this), if_codeistwobyte(this, Label::kDeferred), | 3156 Label if_codeisonebyte(this), if_codeistwobyte(this, Label::kDeferred), |
3161 if_done(this); | 3157 if_done(this); |
3162 Branch(Int32LessThanOrEqual(code, Int32Constant(String::kMaxOneByteCharCode)), | 3158 Branch(Int32LessThanOrEqual(code, Int32Constant(String::kMaxOneByteCharCode)), |
3163 &if_codeisonebyte, &if_codeistwobyte); | 3159 &if_codeisonebyte, &if_codeistwobyte); |
3164 Bind(&if_codeisonebyte); | 3160 Bind(&if_codeisonebyte); |
3165 { | 3161 { |
3166 // Load the isolate wide single character string cache. | 3162 // Load the isolate wide single character string cache. |
3167 Node* cache = LoadRoot(Heap::kSingleCharacterStringCacheRootIndex); | 3163 Node* cache = LoadRoot(Heap::kSingleCharacterStringCacheRootIndex); |
| 3164 Node* code_index = ChangeUint32ToWord(code); |
3168 | 3165 |
3169 // Check if we have an entry for the {code} in the single character string | 3166 // Check if we have an entry for the {code} in the single character string |
3170 // cache already. | 3167 // cache already. |
3171 Label if_entryisundefined(this, Label::kDeferred), | 3168 Label if_entryisundefined(this, Label::kDeferred), |
3172 if_entryisnotundefined(this); | 3169 if_entryisnotundefined(this); |
3173 Node* entry = LoadFixedArrayElement(cache, code); | 3170 Node* entry = LoadFixedArrayElement(cache, code_index); |
3174 Branch(WordEqual(entry, UndefinedConstant()), &if_entryisundefined, | 3171 Branch(WordEqual(entry, UndefinedConstant()), &if_entryisundefined, |
3175 &if_entryisnotundefined); | 3172 &if_entryisnotundefined); |
3176 | 3173 |
3177 Bind(&if_entryisundefined); | 3174 Bind(&if_entryisundefined); |
3178 { | 3175 { |
3179 // Allocate a new SeqOneByteString for {code} and store it in the {cache}. | 3176 // Allocate a new SeqOneByteString for {code} and store it in the {cache}. |
3180 Node* result = AllocateSeqOneByteString(1); | 3177 Node* result = AllocateSeqOneByteString(1); |
3181 StoreNoWriteBarrier( | 3178 StoreNoWriteBarrier( |
3182 MachineRepresentation::kWord8, result, | 3179 MachineRepresentation::kWord8, result, |
3183 IntPtrConstant(SeqOneByteString::kHeaderSize - kHeapObjectTag), code); | 3180 IntPtrConstant(SeqOneByteString::kHeaderSize - kHeapObjectTag), code); |
3184 StoreFixedArrayElement(cache, code, result); | 3181 StoreFixedArrayElement(cache, code_index, result); |
3185 var_result.Bind(result); | 3182 var_result.Bind(result); |
3186 Goto(&if_done); | 3183 Goto(&if_done); |
3187 } | 3184 } |
3188 | 3185 |
3189 Bind(&if_entryisnotundefined); | 3186 Bind(&if_entryisnotundefined); |
3190 { | 3187 { |
3191 // Return the entry from the {cache}. | 3188 // Return the entry from the {cache}. |
3192 var_result.Bind(entry); | 3189 var_result.Bind(entry); |
3193 Goto(&if_done); | 3190 Goto(&if_done); |
3194 } | 3191 } |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3767 Node* low = | 3764 Node* low = |
3768 LoadObjectField(argument, HeapNumber::kValueOffset, MachineType::Int32()); | 3765 LoadObjectField(argument, HeapNumber::kValueOffset, MachineType::Int32()); |
3769 Node* high = LoadObjectField(argument, HeapNumber::kValueOffset + kIntSize, | 3766 Node* high = LoadObjectField(argument, HeapNumber::kValueOffset + kIntSize, |
3770 MachineType::Int32()); | 3767 MachineType::Int32()); |
3771 Node* hash = Word32Xor(low, high); | 3768 Node* hash = Word32Xor(low, high); |
3772 hash = ChangeInt32ToIntPtr(hash); | 3769 hash = ChangeInt32ToIntPtr(hash); |
3773 hash = WordShl(hash, one); | 3770 hash = WordShl(hash, one); |
3774 Node* index = WordAnd(hash, SmiUntag(BitcastWordToTagged(mask))); | 3771 Node* index = WordAnd(hash, SmiUntag(BitcastWordToTagged(mask))); |
3775 | 3772 |
3776 // Cache entry's key must be a heap number | 3773 // Cache entry's key must be a heap number |
3777 Node* number_key = | 3774 Node* number_key = LoadFixedArrayElement(number_string_cache, index); |
3778 LoadFixedArrayElement(number_string_cache, index, 0, INTPTR_PARAMETERS); | |
3779 GotoIf(TaggedIsSmi(number_key), &runtime); | 3775 GotoIf(TaggedIsSmi(number_key), &runtime); |
3780 map = LoadMap(number_key); | 3776 map = LoadMap(number_key); |
3781 GotoUnless(IsHeapNumberMap(map), &runtime); | 3777 GotoUnless(IsHeapNumberMap(map), &runtime); |
3782 | 3778 |
3783 // Cache entry's key must match the heap number value we're looking for. | 3779 // Cache entry's key must match the heap number value we're looking for. |
3784 Node* low_compare = LoadObjectField(number_key, HeapNumber::kValueOffset, | 3780 Node* low_compare = LoadObjectField(number_key, HeapNumber::kValueOffset, |
3785 MachineType::Int32()); | 3781 MachineType::Int32()); |
3786 Node* high_compare = LoadObjectField( | 3782 Node* high_compare = LoadObjectField( |
3787 number_key, HeapNumber::kValueOffset + kIntSize, MachineType::Int32()); | 3783 number_key, HeapNumber::kValueOffset + kIntSize, MachineType::Int32()); |
3788 GotoUnless(Word32Equal(low, low_compare), &runtime); | 3784 GotoUnless(Word32Equal(low, low_compare), &runtime); |
3789 GotoUnless(Word32Equal(high, high_compare), &runtime); | 3785 GotoUnless(Word32Equal(high, high_compare), &runtime); |
3790 | 3786 |
3791 // Heap number match, return value fro cache entry. | 3787 // Heap number match, return value fro cache entry. |
3792 IncrementCounter(isolate()->counters()->number_to_string_native(), 1); | 3788 IncrementCounter(isolate()->counters()->number_to_string_native(), 1); |
3793 result.Bind(LoadFixedArrayElement(number_string_cache, index, kPointerSize, | 3789 result.Bind(LoadFixedArrayElement(number_string_cache, index, kPointerSize)); |
3794 INTPTR_PARAMETERS)); | |
3795 Goto(&done); | 3790 Goto(&done); |
3796 | 3791 |
3797 Bind(&runtime); | 3792 Bind(&runtime); |
3798 { | 3793 { |
3799 // No cache entry, go to the runtime. | 3794 // No cache entry, go to the runtime. |
3800 result.Bind(CallRuntime(Runtime::kNumberToString, context, argument)); | 3795 result.Bind(CallRuntime(Runtime::kNumberToString, context, argument)); |
3801 } | 3796 } |
3802 Goto(&done); | 3797 Goto(&done); |
3803 | 3798 |
3804 Bind(&smi); | 3799 Bind(&smi); |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4422 Node* hash = ChangeUint32ToWord(LoadNameHash(unique_name)); | 4417 Node* hash = ChangeUint32ToWord(LoadNameHash(unique_name)); |
4423 | 4418 |
4424 // See Dictionary::FirstProbe(). | 4419 // See Dictionary::FirstProbe(). |
4425 Node* count = IntPtrConstant(0); | 4420 Node* count = IntPtrConstant(0); |
4426 Node* entry = WordAnd(hash, mask); | 4421 Node* entry = WordAnd(hash, mask); |
4427 | 4422 |
4428 for (int i = 0; i < inlined_probes; i++) { | 4423 for (int i = 0; i < inlined_probes; i++) { |
4429 Node* index = EntryToIndex<Dictionary>(entry); | 4424 Node* index = EntryToIndex<Dictionary>(entry); |
4430 var_name_index->Bind(index); | 4425 var_name_index->Bind(index); |
4431 | 4426 |
4432 Node* current = | 4427 Node* current = LoadFixedArrayElement(dictionary, index); |
4433 LoadFixedArrayElement(dictionary, index, 0, INTPTR_PARAMETERS); | |
4434 GotoIf(WordEqual(current, unique_name), if_found); | 4428 GotoIf(WordEqual(current, unique_name), if_found); |
4435 | 4429 |
4436 // See Dictionary::NextProbe(). | 4430 // See Dictionary::NextProbe(). |
4437 count = IntPtrConstant(i + 1); | 4431 count = IntPtrConstant(i + 1); |
4438 entry = WordAnd(IntPtrAdd(entry, count), mask); | 4432 entry = WordAnd(IntPtrAdd(entry, count), mask); |
4439 } | 4433 } |
4440 if (mode == kFindInsertionIndex) { | 4434 if (mode == kFindInsertionIndex) { |
4441 // Appease the variable merging algorithm for "Goto(&loop)" below. | 4435 // Appease the variable merging algorithm for "Goto(&loop)" below. |
4442 var_name_index->Bind(IntPtrConstant(0)); | 4436 var_name_index->Bind(IntPtrConstant(0)); |
4443 } | 4437 } |
4444 | 4438 |
4445 Node* undefined = UndefinedConstant(); | 4439 Node* undefined = UndefinedConstant(); |
4446 Node* the_hole = mode == kFindExisting ? nullptr : TheHoleConstant(); | 4440 Node* the_hole = mode == kFindExisting ? nullptr : TheHoleConstant(); |
4447 | 4441 |
4448 Variable var_count(this, MachineType::PointerRepresentation()); | 4442 Variable var_count(this, MachineType::PointerRepresentation()); |
4449 Variable var_entry(this, MachineType::PointerRepresentation()); | 4443 Variable var_entry(this, MachineType::PointerRepresentation()); |
4450 Variable* loop_vars[] = {&var_count, &var_entry, var_name_index}; | 4444 Variable* loop_vars[] = {&var_count, &var_entry, var_name_index}; |
4451 Label loop(this, 3, loop_vars); | 4445 Label loop(this, 3, loop_vars); |
4452 var_count.Bind(count); | 4446 var_count.Bind(count); |
4453 var_entry.Bind(entry); | 4447 var_entry.Bind(entry); |
4454 Goto(&loop); | 4448 Goto(&loop); |
4455 Bind(&loop); | 4449 Bind(&loop); |
4456 { | 4450 { |
4457 Node* entry = var_entry.value(); | 4451 Node* entry = var_entry.value(); |
4458 | 4452 |
4459 Node* index = EntryToIndex<Dictionary>(entry); | 4453 Node* index = EntryToIndex<Dictionary>(entry); |
4460 var_name_index->Bind(index); | 4454 var_name_index->Bind(index); |
4461 | 4455 |
4462 Node* current = | 4456 Node* current = LoadFixedArrayElement(dictionary, index); |
4463 LoadFixedArrayElement(dictionary, index, 0, INTPTR_PARAMETERS); | |
4464 GotoIf(WordEqual(current, undefined), if_not_found); | 4457 GotoIf(WordEqual(current, undefined), if_not_found); |
4465 if (mode == kFindExisting) { | 4458 if (mode == kFindExisting) { |
4466 GotoIf(WordEqual(current, unique_name), if_found); | 4459 GotoIf(WordEqual(current, unique_name), if_found); |
4467 } else { | 4460 } else { |
4468 DCHECK_EQ(kFindInsertionIndex, mode); | 4461 DCHECK_EQ(kFindInsertionIndex, mode); |
4469 GotoIf(WordEqual(current, the_hole), if_not_found); | 4462 GotoIf(WordEqual(current, the_hole), if_not_found); |
4470 } | 4463 } |
4471 | 4464 |
4472 // See Dictionary::NextProbe(). | 4465 // See Dictionary::NextProbe(). |
4473 Increment(var_count); | 4466 Increment(var_count); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4531 Variable* loop_vars[] = {&var_count, var_entry}; | 4524 Variable* loop_vars[] = {&var_count, var_entry}; |
4532 Label loop(this, 2, loop_vars); | 4525 Label loop(this, 2, loop_vars); |
4533 var_count.Bind(count); | 4526 var_count.Bind(count); |
4534 var_entry->Bind(entry); | 4527 var_entry->Bind(entry); |
4535 Goto(&loop); | 4528 Goto(&loop); |
4536 Bind(&loop); | 4529 Bind(&loop); |
4537 { | 4530 { |
4538 Node* entry = var_entry->value(); | 4531 Node* entry = var_entry->value(); |
4539 | 4532 |
4540 Node* index = EntryToIndex<Dictionary>(entry); | 4533 Node* index = EntryToIndex<Dictionary>(entry); |
4541 Node* current = | 4534 Node* current = LoadFixedArrayElement(dictionary, index); |
4542 LoadFixedArrayElement(dictionary, index, 0, INTPTR_PARAMETERS); | |
4543 GotoIf(WordEqual(current, undefined), if_not_found); | 4535 GotoIf(WordEqual(current, undefined), if_not_found); |
4544 Label next_probe(this); | 4536 Label next_probe(this); |
4545 { | 4537 { |
4546 Label if_currentissmi(this), if_currentisnotsmi(this); | 4538 Label if_currentissmi(this), if_currentisnotsmi(this); |
4547 Branch(TaggedIsSmi(current), &if_currentissmi, &if_currentisnotsmi); | 4539 Branch(TaggedIsSmi(current), &if_currentissmi, &if_currentisnotsmi); |
4548 Bind(&if_currentissmi); | 4540 Bind(&if_currentissmi); |
4549 { | 4541 { |
4550 Node* current_value = SmiUntag(current); | 4542 Node* current_value = SmiUntag(current); |
4551 Branch(WordEqual(current_value, intptr_index), if_found, &next_probe); | 4543 Branch(WordEqual(current_value, intptr_index), if_found, &next_probe); |
4552 } | 4544 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4590 Node* index, Node* enum_index) { | 4582 Node* index, Node* enum_index) { |
4591 UNREACHABLE(); // Use specializations instead. | 4583 UNREACHABLE(); // Use specializations instead. |
4592 } | 4584 } |
4593 | 4585 |
4594 template <> | 4586 template <> |
4595 void CodeStubAssembler::InsertEntry<NameDictionary>(Node* dictionary, | 4587 void CodeStubAssembler::InsertEntry<NameDictionary>(Node* dictionary, |
4596 Node* name, Node* value, | 4588 Node* name, Node* value, |
4597 Node* index, | 4589 Node* index, |
4598 Node* enum_index) { | 4590 Node* enum_index) { |
4599 // Store name and value. | 4591 // Store name and value. |
4600 StoreFixedArrayElement(dictionary, index, name, UPDATE_WRITE_BARRIER, 0, | 4592 StoreFixedArrayElement(dictionary, index, name); |
4601 INTPTR_PARAMETERS); | |
4602 const int kNameToValueOffset = | 4593 const int kNameToValueOffset = |
4603 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * | 4594 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * |
4604 kPointerSize; | 4595 kPointerSize; |
4605 StoreFixedArrayElement(dictionary, index, value, UPDATE_WRITE_BARRIER, | 4596 StoreFixedArrayElement(dictionary, index, value, UPDATE_WRITE_BARRIER, |
4606 kNameToValueOffset, INTPTR_PARAMETERS); | 4597 kNameToValueOffset); |
4607 | 4598 |
4608 // Prepare details of the new property. | 4599 // Prepare details of the new property. |
4609 Variable var_details(this, MachineRepresentation::kTaggedSigned); | 4600 Variable var_details(this, MachineRepresentation::kTaggedSigned); |
4610 const int kInitialIndex = 0; | 4601 const int kInitialIndex = 0; |
4611 PropertyDetails d(NONE, DATA, kInitialIndex, PropertyCellType::kNoCell); | 4602 PropertyDetails d(NONE, DATA, kInitialIndex, PropertyCellType::kNoCell); |
4612 enum_index = | 4603 enum_index = |
4613 SmiShl(enum_index, PropertyDetails::DictionaryStorageField::kShift); | 4604 SmiShl(enum_index, PropertyDetails::DictionaryStorageField::kShift); |
4614 STATIC_ASSERT(kInitialIndex == 0); | 4605 STATIC_ASSERT(kInitialIndex == 0); |
4615 var_details.Bind(SmiOr(SmiConstant(d.AsSmi()), enum_index)); | 4606 var_details.Bind(SmiOr(SmiConstant(d.AsSmi()), enum_index)); |
4616 | 4607 |
4617 // Private names must be marked non-enumerable. | 4608 // Private names must be marked non-enumerable. |
4618 Label not_private(this, &var_details); | 4609 Label not_private(this, &var_details); |
4619 GotoUnless(IsSymbolMap(LoadMap(name)), ¬_private); | 4610 GotoUnless(IsSymbolMap(LoadMap(name)), ¬_private); |
4620 Node* flags = SmiToWord32(LoadObjectField(name, Symbol::kFlagsOffset)); | 4611 Node* flags = SmiToWord32(LoadObjectField(name, Symbol::kFlagsOffset)); |
4621 const int kPrivateMask = 1 << Symbol::kPrivateBit; | 4612 const int kPrivateMask = 1 << Symbol::kPrivateBit; |
4622 GotoUnless(IsSetWord32(flags, kPrivateMask), ¬_private); | 4613 GotoUnless(IsSetWord32(flags, kPrivateMask), ¬_private); |
4623 Node* dont_enum = | 4614 Node* dont_enum = |
4624 SmiShl(SmiConstant(DONT_ENUM), PropertyDetails::AttributesField::kShift); | 4615 SmiShl(SmiConstant(DONT_ENUM), PropertyDetails::AttributesField::kShift); |
4625 var_details.Bind(SmiOr(var_details.value(), dont_enum)); | 4616 var_details.Bind(SmiOr(var_details.value(), dont_enum)); |
4626 Goto(¬_private); | 4617 Goto(¬_private); |
4627 Bind(¬_private); | 4618 Bind(¬_private); |
4628 | 4619 |
4629 // Finally, store the details. | 4620 // Finally, store the details. |
4630 const int kNameToDetailsOffset = | 4621 const int kNameToDetailsOffset = |
4631 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * | 4622 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * |
4632 kPointerSize; | 4623 kPointerSize; |
4633 StoreFixedArrayElement(dictionary, index, var_details.value(), | 4624 StoreFixedArrayElement(dictionary, index, var_details.value(), |
4634 SKIP_WRITE_BARRIER, kNameToDetailsOffset, | 4625 SKIP_WRITE_BARRIER, kNameToDetailsOffset); |
4635 INTPTR_PARAMETERS); | |
4636 } | 4626 } |
4637 | 4627 |
4638 template <> | 4628 template <> |
4639 void CodeStubAssembler::InsertEntry<GlobalDictionary>(Node* dictionary, | 4629 void CodeStubAssembler::InsertEntry<GlobalDictionary>(Node* dictionary, |
4640 Node* key, Node* value, | 4630 Node* key, Node* value, |
4641 Node* index, | 4631 Node* index, |
4642 Node* enum_index) { | 4632 Node* enum_index) { |
4643 UNIMPLEMENTED(); | 4633 UNIMPLEMENTED(); |
4644 } | 4634 } |
4645 | 4635 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4687 | 4677 |
4688 void CodeStubAssembler::DescriptorLookupLinear(Node* unique_name, | 4678 void CodeStubAssembler::DescriptorLookupLinear(Node* unique_name, |
4689 Node* descriptors, Node* nof, | 4679 Node* descriptors, Node* nof, |
4690 Label* if_found, | 4680 Label* if_found, |
4691 Variable* var_name_index, | 4681 Variable* var_name_index, |
4692 Label* if_not_found) { | 4682 Label* if_not_found) { |
4693 Node* first_inclusive = IntPtrConstant(DescriptorArray::ToKeyIndex(0)); | 4683 Node* first_inclusive = IntPtrConstant(DescriptorArray::ToKeyIndex(0)); |
4694 Node* factor = IntPtrConstant(DescriptorArray::kDescriptorSize); | 4684 Node* factor = IntPtrConstant(DescriptorArray::kDescriptorSize); |
4695 Node* last_exclusive = IntPtrAdd(first_inclusive, IntPtrMul(nof, factor)); | 4685 Node* last_exclusive = IntPtrAdd(first_inclusive, IntPtrMul(nof, factor)); |
4696 | 4686 |
4697 BuildFastLoop(MachineType::PointerRepresentation(), last_exclusive, | 4687 BuildFastLoop( |
4698 first_inclusive, | 4688 MachineType::PointerRepresentation(), last_exclusive, first_inclusive, |
4699 [this, descriptors, unique_name, if_found, | 4689 [this, descriptors, unique_name, if_found, |
4700 var_name_index](Node* name_index) { | 4690 var_name_index](Node* name_index) { |
4701 Node* candidate_name = LoadFixedArrayElement( | 4691 Node* candidate_name = LoadFixedArrayElement(descriptors, name_index); |
4702 descriptors, name_index, 0, INTPTR_PARAMETERS); | 4692 var_name_index->Bind(name_index); |
4703 var_name_index->Bind(name_index); | 4693 GotoIf(WordEqual(candidate_name, unique_name), if_found); |
4704 GotoIf(WordEqual(candidate_name, unique_name), if_found); | 4694 }, |
4705 }, | 4695 -DescriptorArray::kDescriptorSize, IndexAdvanceMode::kPre); |
4706 -DescriptorArray::kDescriptorSize, IndexAdvanceMode::kPre); | |
4707 Goto(if_not_found); | 4696 Goto(if_not_found); |
4708 } | 4697 } |
4709 | 4698 |
4710 void CodeStubAssembler::TryLookupProperty( | 4699 void CodeStubAssembler::TryLookupProperty( |
4711 Node* object, Node* map, Node* instance_type, Node* unique_name, | 4700 Node* object, Node* map, Node* instance_type, Node* unique_name, |
4712 Label* if_found_fast, Label* if_found_dict, Label* if_found_global, | 4701 Label* if_found_fast, Label* if_found_dict, Label* if_found_global, |
4713 Variable* var_meta_storage, Variable* var_name_index, Label* if_not_found, | 4702 Variable* var_meta_storage, Variable* var_name_index, Label* if_not_found, |
4714 Label* if_bailout) { | 4703 Label* if_bailout) { |
4715 DCHECK_EQ(MachineRepresentation::kTagged, var_meta_storage->rep()); | 4704 DCHECK_EQ(MachineRepresentation::kTagged, var_meta_storage->rep()); |
4716 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); | 4705 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4810 DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep()); | 4799 DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep()); |
4811 Comment("[ LoadPropertyFromFastObject"); | 4800 Comment("[ LoadPropertyFromFastObject"); |
4812 | 4801 |
4813 const int name_to_details_offset = | 4802 const int name_to_details_offset = |
4814 (DescriptorArray::kDescriptorDetails - DescriptorArray::kDescriptorKey) * | 4803 (DescriptorArray::kDescriptorDetails - DescriptorArray::kDescriptorKey) * |
4815 kPointerSize; | 4804 kPointerSize; |
4816 const int name_to_value_offset = | 4805 const int name_to_value_offset = |
4817 (DescriptorArray::kDescriptorValue - DescriptorArray::kDescriptorKey) * | 4806 (DescriptorArray::kDescriptorValue - DescriptorArray::kDescriptorKey) * |
4818 kPointerSize; | 4807 kPointerSize; |
4819 | 4808 |
4820 Node* details = LoadAndUntagToWord32FixedArrayElement( | 4809 Node* details = LoadAndUntagToWord32FixedArrayElement(descriptors, name_index, |
4821 descriptors, name_index, name_to_details_offset, INTPTR_PARAMETERS); | 4810 name_to_details_offset); |
4822 var_details->Bind(details); | 4811 var_details->Bind(details); |
4823 | 4812 |
4824 Node* location = DecodeWord32<PropertyDetails::LocationField>(details); | 4813 Node* location = DecodeWord32<PropertyDetails::LocationField>(details); |
4825 | 4814 |
4826 Label if_in_field(this), if_in_descriptor(this), done(this); | 4815 Label if_in_field(this), if_in_descriptor(this), done(this); |
4827 Branch(Word32Equal(location, Int32Constant(kField)), &if_in_field, | 4816 Branch(Word32Equal(location, Int32Constant(kField)), &if_in_field, |
4828 &if_in_descriptor); | 4817 &if_in_descriptor); |
4829 Bind(&if_in_field); | 4818 Bind(&if_in_field); |
4830 { | 4819 { |
4831 Node* field_index = | 4820 Node* field_index = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4867 var_double_value.Bind(LoadHeapNumberValue(mutable_heap_number)); | 4856 var_double_value.Bind(LoadHeapNumberValue(mutable_heap_number)); |
4868 } | 4857 } |
4869 Goto(&rebox_double); | 4858 Goto(&rebox_double); |
4870 } | 4859 } |
4871 } | 4860 } |
4872 Bind(&if_backing_store); | 4861 Bind(&if_backing_store); |
4873 { | 4862 { |
4874 Comment("if_backing_store"); | 4863 Comment("if_backing_store"); |
4875 Node* properties = LoadProperties(object); | 4864 Node* properties = LoadProperties(object); |
4876 field_index = IntPtrSub(field_index, inobject_properties); | 4865 field_index = IntPtrSub(field_index, inobject_properties); |
4877 Node* value = | 4866 Node* value = LoadFixedArrayElement(properties, field_index); |
4878 LoadFixedArrayElement(properties, field_index, 0, INTPTR_PARAMETERS); | |
4879 | 4867 |
4880 Label if_double(this), if_tagged(this); | 4868 Label if_double(this), if_tagged(this); |
4881 Branch(Word32NotEqual(representation, | 4869 Branch(Word32NotEqual(representation, |
4882 Int32Constant(Representation::kDouble)), | 4870 Int32Constant(Representation::kDouble)), |
4883 &if_tagged, &if_double); | 4871 &if_tagged, &if_double); |
4884 Bind(&if_tagged); | 4872 Bind(&if_tagged); |
4885 { | 4873 { |
4886 var_value->Bind(value); | 4874 var_value->Bind(value); |
4887 Goto(&done); | 4875 Goto(&done); |
4888 } | 4876 } |
4889 Bind(&if_double); | 4877 Bind(&if_double); |
4890 { | 4878 { |
4891 var_double_value.Bind(LoadHeapNumberValue(value)); | 4879 var_double_value.Bind(LoadHeapNumberValue(value)); |
4892 Goto(&rebox_double); | 4880 Goto(&rebox_double); |
4893 } | 4881 } |
4894 } | 4882 } |
4895 Bind(&rebox_double); | 4883 Bind(&rebox_double); |
4896 { | 4884 { |
4897 Comment("rebox_double"); | 4885 Comment("rebox_double"); |
4898 Node* heap_number = AllocateHeapNumberWithValue(var_double_value.value()); | 4886 Node* heap_number = AllocateHeapNumberWithValue(var_double_value.value()); |
4899 var_value->Bind(heap_number); | 4887 var_value->Bind(heap_number); |
4900 Goto(&done); | 4888 Goto(&done); |
4901 } | 4889 } |
4902 } | 4890 } |
4903 Bind(&if_in_descriptor); | 4891 Bind(&if_in_descriptor); |
4904 { | 4892 { |
4905 Node* value = LoadFixedArrayElement( | 4893 Node* value = |
4906 descriptors, name_index, name_to_value_offset, INTPTR_PARAMETERS); | 4894 LoadFixedArrayElement(descriptors, name_index, name_to_value_offset); |
4907 var_value->Bind(value); | 4895 var_value->Bind(value); |
4908 Goto(&done); | 4896 Goto(&done); |
4909 } | 4897 } |
4910 Bind(&done); | 4898 Bind(&done); |
4911 | 4899 |
4912 Comment("] LoadPropertyFromFastObject"); | 4900 Comment("] LoadPropertyFromFastObject"); |
4913 } | 4901 } |
4914 | 4902 |
4915 void CodeStubAssembler::LoadPropertyFromNameDictionary(Node* dictionary, | 4903 void CodeStubAssembler::LoadPropertyFromNameDictionary(Node* dictionary, |
4916 Node* name_index, | 4904 Node* name_index, |
4917 Variable* var_details, | 4905 Variable* var_details, |
4918 Variable* var_value) { | 4906 Variable* var_value) { |
4919 Comment("LoadPropertyFromNameDictionary"); | 4907 Comment("LoadPropertyFromNameDictionary"); |
4920 CSA_ASSERT(this, IsDictionary(dictionary)); | 4908 CSA_ASSERT(this, IsDictionary(dictionary)); |
4921 const int name_to_details_offset = | 4909 const int name_to_details_offset = |
4922 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * | 4910 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * |
4923 kPointerSize; | 4911 kPointerSize; |
4924 const int name_to_value_offset = | 4912 const int name_to_value_offset = |
4925 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * | 4913 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * |
4926 kPointerSize; | 4914 kPointerSize; |
4927 | 4915 |
4928 Node* details = LoadAndUntagToWord32FixedArrayElement( | 4916 Node* details = LoadAndUntagToWord32FixedArrayElement(dictionary, name_index, |
4929 dictionary, name_index, name_to_details_offset, INTPTR_PARAMETERS); | 4917 name_to_details_offset); |
4930 | 4918 |
4931 var_details->Bind(details); | 4919 var_details->Bind(details); |
4932 var_value->Bind(LoadFixedArrayElement( | 4920 var_value->Bind( |
4933 dictionary, name_index, name_to_value_offset, INTPTR_PARAMETERS)); | 4921 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset)); |
4934 | 4922 |
4935 Comment("] LoadPropertyFromNameDictionary"); | 4923 Comment("] LoadPropertyFromNameDictionary"); |
4936 } | 4924 } |
4937 | 4925 |
4938 void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, | 4926 void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, |
4939 Node* name_index, | 4927 Node* name_index, |
4940 Variable* var_details, | 4928 Variable* var_details, |
4941 Variable* var_value, | 4929 Variable* var_value, |
4942 Label* if_deleted) { | 4930 Label* if_deleted) { |
4943 Comment("[ LoadPropertyFromGlobalDictionary"); | 4931 Comment("[ LoadPropertyFromGlobalDictionary"); |
4944 CSA_ASSERT(this, IsDictionary(dictionary)); | 4932 CSA_ASSERT(this, IsDictionary(dictionary)); |
4945 | 4933 |
4946 const int name_to_value_offset = | 4934 const int name_to_value_offset = |
4947 (GlobalDictionary::kEntryValueIndex - GlobalDictionary::kEntryKeyIndex) * | 4935 (GlobalDictionary::kEntryValueIndex - GlobalDictionary::kEntryKeyIndex) * |
4948 kPointerSize; | 4936 kPointerSize; |
4949 | 4937 |
4950 Node* property_cell = LoadFixedArrayElement( | 4938 Node* property_cell = |
4951 dictionary, name_index, name_to_value_offset, INTPTR_PARAMETERS); | 4939 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset); |
4952 | 4940 |
4953 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); | 4941 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); |
4954 GotoIf(WordEqual(value, TheHoleConstant()), if_deleted); | 4942 GotoIf(WordEqual(value, TheHoleConstant()), if_deleted); |
4955 | 4943 |
4956 var_value->Bind(value); | 4944 var_value->Bind(value); |
4957 | 4945 |
4958 Node* details = LoadAndUntagToWord32ObjectField(property_cell, | 4946 Node* details = LoadAndUntagToWord32ObjectField(property_cell, |
4959 PropertyCell::kDetailsOffset); | 4947 PropertyCell::kDetailsOffset); |
4960 var_details->Bind(details); | 4948 var_details->Bind(details); |
4961 | 4949 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5103 STATIC_ASSERT(arraysize(values) == arraysize(labels)); | 5091 STATIC_ASSERT(arraysize(values) == arraysize(labels)); |
5104 Switch(elements_kind, if_bailout, values, labels, arraysize(values)); | 5092 Switch(elements_kind, if_bailout, values, labels, arraysize(values)); |
5105 | 5093 |
5106 Bind(&if_isobjectorsmi); | 5094 Bind(&if_isobjectorsmi); |
5107 { | 5095 { |
5108 Node* elements = LoadElements(object); | 5096 Node* elements = LoadElements(object); |
5109 Node* length = LoadAndUntagFixedArrayBaseLength(elements); | 5097 Node* length = LoadAndUntagFixedArrayBaseLength(elements); |
5110 | 5098 |
5111 GotoUnless(UintPtrLessThan(intptr_index, length), &if_oob); | 5099 GotoUnless(UintPtrLessThan(intptr_index, length), &if_oob); |
5112 | 5100 |
5113 Node* element = | 5101 Node* element = LoadFixedArrayElement(elements, intptr_index); |
5114 LoadFixedArrayElement(elements, intptr_index, 0, INTPTR_PARAMETERS); | |
5115 Node* the_hole = TheHoleConstant(); | 5102 Node* the_hole = TheHoleConstant(); |
5116 Branch(WordEqual(element, the_hole), if_not_found, if_found); | 5103 Branch(WordEqual(element, the_hole), if_not_found, if_found); |
5117 } | 5104 } |
5118 Bind(&if_isdouble); | 5105 Bind(&if_isdouble); |
5119 { | 5106 { |
5120 Node* elements = LoadElements(object); | 5107 Node* elements = LoadElements(object); |
5121 Node* length = LoadAndUntagFixedArrayBaseLength(elements); | 5108 Node* length = LoadAndUntagFixedArrayBaseLength(elements); |
5122 | 5109 |
5123 GotoUnless(UintPtrLessThan(intptr_index, length), &if_oob); | 5110 GotoUnless(UintPtrLessThan(intptr_index, length), &if_oob); |
5124 | 5111 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5423 int element_size = 1 << element_size_shift; | 5410 int element_size = 1 << element_size_shift; |
5424 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; | 5411 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; |
5425 intptr_t index = 0; | 5412 intptr_t index = 0; |
5426 bool constant_index = false; | 5413 bool constant_index = false; |
5427 if (mode == SMI_PARAMETERS) { | 5414 if (mode == SMI_PARAMETERS) { |
5428 element_size_shift -= kSmiShiftBits; | 5415 element_size_shift -= kSmiShiftBits; |
5429 Smi* smi_index; | 5416 Smi* smi_index; |
5430 constant_index = ToSmiConstant(index_node, smi_index); | 5417 constant_index = ToSmiConstant(index_node, smi_index); |
5431 if (constant_index) index = smi_index->value(); | 5418 if (constant_index) index = smi_index->value(); |
5432 index_node = BitcastTaggedToWord(index_node); | 5419 index_node = BitcastTaggedToWord(index_node); |
5433 } else if (mode == INTEGER_PARAMETERS) { | |
5434 int32_t temp = 0; | |
5435 constant_index = ToInt32Constant(index_node, temp); | |
5436 index = static_cast<intptr_t>(temp); | |
5437 } else { | 5420 } else { |
5438 DCHECK(mode == INTPTR_PARAMETERS); | 5421 DCHECK(mode == INTPTR_PARAMETERS); |
5439 constant_index = ToIntPtrConstant(index_node, index); | 5422 constant_index = ToIntPtrConstant(index_node, index); |
5440 } | 5423 } |
5441 if (constant_index) { | 5424 if (constant_index) { |
5442 return IntPtrConstant(base_size + element_size * index); | 5425 return IntPtrConstant(base_size + element_size * index); |
5443 } | 5426 } |
5444 if (Is64() && mode == INTEGER_PARAMETERS) { | |
5445 index_node = ChangeInt32ToInt64(index_node); | |
5446 } | |
5447 | 5427 |
5448 Node* shifted_index = | 5428 Node* shifted_index = |
5449 (element_size_shift == 0) | 5429 (element_size_shift == 0) |
5450 ? index_node | 5430 ? index_node |
5451 : ((element_size_shift > 0) | 5431 : ((element_size_shift > 0) |
5452 ? WordShl(index_node, IntPtrConstant(element_size_shift)) | 5432 ? WordShl(index_node, IntPtrConstant(element_size_shift)) |
5453 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 5433 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
5454 return IntPtrAddFoldConstants(IntPtrConstant(base_size), shifted_index); | 5434 return IntPtrAddFoldConstants(IntPtrConstant(base_size), shifted_index); |
5455 } | 5435 } |
5456 | 5436 |
5457 Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { | 5437 Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { |
5458 Node* function = | 5438 Node* function = |
5459 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); | 5439 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); |
5460 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); | 5440 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); |
5461 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); | 5441 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); |
5462 } | 5442 } |
5463 | 5443 |
5464 void CodeStubAssembler::UpdateFeedback(Node* feedback, | 5444 void CodeStubAssembler::UpdateFeedback(Node* feedback, |
5465 Node* type_feedback_vector, | 5445 Node* type_feedback_vector, |
5466 Node* slot_id) { | 5446 Node* slot_id) { |
5467 // This method is used for binary op and compare feedback. These | 5447 // This method is used for binary op and compare feedback. These |
5468 // vector nodes are initialized with a smi 0, so we can simply OR | 5448 // vector nodes are initialized with a smi 0, so we can simply OR |
5469 // our new feedback in place. | 5449 // our new feedback in place. |
5470 // TODO(interpreter): Consider passing the feedback as Smi already to avoid | 5450 // TODO(interpreter): Consider passing the feedback as Smi already to avoid |
5471 // the tagging completely. | 5451 // the tagging completely. |
5472 Node* previous_feedback = LoadFixedArrayElement(type_feedback_vector, slot_id, | 5452 Node* previous_feedback = |
5473 0, INTPTR_PARAMETERS); | 5453 LoadFixedArrayElement(type_feedback_vector, slot_id); |
5474 Node* combined_feedback = SmiOr(previous_feedback, SmiFromWord32(feedback)); | 5454 Node* combined_feedback = SmiOr(previous_feedback, SmiFromWord32(feedback)); |
5475 StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback, | 5455 StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback, |
5476 SKIP_WRITE_BARRIER, 0, INTPTR_PARAMETERS); | 5456 SKIP_WRITE_BARRIER); |
5477 } | 5457 } |
5478 | 5458 |
5479 Node* CodeStubAssembler::LoadReceiverMap(Node* receiver) { | 5459 Node* CodeStubAssembler::LoadReceiverMap(Node* receiver) { |
5480 Variable var_receiver_map(this, MachineRepresentation::kTagged); | 5460 Variable var_receiver_map(this, MachineRepresentation::kTagged); |
5481 Label load_smi_map(this, Label::kDeferred), load_receiver_map(this), | 5461 Label load_smi_map(this, Label::kDeferred), load_receiver_map(this), |
5482 if_result(this); | 5462 if_result(this); |
5483 | 5463 |
5484 Branch(TaggedIsSmi(receiver), &load_smi_map, &load_receiver_map); | 5464 Branch(TaggedIsSmi(receiver), &load_smi_map, &load_receiver_map); |
5485 Bind(&load_smi_map); | 5465 Bind(&load_smi_map); |
5486 { | 5466 { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5658 Variable var_result(this, MachineRepresentation::kTagged); | 5638 Variable var_result(this, MachineRepresentation::kTagged); |
5659 if (!is_load) { | 5639 if (!is_load) { |
5660 var_result.Bind(value); | 5640 var_result.Bind(value); |
5661 } | 5641 } |
5662 Label if_mapped(this), if_unmapped(this), end(this, &var_result); | 5642 Label if_mapped(this), if_unmapped(this), end(this, &var_result); |
5663 Node* intptr_two = IntPtrConstant(2); | 5643 Node* intptr_two = IntPtrConstant(2); |
5664 Node* adjusted_length = IntPtrSub(elements_length, intptr_two); | 5644 Node* adjusted_length = IntPtrSub(elements_length, intptr_two); |
5665 | 5645 |
5666 GotoIf(UintPtrGreaterThanOrEqual(key, adjusted_length), &if_unmapped); | 5646 GotoIf(UintPtrGreaterThanOrEqual(key, adjusted_length), &if_unmapped); |
5667 | 5647 |
5668 Node* mapped_index = LoadFixedArrayElement( | 5648 Node* mapped_index = |
5669 elements, IntPtrAdd(key, intptr_two), 0, INTPTR_PARAMETERS); | 5649 LoadFixedArrayElement(elements, IntPtrAdd(key, intptr_two)); |
5670 Branch(WordEqual(mapped_index, TheHoleConstant()), &if_unmapped, &if_mapped); | 5650 Branch(WordEqual(mapped_index, TheHoleConstant()), &if_unmapped, &if_mapped); |
5671 | 5651 |
5672 Bind(&if_mapped); | 5652 Bind(&if_mapped); |
5673 { | 5653 { |
5674 CSA_ASSERT(this, TaggedIsSmi(mapped_index)); | 5654 CSA_ASSERT(this, TaggedIsSmi(mapped_index)); |
5675 mapped_index = SmiUntag(mapped_index); | 5655 mapped_index = SmiUntag(mapped_index); |
5676 Node* the_context = LoadFixedArrayElement(elements, 0); | 5656 Node* the_context = LoadFixedArrayElement(elements, 0); |
5677 // Assert that we can use LoadFixedArrayElement/StoreFixedArrayElement | 5657 // Assert that we can use LoadFixedArrayElement/StoreFixedArrayElement |
5678 // methods for accessing Context. | 5658 // methods for accessing Context. |
5679 STATIC_ASSERT(Context::kHeaderSize == FixedArray::kHeaderSize); | 5659 STATIC_ASSERT(Context::kHeaderSize == FixedArray::kHeaderSize); |
5680 DCHECK_EQ(Context::SlotOffset(0) + kHeapObjectTag, | 5660 DCHECK_EQ(Context::SlotOffset(0) + kHeapObjectTag, |
5681 FixedArray::OffsetOfElementAt(0)); | 5661 FixedArray::OffsetOfElementAt(0)); |
5682 if (is_load) { | 5662 if (is_load) { |
5683 Node* result = LoadFixedArrayElement(the_context, mapped_index, 0, | 5663 Node* result = LoadFixedArrayElement(the_context, mapped_index); |
5684 INTPTR_PARAMETERS); | |
5685 CSA_ASSERT(this, WordNotEqual(result, TheHoleConstant())); | 5664 CSA_ASSERT(this, WordNotEqual(result, TheHoleConstant())); |
5686 var_result.Bind(result); | 5665 var_result.Bind(result); |
5687 } else { | 5666 } else { |
5688 StoreFixedArrayElement(the_context, mapped_index, value, | 5667 StoreFixedArrayElement(the_context, mapped_index, value); |
5689 UPDATE_WRITE_BARRIER, 0, INTPTR_PARAMETERS); | |
5690 } | 5668 } |
5691 Goto(&end); | 5669 Goto(&end); |
5692 } | 5670 } |
5693 | 5671 |
5694 Bind(&if_unmapped); | 5672 Bind(&if_unmapped); |
5695 { | 5673 { |
5696 Node* backing_store = LoadFixedArrayElement(elements, 1); | 5674 Node* backing_store = LoadFixedArrayElement(elements, 1); |
5697 GotoIf(WordNotEqual(LoadMap(backing_store), FixedArrayMapConstant()), | 5675 GotoIf(WordNotEqual(LoadMap(backing_store), FixedArrayMapConstant()), |
5698 bailout); | 5676 bailout); |
5699 | 5677 |
5700 Node* backing_store_length = | 5678 Node* backing_store_length = |
5701 LoadAndUntagFixedArrayBaseLength(backing_store); | 5679 LoadAndUntagFixedArrayBaseLength(backing_store); |
5702 GotoIf(UintPtrGreaterThanOrEqual(key, backing_store_length), bailout); | 5680 GotoIf(UintPtrGreaterThanOrEqual(key, backing_store_length), bailout); |
5703 | 5681 |
5704 // The key falls into unmapped range. | 5682 // The key falls into unmapped range. |
5705 if (is_load) { | 5683 if (is_load) { |
5706 Node* result = | 5684 Node* result = LoadFixedArrayElement(backing_store, key); |
5707 LoadFixedArrayElement(backing_store, key, 0, INTPTR_PARAMETERS); | |
5708 GotoIf(WordEqual(result, TheHoleConstant()), bailout); | 5685 GotoIf(WordEqual(result, TheHoleConstant()), bailout); |
5709 var_result.Bind(result); | 5686 var_result.Bind(result); |
5710 } else { | 5687 } else { |
5711 StoreFixedArrayElement(backing_store, key, value, UPDATE_WRITE_BARRIER, 0, | 5688 StoreFixedArrayElement(backing_store, key, value); |
5712 INTPTR_PARAMETERS); | |
5713 } | 5689 } |
5714 Goto(&end); | 5690 Goto(&end); |
5715 } | 5691 } |
5716 | 5692 |
5717 Bind(&end); | 5693 Bind(&end); |
5718 return var_result.value(); | 5694 return var_result.value(); |
5719 } | 5695 } |
5720 | 5696 |
5721 Node* CodeStubAssembler::LoadScriptContext(Node* context, int context_index) { | 5697 Node* CodeStubAssembler::LoadScriptContext(Node* context, int context_index) { |
5722 Node* native_context = LoadNativeContext(context); | 5698 Node* native_context = LoadNativeContext(context); |
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8117 CSA_ASSERT(this, IntPtrGreaterThanOrEqual(map_index, | 8093 CSA_ASSERT(this, IntPtrGreaterThanOrEqual(map_index, |
8118 IntPtrConstant(kBaseMapIndex))); | 8094 IntPtrConstant(kBaseMapIndex))); |
8119 var_map_index.Bind(map_index); | 8095 var_map_index.Bind(map_index); |
8120 var_array_map.Bind(UndefinedConstant()); | 8096 var_array_map.Bind(UndefinedConstant()); |
8121 Goto(&allocate_iterator); | 8097 Goto(&allocate_iterator); |
8122 } | 8098 } |
8123 } | 8099 } |
8124 | 8100 |
8125 Bind(&allocate_iterator); | 8101 Bind(&allocate_iterator); |
8126 { | 8102 { |
8127 Node* map = | 8103 Node* map = LoadFixedArrayElement(LoadNativeContext(context), |
8128 LoadFixedArrayElement(LoadNativeContext(context), var_map_index.value(), | 8104 var_map_index.value()); |
8129 0, INTPTR_PARAMETERS); | |
8130 var_result.Bind(AllocateJSArrayIterator(array, var_array_map.value(), map)); | 8105 var_result.Bind(AllocateJSArrayIterator(array, var_array_map.value(), map)); |
8131 Goto(&return_result); | 8106 Goto(&return_result); |
8132 } | 8107 } |
8133 | 8108 |
8134 Bind(&return_result); | 8109 Bind(&return_result); |
8135 return var_result.value(); | 8110 return var_result.value(); |
8136 } | 8111 } |
8137 | 8112 |
8138 Node* CodeStubAssembler::AllocateJSArrayIterator(Node* array, Node* array_map, | 8113 Node* CodeStubAssembler::AllocateJSArrayIterator(Node* array, Node* array_map, |
8139 Node* map) { | 8114 Node* map) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8297 Heap::kUndefinedValueRootIndex); | 8272 Heap::kUndefinedValueRootIndex); |
8298 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, | 8273 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, |
8299 Heap::kUndefinedValueRootIndex); | 8274 Heap::kUndefinedValueRootIndex); |
8300 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, | 8275 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, |
8301 context); | 8276 context); |
8302 return result; | 8277 return result; |
8303 } | 8278 } |
8304 | 8279 |
8305 } // namespace internal | 8280 } // namespace internal |
8306 } // namespace v8 | 8281 } // namespace v8 |
OLD | NEW |