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, name) {} |
| 38 |
| 39 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, |
| 40 int parameter_count, Code::Flags flags, |
| 41 const char* name) |
| 42 : CodeStubAssembler(isolate, zone, Linkage::GetJSCallDescriptor( |
| 43 zone, false, parameter_count, |
| 44 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)), |
37 flags_(flags), | 52 flags_(flags), |
38 name_(name), | 53 name_(name), |
39 code_generated_(false), | 54 code_generated_(false), |
40 variables_(zone) {} | 55 variables_(zone) {} |
41 | 56 |
42 CodeStubAssembler::~CodeStubAssembler() {} | 57 CodeStubAssembler::~CodeStubAssembler() {} |
43 | 58 |
44 void CodeStubAssembler::CallPrologue() {} | 59 void CodeStubAssembler::CallPrologue() {} |
45 | 60 |
46 void CodeStubAssembler::CallEpilogue() {} | 61 void CodeStubAssembler::CallEpilogue() {} |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 94 |
80 | 95 |
81 Node* CodeStubAssembler::BooleanConstant(bool value) { | 96 Node* CodeStubAssembler::BooleanConstant(bool value) { |
82 return raw_assembler_->BooleanConstant(value); | 97 return raw_assembler_->BooleanConstant(value); |
83 } | 98 } |
84 | 99 |
85 Node* CodeStubAssembler::ExternalConstant(ExternalReference address) { | 100 Node* CodeStubAssembler::ExternalConstant(ExternalReference address) { |
86 return raw_assembler_->ExternalConstant(address); | 101 return raw_assembler_->ExternalConstant(address); |
87 } | 102 } |
88 | 103 |
| 104 Node* CodeStubAssembler::NullConstant() { |
| 105 return LoadRoot(Heap::kNullValueRootIndex); |
| 106 } |
| 107 |
| 108 Node* CodeStubAssembler::UndefinedConstant() { |
| 109 return LoadRoot(Heap::kUndefinedValueRootIndex); |
| 110 } |
| 111 |
89 Node* CodeStubAssembler::Parameter(int value) { | 112 Node* CodeStubAssembler::Parameter(int value) { |
90 return raw_assembler_->Parameter(value); | 113 return raw_assembler_->Parameter(value); |
91 } | 114 } |
92 | 115 |
93 | 116 |
94 void CodeStubAssembler::Return(Node* value) { | 117 void CodeStubAssembler::Return(Node* value) { |
95 return raw_assembler_->Return(value); | 118 return raw_assembler_->Return(value); |
96 } | 119 } |
97 | 120 |
98 void CodeStubAssembler::Bind(CodeStubAssembler::Label* label) { | 121 void CodeStubAssembler::Bind(CodeStubAssembler::Label* label) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return WordEqual(raw_assembler_->WordAnd(a, Int32Constant(kSmiTagMask)), | 167 return WordEqual(raw_assembler_->WordAnd(a, Int32Constant(kSmiTagMask)), |
145 Int32Constant(0)); | 168 Int32Constant(0)); |
146 } | 169 } |
147 | 170 |
148 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset) { | 171 Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset) { |
149 return raw_assembler_->Load(MachineType::AnyTagged(), buffer, | 172 return raw_assembler_->Load(MachineType::AnyTagged(), buffer, |
150 IntPtrConstant(offset)); | 173 IntPtrConstant(offset)); |
151 } | 174 } |
152 | 175 |
153 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset) { | 176 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset) { |
154 return raw_assembler_->Load(MachineType::AnyTagged(), object, | 177 return LoadObjectFieldTyped(object, offset, MachineType::AnyTagged()); |
155 IntPtrConstant(offset - kHeapObjectTag)); | 178 } |
| 179 |
| 180 Node* CodeStubAssembler::LoadObjectFieldTyped(Node* object, int offset, |
| 181 MachineType rep) { |
| 182 return LoadNativeFieldTyped(object, offset - kHeapObjectTag, rep); |
| 183 } |
| 184 |
| 185 Node* CodeStubAssembler::LoadNativeFieldTyped(Node* object, int offset, |
| 186 MachineType rep) { |
| 187 return raw_assembler_->Load(rep, object, IntPtrConstant(offset)); |
156 } | 188 } |
157 | 189 |
158 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, | 190 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, |
159 Node* smi_index, | 191 Node* smi_index, |
160 int additional_offset) { | 192 int additional_offset) { |
161 Node* header_size = raw_assembler_->Int32Constant( | 193 Node* header_size = raw_assembler_->Int32Constant( |
162 additional_offset + FixedArray::kHeaderSize - kHeapObjectTag); | 194 additional_offset + FixedArray::kHeaderSize - kHeapObjectTag); |
163 Node* scaled_index = | 195 Node* scaled_index = |
164 (kSmiShiftSize == 0) | 196 (kSmiShiftSize == 0) |
165 ? raw_assembler_->Word32Shl( | 197 ? raw_assembler_->Word32Shl( |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } | 638 } |
607 } | 639 } |
608 } | 640 } |
609 | 641 |
610 bound_ = true; | 642 bound_ = true; |
611 } | 643 } |
612 | 644 |
613 } // namespace compiler | 645 } // namespace compiler |
614 } // namespace internal | 646 } // namespace internal |
615 } // namespace v8 | 647 } // namespace v8 |
OLD | NEW |