OLD | NEW |
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 Loading... |
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 Loading... |
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 |
116 | |
117 void CodeStubAssembler::Return(Node* value) { | 127 void CodeStubAssembler::Return(Node* value) { |
118 return raw_assembler_->Return(value); | 128 return raw_assembler_->Return(value); |
119 } | 129 } |
120 | 130 |
121 void CodeStubAssembler::Bind(CodeStubAssembler::Label* label) { | 131 void CodeStubAssembler::Bind(CodeStubAssembler::Label* label) { |
122 return label->Bind(); | 132 return label->Bind(); |
123 } | 133 } |
124 | 134 |
125 Node* CodeStubAssembler::LoadFramePointer() { | 135 Node* CodeStubAssembler::LoadFramePointer() { |
126 return raw_assembler_->LoadFramePointer(); | 136 return raw_assembler_->LoadFramePointer(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 #define DEFINE_CODE_STUB_ASSEMBER_UNARY_OP(name) \ | 210 #define DEFINE_CODE_STUB_ASSEMBER_UNARY_OP(name) \ |
201 Node* CodeStubAssembler::name(Node* a) { return raw_assembler_->name(a); } | 211 Node* CodeStubAssembler::name(Node* a) { return raw_assembler_->name(a); } |
202 CODE_STUB_ASSEMBLER_UNARY_OP_LIST(DEFINE_CODE_STUB_ASSEMBER_UNARY_OP) | 212 CODE_STUB_ASSEMBLER_UNARY_OP_LIST(DEFINE_CODE_STUB_ASSEMBER_UNARY_OP) |
203 #undef DEFINE_CODE_STUB_ASSEMBER_UNARY_OP | 213 #undef DEFINE_CODE_STUB_ASSEMBER_UNARY_OP |
204 | 214 |
205 Node* CodeStubAssembler::WordIsSmi(Node* a) { | 215 Node* CodeStubAssembler::WordIsSmi(Node* a) { |
206 return WordEqual(raw_assembler_->WordAnd(a, IntPtrConstant(kSmiTagMask)), | 216 return WordEqual(raw_assembler_->WordAnd(a, IntPtrConstant(kSmiTagMask)), |
207 IntPtrConstant(0)); | 217 IntPtrConstant(0)); |
208 } | 218 } |
209 | 219 |
210 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset) { | 220 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset, |
211 return raw_assembler_->Load(MachineType::AnyTagged(), buffer, | 221 MachineType rep) { |
212 IntPtrConstant(offset)); | 222 return raw_assembler_->Load(rep, buffer, IntPtrConstant(offset)); |
213 } | 223 } |
214 | 224 |
215 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset) { | 225 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset, |
216 return raw_assembler_->Load(MachineType::AnyTagged(), object, | 226 MachineType rep) { |
| 227 return raw_assembler_->Load(rep, object, |
217 IntPtrConstant(offset - kHeapObjectTag)); | 228 IntPtrConstant(offset - kHeapObjectTag)); |
218 } | 229 } |
219 | 230 |
220 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { | 231 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { |
221 return Load(MachineType::Float64(), object, | 232 return Load(MachineType::Float64(), object, |
222 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag)); | 233 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag)); |
223 } | 234 } |
224 | 235 |
225 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { | 236 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { |
226 return Load(MachineType::Uint8(), map, | 237 return Load(MachineType::Uint8(), map, |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 } | 938 } |
928 } | 939 } |
929 } | 940 } |
930 | 941 |
931 bound_ = true; | 942 bound_ = true; |
932 } | 943 } |
933 | 944 |
934 } // namespace compiler | 945 } // namespace compiler |
935 } // namespace internal | 946 } // namespace internal |
936 } // namespace v8 | 947 } // namespace v8 |
OLD | NEW |