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

Side by Side Diff: src/ic/keyed-store-generic.cc

Issue 2502293002: Reland of [refactoring] Split CodeAssemblerState out of CodeAssembler (Closed)
Patch Set: fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/keyed-store-generic.h ('k') | src/interface-descriptors.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ic/keyed-store-generic.h" 5 #include "src/ic/keyed-store-generic.h"
6 6
7 #include "src/compiler/code-assembler.h" 7 #include "src/code-stub-assembler.h"
8 #include "src/contexts.h" 8 #include "src/contexts.h"
9 #include "src/interface-descriptors.h"
9 #include "src/isolate.h" 10 #include "src/isolate.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 using compiler::Node; 15 using compiler::Node;
15 16
16 class KeyedStoreGenericAssembler : public CodeStubAssembler { 17 class KeyedStoreGenericAssembler : public CodeStubAssembler {
17 public: 18 public:
19 explicit KeyedStoreGenericAssembler(compiler::CodeAssemblerState* state)
20 : CodeStubAssembler(state) {}
21
18 void KeyedStoreGeneric(const StoreICParameters* p, 22 void KeyedStoreGeneric(const StoreICParameters* p,
19 LanguageMode language_mode); 23 LanguageMode language_mode);
20 24
21 private: 25 private:
22 enum UpdateLength { 26 enum UpdateLength {
23 kDontChangeLength, 27 kDontChangeLength,
24 kIncrementLengthByOne, 28 kIncrementLengthByOne,
25 kBumpLengthWithGap 29 kBumpLengthWithGap
26 }; 30 };
27 31
(...skipping 24 matching lines...) Expand all
52 Node* native_context, ElementsKind packed_kind, 56 Node* native_context, ElementsKind packed_kind,
53 ElementsKind holey_kind, Label* done, 57 ElementsKind holey_kind, Label* done,
54 Label* map_mismatch, Label* bailout); 58 Label* map_mismatch, Label* bailout);
55 void TryChangeToHoleyMap(Node* receiver, Node* receiver_map, 59 void TryChangeToHoleyMap(Node* receiver, Node* receiver_map,
56 Node* current_elements_kind, Node* context, 60 Node* current_elements_kind, Node* context,
57 ElementsKind packed_kind, Label* bailout); 61 ElementsKind packed_kind, Label* bailout);
58 void TryChangeToHoleyMapMulti(Node* receiver, Node* receiver_map, 62 void TryChangeToHoleyMapMulti(Node* receiver, Node* receiver_map,
59 Node* current_elements_kind, Node* context, 63 Node* current_elements_kind, Node* context,
60 ElementsKind packed_kind, 64 ElementsKind packed_kind,
61 ElementsKind packed_kind_2, Label* bailout); 65 ElementsKind packed_kind_2, Label* bailout);
62
63 // Do not add fields, so that this is safe to reinterpret_cast to CSA.
64 }; 66 };
65 67
66 void KeyedStoreGenericGenerator::Generate( 68 void KeyedStoreGenericGenerator::Generate(compiler::CodeAssemblerState* state,
67 CodeStubAssembler* assembler, const CodeStubAssembler::StoreICParameters* p, 69 LanguageMode language_mode) {
68 LanguageMode language_mode) { 70 typedef StoreWithVectorDescriptor Descriptor;
69 STATIC_ASSERT(sizeof(CodeStubAssembler) == 71 KeyedStoreGenericAssembler assembler(state);
70 sizeof(KeyedStoreGenericAssembler)); 72
71 auto assm = reinterpret_cast<KeyedStoreGenericAssembler*>(assembler); 73 Node* receiver = assembler.Parameter(Descriptor::kReceiver);
72 assm->KeyedStoreGeneric(p, language_mode); 74 Node* name = assembler.Parameter(Descriptor::kName);
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);
73 } 83 }
74 84
75 void KeyedStoreGenericAssembler::BranchIfPrototypesHaveNonFastElements( 85 void KeyedStoreGenericAssembler::BranchIfPrototypesHaveNonFastElements(
76 Node* receiver_map, Label* non_fast_elements, Label* only_fast_elements) { 86 Node* receiver_map, Label* non_fast_elements, Label* only_fast_elements) {
77 Variable var_map(this, MachineRepresentation::kTagged); 87 Variable var_map(this, MachineRepresentation::kTagged);
78 var_map.Bind(receiver_map); 88 var_map.Bind(receiver_map);
79 Label loop_body(this, &var_map); 89 Label loop_body(this, &var_map);
80 Goto(&loop_body); 90 Goto(&loop_body);
81 91
82 Bind(&loop_body); 92 Bind(&loop_body);
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 Bind(&slow); 550 Bind(&slow);
541 { 551 {
542 Comment("KeyedStoreGeneric_slow"); 552 Comment("KeyedStoreGeneric_slow");
543 TailCallRuntime(Runtime::kSetProperty, p->context, p->receiver, p->name, 553 TailCallRuntime(Runtime::kSetProperty, p->context, p->receiver, p->name,
544 p->value, SmiConstant(language_mode)); 554 p->value, SmiConstant(language_mode));
545 } 555 }
546 } 556 }
547 557
548 } // namespace internal 558 } // namespace internal
549 } // namespace v8 559 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/keyed-store-generic.h ('k') | src/interface-descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698