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 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
10 | 10 |
(...skipping 4766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4777 // the tagging completely. | 4777 // the tagging completely. |
4778 Node* previous_feedback = | 4778 Node* previous_feedback = |
4779 LoadFixedArrayElement(type_feedback_vector, slot_id); | 4779 LoadFixedArrayElement(type_feedback_vector, slot_id); |
4780 Node* combined_feedback = SmiOr(previous_feedback, SmiFromWord32(feedback)); | 4780 Node* combined_feedback = SmiOr(previous_feedback, SmiFromWord32(feedback)); |
4781 StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback, | 4781 StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback, |
4782 SKIP_WRITE_BARRIER); | 4782 SKIP_WRITE_BARRIER); |
4783 } | 4783 } |
4784 | 4784 |
4785 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { | 4785 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { |
4786 Variable var_receiver_map(this, MachineRepresentation::kTagged); | 4786 Variable var_receiver_map(this, MachineRepresentation::kTagged); |
4787 // TODO(ishell): defer blocks when it works. | 4787 Label load_smi_map(this, Label::kDeferred), load_receiver_map(this), |
4788 Label load_smi_map(this /*, Label::kDeferred*/), load_receiver_map(this), | |
4789 if_result(this); | 4788 if_result(this); |
4790 | 4789 |
4791 Branch(TaggedIsSmi(receiver), &load_smi_map, &load_receiver_map); | 4790 Branch(TaggedIsSmi(receiver), &load_smi_map, &load_receiver_map); |
4792 Bind(&load_smi_map); | 4791 Bind(&load_smi_map); |
4793 { | 4792 { |
4794 var_receiver_map.Bind(LoadRoot(Heap::kHeapNumberMapRootIndex)); | 4793 var_receiver_map.Bind(LoadRoot(Heap::kHeapNumberMapRootIndex)); |
4795 Goto(&if_result); | 4794 Goto(&if_result); |
4796 } | 4795 } |
4797 Bind(&load_receiver_map); | 4796 Bind(&load_receiver_map); |
4798 { | 4797 { |
4799 var_receiver_map.Bind(LoadMap(receiver)); | 4798 var_receiver_map.Bind(LoadMap(receiver)); |
4800 Goto(&if_result); | 4799 Goto(&if_result); |
4801 } | 4800 } |
4802 Bind(&if_result); | 4801 Bind(&if_result); |
4803 return var_receiver_map.value(); | 4802 return var_receiver_map.value(); |
4804 } | 4803 } |
4805 | 4804 |
4806 compiler::Node* CodeStubAssembler::TryMonomorphicCase( | 4805 compiler::Node* CodeStubAssembler::TryMonomorphicCase( |
4807 compiler::Node* slot, compiler::Node* vector, compiler::Node* receiver_map, | 4806 compiler::Node* slot, compiler::Node* vector, compiler::Node* receiver_map, |
4808 Label* if_handler, Variable* var_handler, Label* if_miss) { | 4807 Label* if_handler, Variable* var_handler, Label* if_miss) { |
4809 DCHECK_EQ(MachineRepresentation::kTagged, var_handler->rep()); | 4808 DCHECK_EQ(MachineRepresentation::kTagged, var_handler->rep()); |
4810 | 4809 |
4811 // TODO(ishell): add helper class that hides offset computations for a series | 4810 // TODO(ishell): add helper class that hides offset computations for a series |
4812 // of loads. | 4811 // of loads. |
4813 int32_t header_size = FixedArray::kHeaderSize - kHeapObjectTag; | 4812 int32_t header_size = FixedArray::kHeaderSize - kHeapObjectTag; |
4814 Node* offset = ElementOffsetFromIndex(slot, FAST_HOLEY_ELEMENTS, | 4813 // Adding |header_size| with a separate IntPtrAdd rather than passing it |
4815 SMI_PARAMETERS, header_size); | 4814 // into ElementOffsetFromIndex() allows it to be folded into a single |
4816 Node* feedback = Load(MachineType::AnyTagged(), vector, offset); | 4815 // [base, index, offset] indirect memory access on x64. |
| 4816 Node* offset = |
| 4817 ElementOffsetFromIndex(slot, FAST_HOLEY_ELEMENTS, SMI_PARAMETERS); |
| 4818 Node* feedback = Load(MachineType::AnyTagged(), vector, |
| 4819 IntPtrAdd(offset, IntPtrConstant(header_size))); |
4817 | 4820 |
4818 // Try to quickly handle the monomorphic case without knowing for sure | 4821 // Try to quickly handle the monomorphic case without knowing for sure |
4819 // if we have a weak cell in feedback. We do know it's safe to look | 4822 // if we have a weak cell in feedback. We do know it's safe to look |
4820 // at WeakCell::kValueOffset. | 4823 // at WeakCell::kValueOffset. |
4821 GotoUnless(WordEqual(receiver_map, LoadWeakCellValue(feedback)), if_miss); | 4824 GotoIf(WordNotEqual(receiver_map, LoadWeakCellValue(feedback)), if_miss); |
4822 | 4825 |
4823 Node* handler = Load(MachineType::AnyTagged(), vector, | 4826 Node* handler = |
4824 IntPtrAdd(offset, IntPtrConstant(kPointerSize))); | 4827 Load(MachineType::AnyTagged(), vector, |
| 4828 IntPtrAdd(offset, IntPtrConstant(header_size + kPointerSize))); |
4825 | 4829 |
4826 var_handler->Bind(handler); | 4830 var_handler->Bind(handler); |
4827 Goto(if_handler); | 4831 Goto(if_handler); |
4828 return feedback; | 4832 return feedback; |
4829 } | 4833 } |
4830 | 4834 |
4831 void CodeStubAssembler::HandlePolymorphicCase( | 4835 void CodeStubAssembler::HandlePolymorphicCase( |
4832 compiler::Node* receiver_map, compiler::Node* feedback, Label* if_handler, | 4836 compiler::Node* receiver_map, compiler::Node* feedback, Label* if_handler, |
4833 Variable* var_handler, Label* if_miss, int unroll_count) { | 4837 Variable* var_handler, Label* if_miss, int unroll_count) { |
4834 DCHECK_EQ(MachineRepresentation::kTagged, var_handler->rep()); | 4838 DCHECK_EQ(MachineRepresentation::kTagged, var_handler->rep()); |
(...skipping 3498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8333 Node* buffer_bit_field = LoadObjectField( | 8337 Node* buffer_bit_field = LoadObjectField( |
8334 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); | 8338 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); |
8335 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); | 8339 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); |
8336 | 8340 |
8337 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), | 8341 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), |
8338 Int32Constant(0)); | 8342 Int32Constant(0)); |
8339 } | 8343 } |
8340 | 8344 |
8341 } // namespace internal | 8345 } // namespace internal |
8342 } // namespace v8 | 8346 } // namespace v8 |
OLD | NEW |