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

Side by Side Diff: src/compiler/code-stub-assembler.cc

Issue 1674633002: Move FastAccessorAssembler from RawMachineAssembler to CodeStubAssembler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor fixes. (No functional change.) Created 4 years, 9 months 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compiler/code-stub-assembler.h" 5 #include "src/compiler/code-stub-assembler.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 10 matching lines...) Expand all
21 #include "src/zone.h" 21 #include "src/zone.h"
22 22
23 namespace v8 { 23 namespace v8 {
24 namespace internal { 24 namespace internal {
25 namespace compiler { 25 namespace compiler {
26 26
27 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, 27 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
28 const CallInterfaceDescriptor& descriptor, 28 const CallInterfaceDescriptor& descriptor,
29 Code::Flags flags, const char* name, 29 Code::Flags flags, const char* name,
30 size_t result_size) 30 size_t result_size)
31 : raw_assembler_(new RawMachineAssembler( 31 : CodeStubAssembler(
32 isolate, new (zone) Graph(zone), 32 isolate, zone,
33 Linkage::GetStubCallDescriptor( 33 Linkage::GetStubCallDescriptor(
34 isolate, zone, descriptor, descriptor.GetStackParameterCount(), 34 isolate, zone, descriptor, descriptor.GetStackParameterCount(),
35 CallDescriptor::kNoFlags, Operator::kNoProperties, 35 CallDescriptor::kNoFlags, Operator::kNoProperties,
36 MachineType::AnyTagged(), result_size))), 36 MachineType::AnyTagged(), result_size),
37 flags_(flags), 37 flags, name) {}
38 name_(name),
39 code_generated_(false),
40 variables_(zone) {}
41 38
42 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, 39 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
43 int parameter_count, Code::Flags flags, 40 int parameter_count, Code::Flags flags,
44 const char* name) 41 const char* name)
45 : raw_assembler_(new RawMachineAssembler( 42 : CodeStubAssembler(isolate, zone, Linkage::GetJSCallDescriptor(
46 isolate, new (zone) Graph(zone), 43 zone, false, parameter_count,
47 Linkage::GetJSCallDescriptor(zone, false, parameter_count, 44 CallDescriptor::kNoFlags),
48 CallDescriptor::kNoFlags))), 45 flags, name) {}
46
47 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
48 CallDescriptor* call_descriptor,
49 Code::Flags flags, const char* name)
50 : raw_assembler_(new RawMachineAssembler(isolate, new (zone) Graph(zone),
51 call_descriptor)),
49 flags_(flags), 52 flags_(flags),
50 name_(name), 53 name_(name),
51 code_generated_(false), 54 code_generated_(false),
52 variables_(zone) {} 55 variables_(zone) {}
53 56
54 CodeStubAssembler::~CodeStubAssembler() {} 57 CodeStubAssembler::~CodeStubAssembler() {}
55 58
56 void CodeStubAssembler::CallPrologue() {} 59 void CodeStubAssembler::CallPrologue() {}
57 60
58 void CodeStubAssembler::CallEpilogue() {} 61 void CodeStubAssembler::CallEpilogue() {}
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 105 }
103 106
104 Node* CodeStubAssembler::Float64Constant(double value) { 107 Node* CodeStubAssembler::Float64Constant(double value) {
105 return raw_assembler_->Float64Constant(value); 108 return raw_assembler_->Float64Constant(value);
106 } 109 }
107 110
108 Node* CodeStubAssembler::HeapNumberMapConstant() { 111 Node* CodeStubAssembler::HeapNumberMapConstant() {
109 return HeapConstant(isolate()->factory()->heap_number_map()); 112 return HeapConstant(isolate()->factory()->heap_number_map());
110 } 113 }
111 114
115 Node* CodeStubAssembler::NullConstant() {
116 return LoadRoot(Heap::kNullValueRootIndex);
117 }
118
119 Node* CodeStubAssembler::UndefinedConstant() {
120 return LoadRoot(Heap::kUndefinedValueRootIndex);
121 }
122
112 Node* CodeStubAssembler::Parameter(int value) { 123 Node* CodeStubAssembler::Parameter(int value) {
113 return raw_assembler_->Parameter(value); 124 return raw_assembler_->Parameter(value);
114 } 125 }
115 126
127 Node* CodeStubAssembler::ContextParameter() {
128 const CallDescriptor* descriptor = raw_assembler_->call_descriptor();
129 DCHECK(descriptor->IsJSFunctionCall());
130
131 return Parameter(Linkage::GetJSCallContextParamIndex(
132 static_cast<int>(descriptor->JSParameterCount())));
133 }
116 134
117 void CodeStubAssembler::Return(Node* value) { 135 void CodeStubAssembler::Return(Node* value) {
118 return raw_assembler_->Return(value); 136 return raw_assembler_->Return(value);
119 } 137 }
120 138
121 void CodeStubAssembler::Bind(CodeStubAssembler::Label* label) { 139 void CodeStubAssembler::Bind(CodeStubAssembler::Label* label) {
122 return label->Bind(); 140 return label->Bind();
123 } 141 }
124 142
125 Node* CodeStubAssembler::LoadFramePointer() { 143 Node* CodeStubAssembler::LoadFramePointer() {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 #define DEFINE_CODE_STUB_ASSEMBER_UNARY_OP(name) \ 218 #define DEFINE_CODE_STUB_ASSEMBER_UNARY_OP(name) \
201 Node* CodeStubAssembler::name(Node* a) { return raw_assembler_->name(a); } 219 Node* CodeStubAssembler::name(Node* a) { return raw_assembler_->name(a); }
202 CODE_STUB_ASSEMBLER_UNARY_OP_LIST(DEFINE_CODE_STUB_ASSEMBER_UNARY_OP) 220 CODE_STUB_ASSEMBLER_UNARY_OP_LIST(DEFINE_CODE_STUB_ASSEMBER_UNARY_OP)
203 #undef DEFINE_CODE_STUB_ASSEMBER_UNARY_OP 221 #undef DEFINE_CODE_STUB_ASSEMBER_UNARY_OP
204 222
205 Node* CodeStubAssembler::WordIsSmi(Node* a) { 223 Node* CodeStubAssembler::WordIsSmi(Node* a) {
206 return WordEqual(raw_assembler_->WordAnd(a, IntPtrConstant(kSmiTagMask)), 224 return WordEqual(raw_assembler_->WordAnd(a, IntPtrConstant(kSmiTagMask)),
207 IntPtrConstant(0)); 225 IntPtrConstant(0));
208 } 226 }
209 227
210 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset) { 228 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset,
211 return raw_assembler_->Load(MachineType::AnyTagged(), buffer, 229 MachineType rep) {
212 IntPtrConstant(offset)); 230 return raw_assembler_->Load(rep, buffer, IntPtrConstant(offset));
213 } 231 }
214 232
215 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset) { 233 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset,
216 return raw_assembler_->Load(MachineType::AnyTagged(), object, 234 MachineType rep) {
235 return raw_assembler_->Load(rep, object,
217 IntPtrConstant(offset - kHeapObjectTag)); 236 IntPtrConstant(offset - kHeapObjectTag));
218 } 237 }
219 238
220 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { 239 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) {
221 return Load(MachineType::Float64(), object, 240 return Load(MachineType::Float64(), object,
222 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag)); 241 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag));
223 } 242 }
224 243
225 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { 244 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) {
226 return Load(MachineType::Uint8(), map, 245 return Load(MachineType::Uint8(), map,
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 } 946 }
928 } 947 }
929 } 948 }
930 949
931 bound_ = true; 950 bound_ = true;
932 } 951 }
933 952
934 } // namespace compiler 953 } // namespace compiler
935 } // namespace internal 954 } // namespace internal
936 } // namespace v8 955 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698