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 | 4 |
5 #include "src/ic/keyed-store-generic.h" | 5 #include "src/ic/keyed-store-generic.h" |
6 | 6 |
7 #include "src/code-stub-assembler.h" | 7 #include "src/compiler/code-assembler.h" |
8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/interface-descriptors.h" | |
10 #include "src/isolate.h" | 9 #include "src/isolate.h" |
11 | 10 |
12 namespace v8 { | 11 namespace v8 { |
13 namespace internal { | 12 namespace internal { |
14 | 13 |
15 using compiler::Node; | 14 using compiler::Node; |
16 | 15 |
17 class KeyedStoreGenericAssembler : public CodeStubAssembler { | 16 class KeyedStoreGenericAssembler : public CodeStubAssembler { |
18 public: | 17 public: |
19 explicit KeyedStoreGenericAssembler(compiler::CodeAssemblerState* state) | |
20 : CodeStubAssembler(state) {} | |
21 | |
22 void KeyedStoreGeneric(const StoreICParameters* p, | 18 void KeyedStoreGeneric(const StoreICParameters* p, |
23 LanguageMode language_mode); | 19 LanguageMode language_mode); |
24 | 20 |
25 private: | 21 private: |
26 enum UpdateLength { | 22 enum UpdateLength { |
27 kDontChangeLength, | 23 kDontChangeLength, |
28 kIncrementLengthByOne, | 24 kIncrementLengthByOne, |
29 kBumpLengthWithGap | 25 kBumpLengthWithGap |
30 }; | 26 }; |
31 | 27 |
(...skipping 24 matching lines...) Expand all Loading... |
56 Node* native_context, ElementsKind packed_kind, | 52 Node* native_context, ElementsKind packed_kind, |
57 ElementsKind holey_kind, Label* done, | 53 ElementsKind holey_kind, Label* done, |
58 Label* map_mismatch, Label* bailout); | 54 Label* map_mismatch, Label* bailout); |
59 void TryChangeToHoleyMap(Node* receiver, Node* receiver_map, | 55 void TryChangeToHoleyMap(Node* receiver, Node* receiver_map, |
60 Node* current_elements_kind, Node* context, | 56 Node* current_elements_kind, Node* context, |
61 ElementsKind packed_kind, Label* bailout); | 57 ElementsKind packed_kind, Label* bailout); |
62 void TryChangeToHoleyMapMulti(Node* receiver, Node* receiver_map, | 58 void TryChangeToHoleyMapMulti(Node* receiver, Node* receiver_map, |
63 Node* current_elements_kind, Node* context, | 59 Node* current_elements_kind, Node* context, |
64 ElementsKind packed_kind, | 60 ElementsKind packed_kind, |
65 ElementsKind packed_kind_2, Label* bailout); | 61 ElementsKind packed_kind_2, Label* bailout); |
| 62 |
| 63 // Do not add fields, so that this is safe to reinterpret_cast to CSA. |
66 }; | 64 }; |
67 | 65 |
68 void KeyedStoreGenericGenerator::Generate(compiler::CodeAssemblerState* state, | 66 void KeyedStoreGenericGenerator::Generate( |
69 LanguageMode language_mode) { | 67 CodeStubAssembler* assembler, const CodeStubAssembler::StoreICParameters* p, |
70 typedef StoreWithVectorDescriptor Descriptor; | 68 LanguageMode language_mode) { |
71 KeyedStoreGenericAssembler assembler(state); | 69 STATIC_ASSERT(sizeof(CodeStubAssembler) == |
72 | 70 sizeof(KeyedStoreGenericAssembler)); |
73 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | 71 auto assm = reinterpret_cast<KeyedStoreGenericAssembler*>(assembler); |
74 Node* name = assembler.Parameter(Descriptor::kName); | 72 assm->KeyedStoreGeneric(p, language_mode); |
75 Node* value = assembler.Parameter(Descriptor::kValue); | |
76 Node* slot = assembler.Parameter(Descriptor::kSlot); | |
77 Node* vector = assembler.Parameter(Descriptor::kVector); | |
78 Node* context = assembler.Parameter(Descriptor::kContext); | |
79 | |
80 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, | |
81 vector); | |
82 assembler.KeyedStoreGeneric(&p, language_mode); | |
83 } | 73 } |
84 | 74 |
85 void KeyedStoreGenericAssembler::BranchIfPrototypesHaveNonFastElements( | 75 void KeyedStoreGenericAssembler::BranchIfPrototypesHaveNonFastElements( |
86 Node* receiver_map, Label* non_fast_elements, Label* only_fast_elements) { | 76 Node* receiver_map, Label* non_fast_elements, Label* only_fast_elements) { |
87 Variable var_map(this, MachineRepresentation::kTagged); | 77 Variable var_map(this, MachineRepresentation::kTagged); |
88 var_map.Bind(receiver_map); | 78 var_map.Bind(receiver_map); |
89 Label loop_body(this, &var_map); | 79 Label loop_body(this, &var_map); |
90 Goto(&loop_body); | 80 Goto(&loop_body); |
91 | 81 |
92 Bind(&loop_body); | 82 Bind(&loop_body); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 Bind(&slow); | 540 Bind(&slow); |
551 { | 541 { |
552 Comment("KeyedStoreGeneric_slow"); | 542 Comment("KeyedStoreGeneric_slow"); |
553 TailCallRuntime(Runtime::kSetProperty, p->context, p->receiver, p->name, | 543 TailCallRuntime(Runtime::kSetProperty, p->context, p->receiver, p->name, |
554 p->value, SmiConstant(language_mode)); | 544 p->value, SmiConstant(language_mode)); |
555 } | 545 } |
556 } | 546 } |
557 | 547 |
558 } // namespace internal | 548 } // namespace internal |
559 } // namespace v8 | 549 } // namespace v8 |
OLD | NEW |