| 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 Node* value_map_undetectable = Word32And( | 877 Node* value_map_undetectable = Word32And( |
| 878 value_map_bitfield, Int32Constant(1 << Map::kIsUndetectable)); | 878 value_map_bitfield, Int32Constant(1 << Map::kIsUndetectable)); |
| 879 | 879 |
| 880 // Check if the {value} is undetectable. | 880 // Check if the {value} is undetectable. |
| 881 Branch(Word32Equal(value_map_undetectable, Int32Constant(0)), if_true, | 881 Branch(Word32Equal(value_map_undetectable, Int32Constant(0)), if_true, |
| 882 if_false); | 882 if_false); |
| 883 } | 883 } |
| 884 } | 884 } |
| 885 } | 885 } |
| 886 | 886 |
| 887 Node* CodeStubAssembler::LoadFromFrame(int offset, MachineType rep) { | 887 compiler::Node* CodeStubAssembler::LoadFromFrame(int offset, MachineType rep) { |
| 888 Node* frame_pointer = LoadFramePointer(); | 888 Node* frame_pointer = LoadFramePointer(); |
| 889 return Load(rep, frame_pointer, IntPtrConstant(offset)); | 889 return Load(rep, frame_pointer, IntPtrConstant(offset)); |
| 890 } | 890 } |
| 891 | 891 |
| 892 Node* CodeStubAssembler::LoadFromParentFrame(int offset, MachineType rep) { | 892 compiler::Node* CodeStubAssembler::LoadFromParentFrame(int offset, |
| 893 MachineType rep) { |
| 893 Node* frame_pointer = LoadParentFramePointer(); | 894 Node* frame_pointer = LoadParentFramePointer(); |
| 894 return Load(rep, frame_pointer, IntPtrConstant(offset)); | 895 return Load(rep, frame_pointer, IntPtrConstant(offset)); |
| 895 } | 896 } |
| 896 | 897 |
| 897 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset, | 898 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset, |
| 898 MachineType rep) { | 899 MachineType rep) { |
| 899 return Load(rep, buffer, IntPtrConstant(offset)); | 900 return Load(rep, buffer, IntPtrConstant(offset)); |
| 900 } | 901 } |
| 901 | 902 |
| 902 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset, | 903 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset, |
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2068 Bind(&next_iter); | 2069 Bind(&next_iter); |
| 2069 Node* compare = WordNotEqual(from_offset, limit_offset); | 2070 Node* compare = WordNotEqual(from_offset, limit_offset); |
| 2070 Branch(compare, &decrement, &done); | 2071 Branch(compare, &decrement, &done); |
| 2071 } | 2072 } |
| 2072 | 2073 |
| 2073 Bind(&done); | 2074 Bind(&done); |
| 2074 IncrementCounter(isolate()->counters()->inlined_copied_elements(), 1); | 2075 IncrementCounter(isolate()->counters()->inlined_copied_elements(), 1); |
| 2075 Comment("] CopyFixedArrayElements"); | 2076 Comment("] CopyFixedArrayElements"); |
| 2076 } | 2077 } |
| 2077 | 2078 |
| 2078 void CodeStubAssembler::CopyStringCharacters(Node* from_string, Node* to_string, | 2079 void CodeStubAssembler::CopyStringCharacters( |
| 2079 Node* from_index, Node* to_index, | 2080 compiler::Node* from_string, compiler::Node* to_string, |
| 2080 Node* character_count, | 2081 compiler::Node* from_index, compiler::Node* to_index, |
| 2081 String::Encoding from_encoding, | 2082 compiler::Node* character_count, String::Encoding from_encoding, |
| 2082 String::Encoding to_encoding, | 2083 String::Encoding to_encoding, ParameterMode mode) { |
| 2083 ParameterMode mode) { | |
| 2084 bool from_one_byte = from_encoding == String::ONE_BYTE_ENCODING; | 2084 bool from_one_byte = from_encoding == String::ONE_BYTE_ENCODING; |
| 2085 bool to_one_byte = to_encoding == String::ONE_BYTE_ENCODING; | 2085 bool to_one_byte = to_encoding == String::ONE_BYTE_ENCODING; |
| 2086 DCHECK_IMPLIES(to_one_byte, from_one_byte); | 2086 DCHECK_IMPLIES(to_one_byte, from_one_byte); |
| 2087 Comment("CopyStringCharacters %s -> %s", | 2087 Comment("CopyStringCharacters %s -> %s", |
| 2088 from_one_byte ? "ONE_BYTE_ENCODING" : "TWO_BYTE_ENCODING", | 2088 from_one_byte ? "ONE_BYTE_ENCODING" : "TWO_BYTE_ENCODING", |
| 2089 to_one_byte ? "ONE_BYTE_ENCODING" : "TWO_BYTE_ENCODING"); | 2089 to_one_byte ? "ONE_BYTE_ENCODING" : "TWO_BYTE_ENCODING"); |
| 2090 | 2090 |
| 2091 ElementsKind from_kind = from_one_byte ? UINT8_ELEMENTS : UINT16_ELEMENTS; | 2091 ElementsKind from_kind = from_one_byte ? UINT8_ELEMENTS : UINT16_ELEMENTS; |
| 2092 ElementsKind to_kind = to_one_byte ? UINT8_ELEMENTS : UINT16_ELEMENTS; | 2092 ElementsKind to_kind = to_one_byte ? UINT8_ELEMENTS : UINT16_ELEMENTS; |
| 2093 STATIC_ASSERT(SeqOneByteString::kHeaderSize == SeqTwoByteString::kHeaderSize); | 2093 STATIC_ASSERT(SeqOneByteString::kHeaderSize == SeqTwoByteString::kHeaderSize); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2232 // The size-check above guarantees that the |new_elements| is allocated | 2232 // The size-check above guarantees that the |new_elements| is allocated |
| 2233 // in new space so we can skip the write barrier. | 2233 // in new space so we can skip the write barrier. |
| 2234 CopyFixedArrayElements(from_kind, elements, to_kind, new_elements, capacity, | 2234 CopyFixedArrayElements(from_kind, elements, to_kind, new_elements, capacity, |
| 2235 new_capacity, SKIP_WRITE_BARRIER, mode); | 2235 new_capacity, SKIP_WRITE_BARRIER, mode); |
| 2236 | 2236 |
| 2237 StoreObjectField(object, JSObject::kElementsOffset, new_elements); | 2237 StoreObjectField(object, JSObject::kElementsOffset, new_elements); |
| 2238 Comment("] GrowElementsCapacity"); | 2238 Comment("] GrowElementsCapacity"); |
| 2239 return new_elements; | 2239 return new_elements; |
| 2240 } | 2240 } |
| 2241 | 2241 |
| 2242 void CodeStubAssembler::InitializeAllocationMemento(Node* base_allocation, | 2242 void CodeStubAssembler::InitializeAllocationMemento( |
| 2243 int base_allocation_size, | 2243 compiler::Node* base_allocation, int base_allocation_size, |
| 2244 Node* allocation_site) { | 2244 compiler::Node* allocation_site) { |
| 2245 StoreObjectFieldNoWriteBarrier( | 2245 StoreObjectFieldNoWriteBarrier( |
| 2246 base_allocation, AllocationMemento::kMapOffset + base_allocation_size, | 2246 base_allocation, AllocationMemento::kMapOffset + base_allocation_size, |
| 2247 HeapConstant(Handle<Map>(isolate()->heap()->allocation_memento_map()))); | 2247 HeapConstant(Handle<Map>(isolate()->heap()->allocation_memento_map()))); |
| 2248 StoreObjectFieldNoWriteBarrier( | 2248 StoreObjectFieldNoWriteBarrier( |
| 2249 base_allocation, | 2249 base_allocation, |
| 2250 AllocationMemento::kAllocationSiteOffset + base_allocation_size, | 2250 AllocationMemento::kAllocationSiteOffset + base_allocation_size, |
| 2251 allocation_site); | 2251 allocation_site); |
| 2252 if (FLAG_allocation_site_pretenuring) { | 2252 if (FLAG_allocation_site_pretenuring) { |
| 2253 Node* count = LoadObjectField(allocation_site, | 2253 Node* count = LoadObjectField(allocation_site, |
| 2254 AllocationSite::kPretenureCreateCountOffset); | 2254 AllocationSite::kPretenureCreateCountOffset); |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3435 Node* const result = | 3435 Node* const result = |
| 3436 CallRuntime(Runtime::kStringIndexOf, context, string, pattern, from); | 3436 CallRuntime(Runtime::kStringIndexOf, context, string, pattern, from); |
| 3437 var_result.Bind(result); | 3437 var_result.Bind(result); |
| 3438 Goto(&out); | 3438 Goto(&out); |
| 3439 } | 3439 } |
| 3440 | 3440 |
| 3441 Bind(&out); | 3441 Bind(&out); |
| 3442 return var_result.value(); | 3442 return var_result.value(); |
| 3443 } | 3443 } |
| 3444 | 3444 |
| 3445 Node* CodeStubAssembler::StringFromCodePoint(Node* codepoint, | 3445 Node* CodeStubAssembler::StringFromCodePoint(compiler::Node* codepoint, |
| 3446 UnicodeEncoding encoding) { | 3446 UnicodeEncoding encoding) { |
| 3447 Variable var_result(this, MachineRepresentation::kTagged); | 3447 Variable var_result(this, MachineRepresentation::kTagged); |
| 3448 var_result.Bind(EmptyStringConstant()); | 3448 var_result.Bind(EmptyStringConstant()); |
| 3449 | 3449 |
| 3450 Label if_isword16(this), if_isword32(this), return_result(this); | 3450 Label if_isword16(this), if_isword32(this), return_result(this); |
| 3451 | 3451 |
| 3452 Branch(Uint32LessThan(codepoint, Int32Constant(0x10000)), &if_isword16, | 3452 Branch(Uint32LessThan(codepoint, Int32Constant(0x10000)), &if_isword16, |
| 3453 &if_isword32); | 3453 &if_isword32); |
| 3454 | 3454 |
| 3455 Bind(&if_isword16); | 3455 Bind(&if_isword16); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3513 Bind(&runtime); | 3513 Bind(&runtime); |
| 3514 { | 3514 { |
| 3515 var_result.Bind(CallRuntime(Runtime::kStringToNumber, context, input)); | 3515 var_result.Bind(CallRuntime(Runtime::kStringToNumber, context, input)); |
| 3516 Goto(&end); | 3516 Goto(&end); |
| 3517 } | 3517 } |
| 3518 | 3518 |
| 3519 Bind(&end); | 3519 Bind(&end); |
| 3520 return var_result.value(); | 3520 return var_result.value(); |
| 3521 } | 3521 } |
| 3522 | 3522 |
| 3523 Node* CodeStubAssembler::NumberToString(Node* context, Node* argument) { | 3523 Node* CodeStubAssembler::NumberToString(compiler::Node* context, |
| 3524 compiler::Node* argument) { |
| 3524 Variable result(this, MachineRepresentation::kTagged); | 3525 Variable result(this, MachineRepresentation::kTagged); |
| 3525 Label runtime(this, Label::kDeferred); | 3526 Label runtime(this, Label::kDeferred); |
| 3526 Label smi(this); | 3527 Label smi(this); |
| 3527 Label done(this, &result); | 3528 Label done(this, &result); |
| 3528 | 3529 |
| 3529 // Load the number string cache. | 3530 // Load the number string cache. |
| 3530 Node* number_string_cache = LoadRoot(Heap::kNumberStringCacheRootIndex); | 3531 Node* number_string_cache = LoadRoot(Heap::kNumberStringCacheRootIndex); |
| 3531 | 3532 |
| 3532 // Make the hash mask from the length of the number string cache. It | 3533 // Make the hash mask from the length of the number string cache. It |
| 3533 // contains two elements (number and string) for each cache entry. | 3534 // contains two elements (number and string) for each cache entry. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3592 result.Bind(LoadFixedArrayElement(number_string_cache, smi_index, | 3593 result.Bind(LoadFixedArrayElement(number_string_cache, smi_index, |
| 3593 kPointerSize, SMI_PARAMETERS)); | 3594 kPointerSize, SMI_PARAMETERS)); |
| 3594 Goto(&done); | 3595 Goto(&done); |
| 3595 } | 3596 } |
| 3596 | 3597 |
| 3597 Bind(&done); | 3598 Bind(&done); |
| 3598 return result.value(); | 3599 return result.value(); |
| 3599 } | 3600 } |
| 3600 | 3601 |
| 3601 Node* CodeStubAssembler::ToName(Node* context, Node* value) { | 3602 Node* CodeStubAssembler::ToName(Node* context, Node* value) { |
| 3603 typedef CodeStubAssembler::Label Label; |
| 3604 typedef CodeStubAssembler::Variable Variable; |
| 3605 |
| 3602 Label end(this); | 3606 Label end(this); |
| 3603 Variable var_result(this, MachineRepresentation::kTagged); | 3607 Variable var_result(this, MachineRepresentation::kTagged); |
| 3604 | 3608 |
| 3605 Label is_number(this); | 3609 Label is_number(this); |
| 3606 GotoIf(TaggedIsSmi(value), &is_number); | 3610 GotoIf(TaggedIsSmi(value), &is_number); |
| 3607 | 3611 |
| 3608 Label not_name(this); | 3612 Label not_name(this); |
| 3609 Node* value_instance_type = LoadInstanceType(value); | 3613 Node* value_instance_type = LoadInstanceType(value); |
| 3610 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 3614 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
| 3611 GotoIf(Int32GreaterThan(value_instance_type, Int32Constant(LAST_NAME_TYPE)), | 3615 GotoIf(Int32GreaterThan(value_instance_type, Int32Constant(LAST_NAME_TYPE)), |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4415 if_bailout); | 4419 if_bailout); |
| 4416 | 4420 |
| 4417 Node* dictionary = LoadProperties(object); | 4421 Node* dictionary = LoadProperties(object); |
| 4418 var_meta_storage->Bind(dictionary); | 4422 var_meta_storage->Bind(dictionary); |
| 4419 | 4423 |
| 4420 NameDictionaryLookup<GlobalDictionary>( | 4424 NameDictionaryLookup<GlobalDictionary>( |
| 4421 dictionary, unique_name, if_found_global, var_name_index, if_not_found); | 4425 dictionary, unique_name, if_found_global, var_name_index, if_not_found); |
| 4422 } | 4426 } |
| 4423 } | 4427 } |
| 4424 | 4428 |
| 4425 void CodeStubAssembler::TryHasOwnProperty(Node* object, Node* map, | 4429 void CodeStubAssembler::TryHasOwnProperty(compiler::Node* object, |
| 4426 Node* instance_type, | 4430 compiler::Node* map, |
| 4427 Node* unique_name, Label* if_found, | 4431 compiler::Node* instance_type, |
| 4428 Label* if_not_found, | 4432 compiler::Node* unique_name, |
| 4433 Label* if_found, Label* if_not_found, |
| 4429 Label* if_bailout) { | 4434 Label* if_bailout) { |
| 4430 Comment("TryHasOwnProperty"); | 4435 Comment("TryHasOwnProperty"); |
| 4431 Variable var_meta_storage(this, MachineRepresentation::kTagged); | 4436 Variable var_meta_storage(this, MachineRepresentation::kTagged); |
| 4432 Variable var_name_index(this, MachineType::PointerRepresentation()); | 4437 Variable var_name_index(this, MachineType::PointerRepresentation()); |
| 4433 | 4438 |
| 4434 Label if_found_global(this); | 4439 Label if_found_global(this); |
| 4435 TryLookupProperty(object, map, instance_type, unique_name, if_found, if_found, | 4440 TryLookupProperty(object, map, instance_type, unique_name, if_found, if_found, |
| 4436 &if_found_global, &var_meta_storage, &var_name_index, | 4441 &if_found_global, &var_meta_storage, &var_name_index, |
| 4437 if_not_found, if_bailout); | 4442 if_not_found, if_bailout); |
| 4438 Bind(&if_found_global); | 4443 Bind(&if_found_global); |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5050 // Fallback to the runtime implementation. | 5055 // Fallback to the runtime implementation. |
| 5051 var_result.Bind( | 5056 var_result.Bind( |
| 5052 CallRuntime(Runtime::kOrdinaryHasInstance, context, callable, object)); | 5057 CallRuntime(Runtime::kOrdinaryHasInstance, context, callable, object)); |
| 5053 } | 5058 } |
| 5054 Goto(&return_result); | 5059 Goto(&return_result); |
| 5055 | 5060 |
| 5056 Bind(&return_result); | 5061 Bind(&return_result); |
| 5057 return var_result.value(); | 5062 return var_result.value(); |
| 5058 } | 5063 } |
| 5059 | 5064 |
| 5060 Node* CodeStubAssembler::ElementOffsetFromIndex(Node* index_node, | 5065 compiler::Node* CodeStubAssembler::ElementOffsetFromIndex(Node* index_node, |
| 5061 ElementsKind kind, | 5066 ElementsKind kind, |
| 5062 ParameterMode mode, | 5067 ParameterMode mode, |
| 5063 int base_size) { | 5068 int base_size) { |
| 5064 int element_size_shift = ElementsKindToShiftSize(kind); | 5069 int element_size_shift = ElementsKindToShiftSize(kind); |
| 5065 int element_size = 1 << element_size_shift; | 5070 int element_size = 1 << element_size_shift; |
| 5066 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; | 5071 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; |
| 5067 intptr_t index = 0; | 5072 intptr_t index = 0; |
| 5068 bool constant_index = false; | 5073 bool constant_index = false; |
| 5069 if (mode == SMI_PARAMETERS) { | 5074 if (mode == SMI_PARAMETERS) { |
| 5070 element_size_shift -= kSmiShiftBits; | 5075 element_size_shift -= kSmiShiftBits; |
| 5071 Smi* smi_index; | 5076 Smi* smi_index; |
| 5072 constant_index = ToSmiConstant(index_node, smi_index); | 5077 constant_index = ToSmiConstant(index_node, smi_index); |
| 5073 if (constant_index) index = smi_index->value(); | 5078 if (constant_index) index = smi_index->value(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5089 | 5094 |
| 5090 Node* shifted_index = | 5095 Node* shifted_index = |
| 5091 (element_size_shift == 0) | 5096 (element_size_shift == 0) |
| 5092 ? index_node | 5097 ? index_node |
| 5093 : ((element_size_shift > 0) | 5098 : ((element_size_shift > 0) |
| 5094 ? WordShl(index_node, IntPtrConstant(element_size_shift)) | 5099 ? WordShl(index_node, IntPtrConstant(element_size_shift)) |
| 5095 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 5100 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
| 5096 return IntPtrAddFoldConstants(IntPtrConstant(base_size), shifted_index); | 5101 return IntPtrAddFoldConstants(IntPtrConstant(base_size), shifted_index); |
| 5097 } | 5102 } |
| 5098 | 5103 |
| 5099 Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { | 5104 compiler::Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { |
| 5100 Node* function = | 5105 Node* function = |
| 5101 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); | 5106 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); |
| 5102 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); | 5107 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); |
| 5103 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); | 5108 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); |
| 5104 } | 5109 } |
| 5105 | 5110 |
| 5106 void CodeStubAssembler::UpdateFeedback(Node* feedback, | 5111 void CodeStubAssembler::UpdateFeedback(compiler::Node* feedback, |
| 5107 Node* type_feedback_vector, | 5112 compiler::Node* type_feedback_vector, |
| 5108 Node* slot_id) { | 5113 compiler::Node* slot_id) { |
| 5109 // This method is used for binary op and compare feedback. These | 5114 // This method is used for binary op and compare feedback. These |
| 5110 // vector nodes are initialized with a smi 0, so we can simply OR | 5115 // vector nodes are initialized with a smi 0, so we can simply OR |
| 5111 // our new feedback in place. | 5116 // our new feedback in place. |
| 5112 // TODO(interpreter): Consider passing the feedback as Smi already to avoid | 5117 // TODO(interpreter): Consider passing the feedback as Smi already to avoid |
| 5113 // the tagging completely. | 5118 // the tagging completely. |
| 5114 Node* previous_feedback = | 5119 Node* previous_feedback = |
| 5115 LoadFixedArrayElement(type_feedback_vector, slot_id); | 5120 LoadFixedArrayElement(type_feedback_vector, slot_id); |
| 5116 Node* combined_feedback = SmiOr(previous_feedback, SmiFromWord32(feedback)); | 5121 Node* combined_feedback = SmiOr(previous_feedback, SmiFromWord32(feedback)); |
| 5117 StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback, | 5122 StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback, |
| 5118 SKIP_WRITE_BARRIER); | 5123 SKIP_WRITE_BARRIER); |
| 5119 } | 5124 } |
| 5120 | 5125 |
| 5121 Node* CodeStubAssembler::LoadReceiverMap(Node* receiver) { | 5126 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { |
| 5122 Variable var_receiver_map(this, MachineRepresentation::kTagged); | 5127 Variable var_receiver_map(this, MachineRepresentation::kTagged); |
| 5123 Label load_smi_map(this, Label::kDeferred), load_receiver_map(this), | 5128 Label load_smi_map(this, Label::kDeferred), load_receiver_map(this), |
| 5124 if_result(this); | 5129 if_result(this); |
| 5125 | 5130 |
| 5126 Branch(TaggedIsSmi(receiver), &load_smi_map, &load_receiver_map); | 5131 Branch(TaggedIsSmi(receiver), &load_smi_map, &load_receiver_map); |
| 5127 Bind(&load_smi_map); | 5132 Bind(&load_smi_map); |
| 5128 { | 5133 { |
| 5129 var_receiver_map.Bind(LoadRoot(Heap::kHeapNumberMapRootIndex)); | 5134 var_receiver_map.Bind(LoadRoot(Heap::kHeapNumberMapRootIndex)); |
| 5130 Goto(&if_result); | 5135 Goto(&if_result); |
| 5131 } | 5136 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5155 Bind(&key_is_smi); | 5160 Bind(&key_is_smi); |
| 5156 { | 5161 { |
| 5157 var_intptr_key.Bind(SmiUntag(key)); | 5162 var_intptr_key.Bind(SmiUntag(key)); |
| 5158 Goto(&done); | 5163 Goto(&done); |
| 5159 } | 5164 } |
| 5160 | 5165 |
| 5161 Bind(&done); | 5166 Bind(&done); |
| 5162 return var_intptr_key.value(); | 5167 return var_intptr_key.value(); |
| 5163 } | 5168 } |
| 5164 | 5169 |
| 5165 void CodeStubAssembler::ExtendPropertiesBackingStore(Node* object) { | 5170 void CodeStubAssembler::ExtendPropertiesBackingStore(compiler::Node* object) { |
| 5166 Node* properties = LoadProperties(object); | 5171 Node* properties = LoadProperties(object); |
| 5167 Node* length = LoadFixedArrayBaseLength(properties); | 5172 Node* length = LoadFixedArrayBaseLength(properties); |
| 5168 | 5173 |
| 5169 ParameterMode mode = OptimalParameterMode(); | 5174 ParameterMode mode = OptimalParameterMode(); |
| 5170 length = UntagParameter(length, mode); | 5175 length = UntagParameter(length, mode); |
| 5171 | 5176 |
| 5172 Node* delta = IntPtrOrSmiConstant(JSObject::kFieldsAdded, mode); | 5177 Node* delta = IntPtrOrSmiConstant(JSObject::kFieldsAdded, mode); |
| 5173 Node* new_capacity = IntPtrAdd(length, delta); | 5178 Node* new_capacity = IntPtrAdd(length, delta); |
| 5174 | 5179 |
| 5175 // Grow properties array. | 5180 // Grow properties array. |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5609 length, capacity, mode, bailout); | 5614 length, capacity, mode, bailout); |
| 5610 | 5615 |
| 5611 new_elements_var.Bind(new_elements); | 5616 new_elements_var.Bind(new_elements); |
| 5612 Goto(&done); | 5617 Goto(&done); |
| 5613 } | 5618 } |
| 5614 | 5619 |
| 5615 Bind(&done); | 5620 Bind(&done); |
| 5616 return new_elements_var.value(); | 5621 return new_elements_var.value(); |
| 5617 } | 5622 } |
| 5618 | 5623 |
| 5619 void CodeStubAssembler::TransitionElementsKind(Node* object, Node* map, | 5624 void CodeStubAssembler::TransitionElementsKind( |
| 5620 ElementsKind from_kind, | 5625 compiler::Node* object, compiler::Node* map, ElementsKind from_kind, |
| 5621 ElementsKind to_kind, | 5626 ElementsKind to_kind, bool is_jsarray, Label* bailout) { |
| 5622 bool is_jsarray, | |
| 5623 Label* bailout) { | |
| 5624 DCHECK(!IsFastHoleyElementsKind(from_kind) || | 5627 DCHECK(!IsFastHoleyElementsKind(from_kind) || |
| 5625 IsFastHoleyElementsKind(to_kind)); | 5628 IsFastHoleyElementsKind(to_kind)); |
| 5626 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { | 5629 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { |
| 5627 TrapAllocationMemento(object, bailout); | 5630 TrapAllocationMemento(object, bailout); |
| 5628 } | 5631 } |
| 5629 | 5632 |
| 5630 if (!IsSimpleMapChangeTransition(from_kind, to_kind)) { | 5633 if (!IsSimpleMapChangeTransition(from_kind, to_kind)) { |
| 5631 Comment("Non-simple map transition"); | 5634 Comment("Non-simple map transition"); |
| 5632 Node* elements = LoadElements(object); | 5635 Node* elements = LoadElements(object); |
| 5633 | 5636 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5876 body(this, var.value()); | 5879 body(this, var.value()); |
| 5877 if (mode == IndexAdvanceMode::kPost) { | 5880 if (mode == IndexAdvanceMode::kPost) { |
| 5878 var.Bind(IntPtrAdd(var.value(), IntPtrConstant(increment))); | 5881 var.Bind(IntPtrAdd(var.value(), IntPtrConstant(increment))); |
| 5879 } | 5882 } |
| 5880 Branch(WordNotEqual(var.value(), end_index), &loop, &after_loop); | 5883 Branch(WordNotEqual(var.value(), end_index), &loop, &after_loop); |
| 5881 } | 5884 } |
| 5882 Bind(&after_loop); | 5885 Bind(&after_loop); |
| 5883 } | 5886 } |
| 5884 | 5887 |
| 5885 void CodeStubAssembler::BuildFastFixedArrayForEach( | 5888 void CodeStubAssembler::BuildFastFixedArrayForEach( |
| 5886 Node* fixed_array, ElementsKind kind, Node* first_element_inclusive, | 5889 compiler::Node* fixed_array, ElementsKind kind, |
| 5887 Node* last_element_exclusive, | 5890 compiler::Node* first_element_inclusive, |
| 5888 std::function<void(CodeStubAssembler* assembler, Node* fixed_array, | 5891 compiler::Node* last_element_exclusive, |
| 5889 Node* offset)> | 5892 std::function<void(CodeStubAssembler* assembler, |
| 5893 compiler::Node* fixed_array, compiler::Node* offset)> |
| 5890 body, | 5894 body, |
| 5891 ParameterMode mode, ForEachDirection direction) { | 5895 ParameterMode mode, ForEachDirection direction) { |
| 5892 STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); | 5896 STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); |
| 5893 int32_t first_val; | 5897 int32_t first_val; |
| 5894 bool constant_first = ToInt32Constant(first_element_inclusive, first_val); | 5898 bool constant_first = ToInt32Constant(first_element_inclusive, first_val); |
| 5895 int32_t last_val; | 5899 int32_t last_val; |
| 5896 bool constent_last = ToInt32Constant(last_element_exclusive, last_val); | 5900 bool constent_last = ToInt32Constant(last_element_exclusive, last_val); |
| 5897 if (constant_first && constent_last) { | 5901 if (constant_first && constent_last) { |
| 5898 int delta = last_val - first_val; | 5902 int delta = last_val - first_val; |
| 5899 DCHECK(delta >= 0); | 5903 DCHECK(delta >= 0); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5932 MachineType::PointerRepresentation(), start, limit, | 5936 MachineType::PointerRepresentation(), start, limit, |
| 5933 [fixed_array, body](CodeStubAssembler* assembler, Node* offset) { | 5937 [fixed_array, body](CodeStubAssembler* assembler, Node* offset) { |
| 5934 body(assembler, fixed_array, offset); | 5938 body(assembler, fixed_array, offset); |
| 5935 }, | 5939 }, |
| 5936 direction == ForEachDirection::kReverse ? -increment : increment, | 5940 direction == ForEachDirection::kReverse ? -increment : increment, |
| 5937 direction == ForEachDirection::kReverse ? IndexAdvanceMode::kPre | 5941 direction == ForEachDirection::kReverse ? IndexAdvanceMode::kPre |
| 5938 : IndexAdvanceMode::kPost); | 5942 : IndexAdvanceMode::kPost); |
| 5939 } | 5943 } |
| 5940 | 5944 |
| 5941 void CodeStubAssembler::BranchIfNumericRelationalComparison( | 5945 void CodeStubAssembler::BranchIfNumericRelationalComparison( |
| 5942 RelationalComparisonMode mode, Node* lhs, Node* rhs, Label* if_true, | 5946 RelationalComparisonMode mode, compiler::Node* lhs, compiler::Node* rhs, |
| 5943 Label* if_false) { | 5947 Label* if_true, Label* if_false) { |
| 5948 typedef compiler::Node Node; |
| 5949 |
| 5944 Label end(this); | 5950 Label end(this); |
| 5945 Variable result(this, MachineRepresentation::kTagged); | 5951 Variable result(this, MachineRepresentation::kTagged); |
| 5946 | 5952 |
| 5947 // Shared entry for floating point comparison. | 5953 // Shared entry for floating point comparison. |
| 5948 Label do_fcmp(this); | 5954 Label do_fcmp(this); |
| 5949 Variable var_fcmp_lhs(this, MachineRepresentation::kFloat64), | 5955 Variable var_fcmp_lhs(this, MachineRepresentation::kFloat64), |
| 5950 var_fcmp_rhs(this, MachineRepresentation::kFloat64); | 5956 var_fcmp_rhs(this, MachineRepresentation::kFloat64); |
| 5951 | 5957 |
| 5952 // Check if the {lhs} is a Smi or a HeapObject. | 5958 // Check if the {lhs} is a Smi or a HeapObject. |
| 5953 Label if_lhsissmi(this), if_lhsisnotsmi(this); | 5959 Label if_lhsissmi(this), if_lhsisnotsmi(this); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6035 case kGreaterThan: | 6041 case kGreaterThan: |
| 6036 Branch(Float64GreaterThan(lhs, rhs), if_true, if_false); | 6042 Branch(Float64GreaterThan(lhs, rhs), if_true, if_false); |
| 6037 break; | 6043 break; |
| 6038 case kGreaterThanOrEqual: | 6044 case kGreaterThanOrEqual: |
| 6039 Branch(Float64GreaterThanOrEqual(lhs, rhs), if_true, if_false); | 6045 Branch(Float64GreaterThanOrEqual(lhs, rhs), if_true, if_false); |
| 6040 break; | 6046 break; |
| 6041 } | 6047 } |
| 6042 } | 6048 } |
| 6043 } | 6049 } |
| 6044 | 6050 |
| 6045 void CodeStubAssembler::GotoUnlessNumberLessThan(Node* lhs, Node* rhs, | 6051 void CodeStubAssembler::GotoUnlessNumberLessThan(compiler::Node* lhs, |
| 6052 compiler::Node* rhs, |
| 6046 Label* if_false) { | 6053 Label* if_false) { |
| 6047 Label if_true(this); | 6054 Label if_true(this); |
| 6048 BranchIfNumericRelationalComparison(kLessThan, lhs, rhs, &if_true, if_false); | 6055 BranchIfNumericRelationalComparison(kLessThan, lhs, rhs, &if_true, if_false); |
| 6049 Bind(&if_true); | 6056 Bind(&if_true); |
| 6050 } | 6057 } |
| 6051 | 6058 |
| 6052 Node* CodeStubAssembler::RelationalComparison(RelationalComparisonMode mode, | 6059 compiler::Node* CodeStubAssembler::RelationalComparison( |
| 6053 Node* lhs, Node* rhs, | 6060 RelationalComparisonMode mode, compiler::Node* lhs, compiler::Node* rhs, |
| 6054 Node* context) { | 6061 compiler::Node* context) { |
| 6062 typedef compiler::Node Node; |
| 6063 |
| 6055 Label return_true(this), return_false(this), end(this); | 6064 Label return_true(this), return_false(this), end(this); |
| 6056 Variable result(this, MachineRepresentation::kTagged); | 6065 Variable result(this, MachineRepresentation::kTagged); |
| 6057 | 6066 |
| 6058 // Shared entry for floating point comparison. | 6067 // Shared entry for floating point comparison. |
| 6059 Label do_fcmp(this); | 6068 Label do_fcmp(this); |
| 6060 Variable var_fcmp_lhs(this, MachineRepresentation::kFloat64), | 6069 Variable var_fcmp_lhs(this, MachineRepresentation::kFloat64), |
| 6061 var_fcmp_rhs(this, MachineRepresentation::kFloat64); | 6070 var_fcmp_rhs(this, MachineRepresentation::kFloat64); |
| 6062 | 6071 |
| 6063 // We might need to loop several times due to ToPrimitive and/or ToNumber | 6072 // We might need to loop several times due to ToPrimitive and/or ToNumber |
| 6064 // conversions. | 6073 // conversions. |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6365 result.Bind(BooleanConstant(false)); | 6374 result.Bind(BooleanConstant(false)); |
| 6366 Goto(&end); | 6375 Goto(&end); |
| 6367 } | 6376 } |
| 6368 | 6377 |
| 6369 Bind(&end); | 6378 Bind(&end); |
| 6370 return result.value(); | 6379 return result.value(); |
| 6371 } | 6380 } |
| 6372 | 6381 |
| 6373 namespace { | 6382 namespace { |
| 6374 | 6383 |
| 6375 void GenerateEqual_Same(CodeStubAssembler* assembler, Node* value, | 6384 void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value, |
| 6376 CodeStubAssembler::Label* if_equal, | 6385 CodeStubAssembler::Label* if_equal, |
| 6377 CodeStubAssembler::Label* if_notequal) { | 6386 CodeStubAssembler::Label* if_notequal) { |
| 6378 // In case of abstract or strict equality checks, we need additional checks | 6387 // In case of abstract or strict equality checks, we need additional checks |
| 6379 // for NaN values because they are not considered equal, even if both the | 6388 // for NaN values because they are not considered equal, even if both the |
| 6380 // left and the right hand side reference exactly the same value. | 6389 // left and the right hand side reference exactly the same value. |
| 6381 // TODO(bmeurer): This seems to violate the SIMD.js specification, but it | 6390 // TODO(bmeurer): This seems to violate the SIMD.js specification, but it |
| 6382 // seems to be what is tested in the current SIMD.js testsuite. | 6391 // seems to be what is tested in the current SIMD.js testsuite. |
| 6383 | 6392 |
| 6384 typedef CodeStubAssembler::Label Label; | 6393 typedef CodeStubAssembler::Label Label; |
| 6394 typedef compiler::Node Node; |
| 6385 | 6395 |
| 6386 // Check if {value} is a Smi or a HeapObject. | 6396 // Check if {value} is a Smi or a HeapObject. |
| 6387 Label if_valueissmi(assembler), if_valueisnotsmi(assembler); | 6397 Label if_valueissmi(assembler), if_valueisnotsmi(assembler); |
| 6388 assembler->Branch(assembler->TaggedIsSmi(value), &if_valueissmi, | 6398 assembler->Branch(assembler->TaggedIsSmi(value), &if_valueissmi, |
| 6389 &if_valueisnotsmi); | 6399 &if_valueisnotsmi); |
| 6390 | 6400 |
| 6391 assembler->Bind(&if_valueisnotsmi); | 6401 assembler->Bind(&if_valueisnotsmi); |
| 6392 { | 6402 { |
| 6393 // Load the map of {value}. | 6403 // Load the map of {value}. |
| 6394 Node* value_map = assembler->LoadMap(value); | 6404 Node* value_map = assembler->LoadMap(value); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6409 | 6419 |
| 6410 assembler->Bind(&if_valueisnotnumber); | 6420 assembler->Bind(&if_valueisnotnumber); |
| 6411 assembler->Goto(if_equal); | 6421 assembler->Goto(if_equal); |
| 6412 } | 6422 } |
| 6413 | 6423 |
| 6414 assembler->Bind(&if_valueissmi); | 6424 assembler->Bind(&if_valueissmi); |
| 6415 assembler->Goto(if_equal); | 6425 assembler->Goto(if_equal); |
| 6416 } | 6426 } |
| 6417 | 6427 |
| 6418 void GenerateEqual_Simd128Value_HeapObject( | 6428 void GenerateEqual_Simd128Value_HeapObject( |
| 6419 CodeStubAssembler* assembler, Node* lhs, Node* lhs_map, Node* rhs, | 6429 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* lhs_map, |
| 6420 Node* rhs_map, CodeStubAssembler::Label* if_equal, | 6430 compiler::Node* rhs, compiler::Node* rhs_map, |
| 6421 CodeStubAssembler::Label* if_notequal) { | 6431 CodeStubAssembler::Label* if_equal, CodeStubAssembler::Label* if_notequal) { |
| 6422 assembler->BranchIfSimd128Equal(lhs, lhs_map, rhs, rhs_map, if_equal, | 6432 assembler->BranchIfSimd128Equal(lhs, lhs_map, rhs, rhs_map, if_equal, |
| 6423 if_notequal); | 6433 if_notequal); |
| 6424 } | 6434 } |
| 6425 | 6435 |
| 6426 } // namespace | 6436 } // namespace |
| 6427 | 6437 |
| 6428 // ES6 section 7.2.12 Abstract Equality Comparison | 6438 // ES6 section 7.2.12 Abstract Equality Comparison |
| 6429 Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs, | 6439 compiler::Node* CodeStubAssembler::Equal(ResultMode mode, compiler::Node* lhs, |
| 6430 Node* context) { | 6440 compiler::Node* rhs, |
| 6441 compiler::Node* context) { |
| 6431 // This is a slightly optimized version of Object::Equals represented as | 6442 // This is a slightly optimized version of Object::Equals represented as |
| 6432 // scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you | 6443 // scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you |
| 6433 // change something functionality wise in here, remember to update the | 6444 // change something functionality wise in here, remember to update the |
| 6434 // Object::Equals method as well. | 6445 // Object::Equals method as well. |
| 6446 typedef compiler::Node Node; |
| 6435 | 6447 |
| 6436 Label if_equal(this), if_notequal(this), | 6448 Label if_equal(this), if_notequal(this), |
| 6437 do_rhsstringtonumber(this, Label::kDeferred), end(this); | 6449 do_rhsstringtonumber(this, Label::kDeferred), end(this); |
| 6438 Variable result(this, MachineRepresentation::kTagged); | 6450 Variable result(this, MachineRepresentation::kTagged); |
| 6439 | 6451 |
| 6440 // Shared entry for floating point comparison. | 6452 // Shared entry for floating point comparison. |
| 6441 Label do_fcmp(this); | 6453 Label do_fcmp(this); |
| 6442 Variable var_fcmp_lhs(this, MachineRepresentation::kFloat64), | 6454 Variable var_fcmp_lhs(this, MachineRepresentation::kFloat64), |
| 6443 var_fcmp_rhs(this, MachineRepresentation::kFloat64); | 6455 var_fcmp_rhs(this, MachineRepresentation::kFloat64); |
| 6444 | 6456 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6918 Bind(&if_notequal); | 6930 Bind(&if_notequal); |
| 6919 { | 6931 { |
| 6920 result.Bind(BooleanConstant(mode == kNegateResult)); | 6932 result.Bind(BooleanConstant(mode == kNegateResult)); |
| 6921 Goto(&end); | 6933 Goto(&end); |
| 6922 } | 6934 } |
| 6923 | 6935 |
| 6924 Bind(&end); | 6936 Bind(&end); |
| 6925 return result.value(); | 6937 return result.value(); |
| 6926 } | 6938 } |
| 6927 | 6939 |
| 6928 Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs, | 6940 compiler::Node* CodeStubAssembler::StrictEqual(ResultMode mode, |
| 6929 Node* context) { | 6941 compiler::Node* lhs, |
| 6942 compiler::Node* rhs, |
| 6943 compiler::Node* context) { |
| 6930 // Here's pseudo-code for the algorithm below in case of kDontNegateResult | 6944 // Here's pseudo-code for the algorithm below in case of kDontNegateResult |
| 6931 // mode; for kNegateResult mode we properly negate the result. | 6945 // mode; for kNegateResult mode we properly negate the result. |
| 6932 // | 6946 // |
| 6933 // if (lhs == rhs) { | 6947 // if (lhs == rhs) { |
| 6934 // if (lhs->IsHeapNumber()) return HeapNumber::cast(lhs)->value() != NaN; | 6948 // if (lhs->IsHeapNumber()) return HeapNumber::cast(lhs)->value() != NaN; |
| 6935 // return true; | 6949 // return true; |
| 6936 // } | 6950 // } |
| 6937 // if (!lhs->IsSmi()) { | 6951 // if (!lhs->IsSmi()) { |
| 6938 // if (lhs->IsHeapNumber()) { | 6952 // if (lhs->IsHeapNumber()) { |
| 6939 // if (rhs->IsSmi()) { | 6953 // if (rhs->IsSmi()) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 6968 // return false; | 6982 // return false; |
| 6969 // } else { | 6983 // } else { |
| 6970 // if (rhs->IsHeapNumber()) { | 6984 // if (rhs->IsHeapNumber()) { |
| 6971 // return Smi::cast(lhs)->value() == HeapNumber::cast(rhs)->value(); | 6985 // return Smi::cast(lhs)->value() == HeapNumber::cast(rhs)->value(); |
| 6972 // } else { | 6986 // } else { |
| 6973 // return false; | 6987 // return false; |
| 6974 // } | 6988 // } |
| 6975 // } | 6989 // } |
| 6976 // } | 6990 // } |
| 6977 | 6991 |
| 6992 typedef compiler::Node Node; |
| 6993 |
| 6978 Label if_equal(this), if_notequal(this), end(this); | 6994 Label if_equal(this), if_notequal(this), end(this); |
| 6979 Variable result(this, MachineRepresentation::kTagged); | 6995 Variable result(this, MachineRepresentation::kTagged); |
| 6980 | 6996 |
| 6981 // Check if {lhs} and {rhs} refer to the same object. | 6997 // Check if {lhs} and {rhs} refer to the same object. |
| 6982 Label if_same(this), if_notsame(this); | 6998 Label if_same(this), if_notsame(this); |
| 6983 Branch(WordEqual(lhs, rhs), &if_same, &if_notsame); | 6999 Branch(WordEqual(lhs, rhs), &if_same, &if_notsame); |
| 6984 | 7000 |
| 6985 Bind(&if_same); | 7001 Bind(&if_same); |
| 6986 { | 7002 { |
| 6987 // The {lhs} and {rhs} reference the exact same value, yet we need special | 7003 // The {lhs} and {rhs} reference the exact same value, yet we need special |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7169 Goto(&end); | 7185 Goto(&end); |
| 7170 } | 7186 } |
| 7171 | 7187 |
| 7172 Bind(&end); | 7188 Bind(&end); |
| 7173 return result.value(); | 7189 return result.value(); |
| 7174 } | 7190 } |
| 7175 | 7191 |
| 7176 // ECMA#sec-samevalue | 7192 // ECMA#sec-samevalue |
| 7177 // This algorithm differs from the Strict Equality Comparison Algorithm in its | 7193 // This algorithm differs from the Strict Equality Comparison Algorithm in its |
| 7178 // treatment of signed zeroes and NaNs. | 7194 // treatment of signed zeroes and NaNs. |
| 7179 Node* CodeStubAssembler::SameValue(Node* lhs, Node* rhs, Node* context) { | 7195 compiler::Node* CodeStubAssembler::SameValue(compiler::Node* lhs, |
| 7196 compiler::Node* rhs, |
| 7197 compiler::Node* context) { |
| 7180 Variable var_result(this, MachineType::PointerRepresentation()); | 7198 Variable var_result(this, MachineType::PointerRepresentation()); |
| 7181 Label strict_equal(this), out(this); | 7199 Label strict_equal(this), out(this); |
| 7182 | 7200 |
| 7183 Node* const int_false = IntPtrConstant(0); | 7201 Node* const int_false = IntPtrConstant(0); |
| 7184 Node* const int_true = IntPtrConstant(1); | 7202 Node* const int_true = IntPtrConstant(1); |
| 7185 | 7203 |
| 7186 Label if_equal(this), if_notequal(this); | 7204 Label if_equal(this), if_notequal(this); |
| 7187 Branch(WordEqual(lhs, rhs), &if_equal, &if_notequal); | 7205 Branch(WordEqual(lhs, rhs), &if_equal, &if_notequal); |
| 7188 | 7206 |
| 7189 Bind(&if_equal); | 7207 Bind(&if_equal); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7253 Node* const is_equal = StrictEqual(kDontNegateResult, lhs, rhs, context); | 7271 Node* const is_equal = StrictEqual(kDontNegateResult, lhs, rhs, context); |
| 7254 Node* const result = WordEqual(is_equal, TrueConstant()); | 7272 Node* const result = WordEqual(is_equal, TrueConstant()); |
| 7255 var_result.Bind(result); | 7273 var_result.Bind(result); |
| 7256 Goto(&out); | 7274 Goto(&out); |
| 7257 } | 7275 } |
| 7258 | 7276 |
| 7259 Bind(&out); | 7277 Bind(&out); |
| 7260 return var_result.value(); | 7278 return var_result.value(); |
| 7261 } | 7279 } |
| 7262 | 7280 |
| 7263 Node* CodeStubAssembler::ForInFilter(Node* key, Node* object, Node* context) { | 7281 compiler::Node* CodeStubAssembler::ForInFilter(compiler::Node* key, |
| 7282 compiler::Node* object, |
| 7283 compiler::Node* context) { |
| 7264 Label return_undefined(this, Label::kDeferred), return_to_name(this), | 7284 Label return_undefined(this, Label::kDeferred), return_to_name(this), |
| 7265 end(this); | 7285 end(this); |
| 7266 | 7286 |
| 7267 Variable var_result(this, MachineRepresentation::kTagged); | 7287 Variable var_result(this, MachineRepresentation::kTagged); |
| 7268 | 7288 |
| 7269 Node* has_property = | 7289 Node* has_property = |
| 7270 HasProperty(object, key, context, Runtime::kForInHasProperty); | 7290 HasProperty(object, key, context, Runtime::kForInHasProperty); |
| 7271 | 7291 |
| 7272 Branch(WordEqual(has_property, BooleanConstant(true)), &return_to_name, | 7292 Branch(WordEqual(has_property, BooleanConstant(true)), &return_to_name, |
| 7273 &return_undefined); | 7293 &return_undefined); |
| 7274 | 7294 |
| 7275 Bind(&return_to_name); | 7295 Bind(&return_to_name); |
| 7276 { | 7296 { |
| 7277 var_result.Bind(ToName(context, key)); | 7297 var_result.Bind(ToName(context, key)); |
| 7278 Goto(&end); | 7298 Goto(&end); |
| 7279 } | 7299 } |
| 7280 | 7300 |
| 7281 Bind(&return_undefined); | 7301 Bind(&return_undefined); |
| 7282 { | 7302 { |
| 7283 var_result.Bind(UndefinedConstant()); | 7303 var_result.Bind(UndefinedConstant()); |
| 7284 Goto(&end); | 7304 Goto(&end); |
| 7285 } | 7305 } |
| 7286 | 7306 |
| 7287 Bind(&end); | 7307 Bind(&end); |
| 7288 return var_result.value(); | 7308 return var_result.value(); |
| 7289 } | 7309 } |
| 7290 | 7310 |
| 7291 Node* CodeStubAssembler::HasProperty( | 7311 compiler::Node* CodeStubAssembler::HasProperty( |
| 7292 Node* object, Node* key, Node* context, | 7312 compiler::Node* object, compiler::Node* key, compiler::Node* context, |
| 7293 Runtime::FunctionId fallback_runtime_function_id) { | 7313 Runtime::FunctionId fallback_runtime_function_id) { |
| 7314 typedef compiler::Node Node; |
| 7315 typedef CodeStubAssembler::Label Label; |
| 7316 typedef CodeStubAssembler::Variable Variable; |
| 7317 |
| 7294 Label call_runtime(this, Label::kDeferred), return_true(this), | 7318 Label call_runtime(this, Label::kDeferred), return_true(this), |
| 7295 return_false(this), end(this); | 7319 return_false(this), end(this); |
| 7296 | 7320 |
| 7297 CodeStubAssembler::LookupInHolder lookup_property_in_holder = | 7321 CodeStubAssembler::LookupInHolder lookup_property_in_holder = |
| 7298 [this, &return_true](Node* receiver, Node* holder, Node* holder_map, | 7322 [this, &return_true](Node* receiver, Node* holder, Node* holder_map, |
| 7299 Node* holder_instance_type, Node* unique_name, | 7323 Node* holder_instance_type, Node* unique_name, |
| 7300 Label* next_holder, Label* if_bailout) { | 7324 Label* next_holder, Label* if_bailout) { |
| 7301 TryHasOwnProperty(holder, holder_map, holder_instance_type, unique_name, | 7325 TryHasOwnProperty(holder, holder_map, holder_instance_type, unique_name, |
| 7302 &return_true, next_holder, if_bailout); | 7326 &return_true, next_holder, if_bailout); |
| 7303 }; | 7327 }; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 7331 { | 7355 { |
| 7332 result.Bind( | 7356 result.Bind( |
| 7333 CallRuntime(fallback_runtime_function_id, context, object, key)); | 7357 CallRuntime(fallback_runtime_function_id, context, object, key)); |
| 7334 Goto(&end); | 7358 Goto(&end); |
| 7335 } | 7359 } |
| 7336 | 7360 |
| 7337 Bind(&end); | 7361 Bind(&end); |
| 7338 return result.value(); | 7362 return result.value(); |
| 7339 } | 7363 } |
| 7340 | 7364 |
| 7341 Node* CodeStubAssembler::Typeof(Node* value, Node* context) { | 7365 compiler::Node* CodeStubAssembler::Typeof(compiler::Node* value, |
| 7366 compiler::Node* context) { |
| 7342 Variable result_var(this, MachineRepresentation::kTagged); | 7367 Variable result_var(this, MachineRepresentation::kTagged); |
| 7343 | 7368 |
| 7344 Label return_number(this, Label::kDeferred), if_oddball(this), | 7369 Label return_number(this, Label::kDeferred), if_oddball(this), |
| 7345 return_function(this), return_undefined(this), return_object(this), | 7370 return_function(this), return_undefined(this), return_object(this), |
| 7346 return_string(this), return_result(this); | 7371 return_string(this), return_result(this); |
| 7347 | 7372 |
| 7348 GotoIf(TaggedIsSmi(value), &return_number); | 7373 GotoIf(TaggedIsSmi(value), &return_number); |
| 7349 | 7374 |
| 7350 Node* map = LoadMap(value); | 7375 Node* map = LoadMap(value); |
| 7351 | 7376 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7424 result_var.Bind(HeapConstant(isolate()->factory()->type##_string())); \ | 7449 result_var.Bind(HeapConstant(isolate()->factory()->type##_string())); \ |
| 7425 Goto(&return_result); \ | 7450 Goto(&return_result); \ |
| 7426 } | 7451 } |
| 7427 SIMD128_TYPES(SIMD128_BIND_RETURN) | 7452 SIMD128_TYPES(SIMD128_BIND_RETURN) |
| 7428 #undef SIMD128_BIND_RETURN | 7453 #undef SIMD128_BIND_RETURN |
| 7429 | 7454 |
| 7430 Bind(&return_result); | 7455 Bind(&return_result); |
| 7431 return result_var.value(); | 7456 return result_var.value(); |
| 7432 } | 7457 } |
| 7433 | 7458 |
| 7434 Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable, | 7459 compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object, |
| 7435 Node* context) { | 7460 compiler::Node* callable, |
| 7461 compiler::Node* context) { |
| 7436 Label return_runtime(this, Label::kDeferred), end(this); | 7462 Label return_runtime(this, Label::kDeferred), end(this); |
| 7437 Variable result(this, MachineRepresentation::kTagged); | 7463 Variable result(this, MachineRepresentation::kTagged); |
| 7438 | 7464 |
| 7439 // Check if no one installed @@hasInstance somewhere. | 7465 // Check if no one installed @@hasInstance somewhere. |
| 7440 GotoUnless( | 7466 GotoUnless( |
| 7441 WordEqual(LoadObjectField(LoadRoot(Heap::kHasInstanceProtectorRootIndex), | 7467 WordEqual(LoadObjectField(LoadRoot(Heap::kHasInstanceProtectorRootIndex), |
| 7442 PropertyCell::kValueOffset), | 7468 PropertyCell::kValueOffset), |
| 7443 SmiConstant(Smi::FromInt(Isolate::kProtectorValid))), | 7469 SmiConstant(Smi::FromInt(Isolate::kProtectorValid))), |
| 7444 &return_runtime); | 7470 &return_runtime); |
| 7445 | 7471 |
| 7446 // Check if {callable} is a valid receiver. | 7472 // Check if {callable} is a valid receiver. |
| 7447 GotoIf(TaggedIsSmi(callable), &return_runtime); | 7473 GotoIf(TaggedIsSmi(callable), &return_runtime); |
| 7448 GotoUnless(IsCallableMap(LoadMap(callable)), &return_runtime); | 7474 GotoUnless(IsCallableMap(LoadMap(callable)), &return_runtime); |
| 7449 | 7475 |
| 7450 // Use the inline OrdinaryHasInstance directly. | 7476 // Use the inline OrdinaryHasInstance directly. |
| 7451 result.Bind(OrdinaryHasInstance(context, callable, object)); | 7477 result.Bind(OrdinaryHasInstance(context, callable, object)); |
| 7452 Goto(&end); | 7478 Goto(&end); |
| 7453 | 7479 |
| 7454 // TODO(bmeurer): Use GetPropertyStub here once available. | 7480 // TODO(bmeurer): Use GetPropertyStub here once available. |
| 7455 Bind(&return_runtime); | 7481 Bind(&return_runtime); |
| 7456 { | 7482 { |
| 7457 result.Bind(CallRuntime(Runtime::kInstanceOf, context, object, callable)); | 7483 result.Bind(CallRuntime(Runtime::kInstanceOf, context, object, callable)); |
| 7458 Goto(&end); | 7484 Goto(&end); |
| 7459 } | 7485 } |
| 7460 | 7486 |
| 7461 Bind(&end); | 7487 Bind(&end); |
| 7462 return result.value(); | 7488 return result.value(); |
| 7463 } | 7489 } |
| 7464 | 7490 |
| 7465 Node* CodeStubAssembler::NumberInc(Node* value) { | 7491 compiler::Node* CodeStubAssembler::NumberInc(compiler::Node* value) { |
| 7466 Variable var_result(this, MachineRepresentation::kTagged), | 7492 Variable var_result(this, MachineRepresentation::kTagged), |
| 7467 var_finc_value(this, MachineRepresentation::kFloat64); | 7493 var_finc_value(this, MachineRepresentation::kFloat64); |
| 7468 Label if_issmi(this), if_isnotsmi(this), do_finc(this), end(this); | 7494 Label if_issmi(this), if_isnotsmi(this), do_finc(this), end(this); |
| 7469 Branch(TaggedIsSmi(value), &if_issmi, &if_isnotsmi); | 7495 Branch(TaggedIsSmi(value), &if_issmi, &if_isnotsmi); |
| 7470 | 7496 |
| 7471 Bind(&if_issmi); | 7497 Bind(&if_issmi); |
| 7472 { | 7498 { |
| 7473 // Try fast Smi addition first. | 7499 // Try fast Smi addition first. |
| 7474 Node* one = SmiConstant(Smi::FromInt(1)); | 7500 Node* one = SmiConstant(Smi::FromInt(1)); |
| 7475 Node* pair = IntPtrAddWithOverflow(BitcastTaggedToWord(value), | 7501 Node* pair = IntPtrAddWithOverflow(BitcastTaggedToWord(value), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7507 Node* one = Float64Constant(1.0); | 7533 Node* one = Float64Constant(1.0); |
| 7508 Node* finc_result = Float64Add(finc_value, one); | 7534 Node* finc_result = Float64Add(finc_value, one); |
| 7509 var_result.Bind(AllocateHeapNumberWithValue(finc_result)); | 7535 var_result.Bind(AllocateHeapNumberWithValue(finc_result)); |
| 7510 Goto(&end); | 7536 Goto(&end); |
| 7511 } | 7537 } |
| 7512 | 7538 |
| 7513 Bind(&end); | 7539 Bind(&end); |
| 7514 return var_result.value(); | 7540 return var_result.value(); |
| 7515 } | 7541 } |
| 7516 | 7542 |
| 7517 Node* CodeStubAssembler::CreateArrayIterator(Node* array, Node* array_map, | 7543 compiler::Node* CodeStubAssembler::CreateArrayIterator( |
| 7518 Node* array_type, Node* context, | 7544 compiler::Node* array, compiler::Node* array_map, |
| 7519 IterationKind mode) { | 7545 compiler::Node* array_type, compiler::Node* context, IterationKind mode) { |
| 7520 int kBaseMapIndex = 0; | 7546 int kBaseMapIndex = 0; |
| 7521 switch (mode) { | 7547 switch (mode) { |
| 7522 case IterationKind::kKeys: | 7548 case IterationKind::kKeys: |
| 7523 kBaseMapIndex = Context::TYPED_ARRAY_KEY_ITERATOR_MAP_INDEX; | 7549 kBaseMapIndex = Context::TYPED_ARRAY_KEY_ITERATOR_MAP_INDEX; |
| 7524 break; | 7550 break; |
| 7525 case IterationKind::kValues: | 7551 case IterationKind::kValues: |
| 7526 kBaseMapIndex = Context::UINT8_ARRAY_VALUE_ITERATOR_MAP_INDEX; | 7552 kBaseMapIndex = Context::UINT8_ARRAY_VALUE_ITERATOR_MAP_INDEX; |
| 7527 break; | 7553 break; |
| 7528 case IterationKind::kEntries: | 7554 case IterationKind::kEntries: |
| 7529 kBaseMapIndex = Context::UINT8_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX; | 7555 kBaseMapIndex = Context::UINT8_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7695 LoadFixedArrayElement(LoadNativeContext(context), var_map_index.value(), | 7721 LoadFixedArrayElement(LoadNativeContext(context), var_map_index.value(), |
| 7696 0, CodeStubAssembler::INTPTR_PARAMETERS); | 7722 0, CodeStubAssembler::INTPTR_PARAMETERS); |
| 7697 var_result.Bind(AllocateJSArrayIterator(array, var_array_map.value(), map)); | 7723 var_result.Bind(AllocateJSArrayIterator(array, var_array_map.value(), map)); |
| 7698 Goto(&return_result); | 7724 Goto(&return_result); |
| 7699 } | 7725 } |
| 7700 | 7726 |
| 7701 Bind(&return_result); | 7727 Bind(&return_result); |
| 7702 return var_result.value(); | 7728 return var_result.value(); |
| 7703 } | 7729 } |
| 7704 | 7730 |
| 7705 Node* CodeStubAssembler::AllocateJSArrayIterator(Node* array, Node* array_map, | 7731 compiler::Node* CodeStubAssembler::AllocateJSArrayIterator( |
| 7706 Node* map) { | 7732 compiler::Node* array, compiler::Node* array_map, compiler::Node* map) { |
| 7707 Node* iterator = Allocate(JSArrayIterator::kSize); | 7733 Node* iterator = Allocate(JSArrayIterator::kSize); |
| 7708 StoreMapNoWriteBarrier(iterator, map); | 7734 StoreMapNoWriteBarrier(iterator, map); |
| 7709 StoreObjectFieldRoot(iterator, JSArrayIterator::kPropertiesOffset, | 7735 StoreObjectFieldRoot(iterator, JSArrayIterator::kPropertiesOffset, |
| 7710 Heap::kEmptyFixedArrayRootIndex); | 7736 Heap::kEmptyFixedArrayRootIndex); |
| 7711 StoreObjectFieldRoot(iterator, JSArrayIterator::kElementsOffset, | 7737 StoreObjectFieldRoot(iterator, JSArrayIterator::kElementsOffset, |
| 7712 Heap::kEmptyFixedArrayRootIndex); | 7738 Heap::kEmptyFixedArrayRootIndex); |
| 7713 StoreObjectFieldNoWriteBarrier(iterator, | 7739 StoreObjectFieldNoWriteBarrier(iterator, |
| 7714 JSArrayIterator::kIteratedObjectOffset, array); | 7740 JSArrayIterator::kIteratedObjectOffset, array); |
| 7715 StoreObjectFieldNoWriteBarrier(iterator, JSArrayIterator::kNextIndexOffset, | 7741 StoreObjectFieldNoWriteBarrier(iterator, JSArrayIterator::kNextIndexOffset, |
| 7716 SmiConstant(Smi::FromInt(0))); | 7742 SmiConstant(Smi::FromInt(0))); |
| 7717 StoreObjectFieldNoWriteBarrier( | 7743 StoreObjectFieldNoWriteBarrier( |
| 7718 iterator, JSArrayIterator::kIteratedObjectMapOffset, array_map); | 7744 iterator, JSArrayIterator::kIteratedObjectMapOffset, array_map); |
| 7719 return iterator; | 7745 return iterator; |
| 7720 } | 7746 } |
| 7721 | 7747 |
| 7722 Node* CodeStubAssembler::IsDetachedBuffer(Node* buffer) { | 7748 compiler::Node* CodeStubAssembler::IsDetachedBuffer(compiler::Node* buffer) { |
| 7723 CSA_ASSERT(this, HasInstanceType(buffer, JS_ARRAY_BUFFER_TYPE)); | 7749 CSA_ASSERT(this, HasInstanceType(buffer, JS_ARRAY_BUFFER_TYPE)); |
| 7724 | 7750 |
| 7725 Node* buffer_bit_field = LoadObjectField( | 7751 Node* buffer_bit_field = LoadObjectField( |
| 7726 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); | 7752 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); |
| 7727 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); | 7753 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); |
| 7728 | 7754 |
| 7729 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), | 7755 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), |
| 7730 Int32Constant(0)); | 7756 Int32Constant(0)); |
| 7731 } | 7757 } |
| 7732 | 7758 |
| 7733 CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, Node* argc, | 7759 CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, |
| 7760 compiler::Node* argc, |
| 7734 CodeStubAssembler::ParameterMode mode) | 7761 CodeStubAssembler::ParameterMode mode) |
| 7735 : assembler_(assembler), | 7762 : assembler_(assembler), |
| 7736 argc_(argc), | 7763 argc_(argc), |
| 7737 arguments_(nullptr), | 7764 arguments_(nullptr), |
| 7738 fp_(assembler->LoadFramePointer()) { | 7765 fp_(assembler->LoadFramePointer()) { |
| 7739 Node* offset = assembler->ElementOffsetFromIndex( | 7766 compiler::Node* offset = assembler->ElementOffsetFromIndex( |
| 7740 argc_, FAST_ELEMENTS, mode, | 7767 argc_, FAST_ELEMENTS, mode, |
| 7741 (StandardFrameConstants::kFixedSlotCountAboveFp - 1) * kPointerSize); | 7768 (StandardFrameConstants::kFixedSlotCountAboveFp - 1) * kPointerSize); |
| 7742 arguments_ = assembler_->IntPtrAddFoldConstants(fp_, offset); | 7769 arguments_ = assembler_->IntPtrAddFoldConstants(fp_, offset); |
| 7743 if (mode == CodeStubAssembler::INTEGER_PARAMETERS) { | 7770 if (mode == CodeStubAssembler::INTEGER_PARAMETERS) { |
| 7744 argc_ = assembler->ChangeInt32ToIntPtr(argc_); | 7771 argc_ = assembler->ChangeInt32ToIntPtr(argc_); |
| 7745 } else if (mode == CodeStubAssembler::SMI_PARAMETERS) { | 7772 } else if (mode == CodeStubAssembler::SMI_PARAMETERS) { |
| 7746 argc_ = assembler->SmiUntag(argc_); | 7773 argc_ = assembler->SmiUntag(argc_); |
| 7747 } | 7774 } |
| 7748 } | 7775 } |
| 7749 | 7776 |
| 7750 Node* CodeStubArguments::GetReceiver() { | 7777 compiler::Node* CodeStubArguments::GetReceiver() { |
| 7751 return assembler_->Load(MachineType::AnyTagged(), arguments_, | 7778 return assembler_->Load(MachineType::AnyTagged(), arguments_, |
| 7752 assembler_->IntPtrConstant(kPointerSize)); | 7779 assembler_->IntPtrConstant(kPointerSize)); |
| 7753 } | 7780 } |
| 7754 | 7781 |
| 7755 Node* CodeStubArguments::AtIndex(Node* index, | 7782 compiler::Node* CodeStubArguments::AtIndex( |
| 7756 CodeStubAssembler::ParameterMode mode) { | 7783 compiler::Node* index, CodeStubAssembler::ParameterMode mode) { |
| 7784 typedef compiler::Node Node; |
| 7757 Node* negated_index = assembler_->IntPtrSubFoldConstants( | 7785 Node* negated_index = assembler_->IntPtrSubFoldConstants( |
| 7758 assembler_->IntPtrOrSmiConstant(0, mode), index); | 7786 assembler_->IntPtrOrSmiConstant(0, mode), index); |
| 7759 Node* offset = | 7787 Node* offset = |
| 7760 assembler_->ElementOffsetFromIndex(negated_index, FAST_ELEMENTS, mode, 0); | 7788 assembler_->ElementOffsetFromIndex(negated_index, FAST_ELEMENTS, mode, 0); |
| 7761 return assembler_->Load(MachineType::AnyTagged(), arguments_, offset); | 7789 return assembler_->Load(MachineType::AnyTagged(), arguments_, offset); |
| 7762 } | 7790 } |
| 7763 | 7791 |
| 7764 Node* CodeStubArguments::AtIndex(int index) { | 7792 compiler::Node* CodeStubArguments::AtIndex(int index) { |
| 7765 return AtIndex(assembler_->IntPtrConstant(index)); | 7793 return AtIndex(assembler_->IntPtrConstant(index)); |
| 7766 } | 7794 } |
| 7767 | 7795 |
| 7768 void CodeStubArguments::ForEach(const CodeStubAssembler::VariableList& vars, | 7796 void CodeStubArguments::ForEach(const CodeStubAssembler::VariableList& vars, |
| 7769 CodeStubArguments::ForEachBodyFunction body, | 7797 CodeStubArguments::ForEachBodyFunction body, |
| 7770 Node* first, Node* last, | 7798 compiler::Node* first, compiler::Node* last, |
| 7771 CodeStubAssembler::ParameterMode mode) { | 7799 CodeStubAssembler::ParameterMode mode) { |
| 7772 assembler_->Comment("CodeStubArguments::ForEach"); | 7800 assembler_->Comment("CodeStubArguments::ForEach"); |
| 7773 DCHECK_IMPLIES(first == nullptr || last == nullptr, | 7801 DCHECK_IMPLIES(first == nullptr || last == nullptr, |
| 7774 mode == CodeStubAssembler::INTPTR_PARAMETERS); | 7802 mode == CodeStubAssembler::INTPTR_PARAMETERS); |
| 7775 if (first == nullptr) { | 7803 if (first == nullptr) { |
| 7776 first = assembler_->IntPtrOrSmiConstant(0, mode); | 7804 first = assembler_->IntPtrOrSmiConstant(0, mode); |
| 7777 } | 7805 } |
| 7778 if (last == nullptr) { | 7806 if (last == nullptr) { |
| 7779 last = argc_; | 7807 last = argc_; |
| 7780 } | 7808 } |
| 7781 Node* start = assembler_->IntPtrSubFoldConstants( | 7809 compiler::Node* start = assembler_->IntPtrSubFoldConstants( |
| 7782 arguments_, | 7810 arguments_, |
| 7783 assembler_->ElementOffsetFromIndex(first, FAST_ELEMENTS, mode)); | 7811 assembler_->ElementOffsetFromIndex(first, FAST_ELEMENTS, mode)); |
| 7784 Node* end = assembler_->IntPtrSubFoldConstants( | 7812 compiler::Node* end = assembler_->IntPtrSubFoldConstants( |
| 7785 arguments_, | 7813 arguments_, |
| 7786 assembler_->ElementOffsetFromIndex(last, FAST_ELEMENTS, mode)); | 7814 assembler_->ElementOffsetFromIndex(last, FAST_ELEMENTS, mode)); |
| 7787 assembler_->BuildFastLoop( | 7815 assembler_->BuildFastLoop( |
| 7788 vars, MachineType::PointerRepresentation(), start, end, | 7816 vars, MachineType::PointerRepresentation(), start, end, |
| 7789 [body](CodeStubAssembler* assembler, Node* current) { | 7817 [body](CodeStubAssembler* assembler, compiler::Node* current) { |
| 7790 Node* arg = assembler->Load(MachineType::AnyTagged(), current); | 7818 Node* arg = assembler->Load(MachineType::AnyTagged(), current); |
| 7791 body(assembler, arg); | 7819 body(assembler, arg); |
| 7792 }, | 7820 }, |
| 7793 -kPointerSize, CodeStubAssembler::IndexAdvanceMode::kPost); | 7821 -kPointerSize, CodeStubAssembler::IndexAdvanceMode::kPost); |
| 7794 } | 7822 } |
| 7795 | 7823 |
| 7796 void CodeStubArguments::PopAndReturn(Node* value) { | 7824 void CodeStubArguments::PopAndReturn(compiler::Node* value) { |
| 7797 assembler_->PopAndReturn( | 7825 assembler_->PopAndReturn( |
| 7798 assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)), | 7826 assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)), |
| 7799 value); | 7827 value); |
| 7800 } | 7828 } |
| 7801 | 7829 |
| 7802 Node* CodeStubAssembler::IsFastElementsKind(Node* elements_kind) { | 7830 compiler::Node* CodeStubAssembler::IsFastElementsKind( |
| 7831 compiler::Node* elements_kind) { |
| 7803 return Uint32LessThanOrEqual(elements_kind, | 7832 return Uint32LessThanOrEqual(elements_kind, |
| 7804 Int32Constant(LAST_FAST_ELEMENTS_KIND)); | 7833 Int32Constant(LAST_FAST_ELEMENTS_KIND)); |
| 7805 } | 7834 } |
| 7806 | 7835 |
| 7807 Node* CodeStubAssembler::IsHoleyFastElementsKind(Node* elements_kind) { | 7836 compiler::Node* CodeStubAssembler::IsHoleyFastElementsKind( |
| 7837 compiler::Node* elements_kind) { |
| 7808 CSA_ASSERT(this, IsFastElementsKind(elements_kind)); | 7838 CSA_ASSERT(this, IsFastElementsKind(elements_kind)); |
| 7809 | 7839 |
| 7810 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == (FAST_SMI_ELEMENTS | 1)); | 7840 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == (FAST_SMI_ELEMENTS | 1)); |
| 7811 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == (FAST_ELEMENTS | 1)); | 7841 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == (FAST_ELEMENTS | 1)); |
| 7812 STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == (FAST_DOUBLE_ELEMENTS | 1)); | 7842 STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == (FAST_DOUBLE_ELEMENTS | 1)); |
| 7813 | 7843 |
| 7814 // Check prototype chain if receiver does not have packed elements. | 7844 // Check prototype chain if receiver does not have packed elements. |
| 7815 Node* holey_elements = Word32And(elements_kind, Int32Constant(1)); | 7845 Node* holey_elements = Word32And(elements_kind, Int32Constant(1)); |
| 7816 return Word32Equal(holey_elements, Int32Constant(1)); | 7846 return Word32Equal(holey_elements, Int32Constant(1)); |
| 7817 } | 7847 } |
| 7818 | 7848 |
| 7819 compiler::Node* CodeStubAssembler::IsDebugActive() { | 7849 compiler::Node* CodeStubAssembler::IsDebugActive() { |
| 7820 Node* is_debug_active = Load( | 7850 Node* is_debug_active = Load( |
| 7821 MachineType::Uint8(), | 7851 MachineType::Uint8(), |
| 7822 ExternalConstant(ExternalReference::debug_is_active_address(isolate()))); | 7852 ExternalConstant(ExternalReference::debug_is_active_address(isolate()))); |
| 7823 return WordNotEqual(is_debug_active, Int32Constant(0)); | 7853 return WordNotEqual(is_debug_active, Int32Constant(0)); |
| 7824 } | 7854 } |
| 7825 | 7855 |
| 7826 } // namespace internal | 7856 } // namespace internal |
| 7827 } // namespace v8 | 7857 } // namespace v8 |
| OLD | NEW |