| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | |
| 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | |
| 7 | |
| 8 #include "src/compiler/common-operator.h" | |
| 9 #include "src/compiler/graph-builder.h" | |
| 10 #include "src/compiler/linkage.h" | |
| 11 #include "src/compiler/machine-operator.h" | |
| 12 #include "src/compiler/node.h" | |
| 13 #include "src/compiler/operator.h" | |
| 14 | |
| 15 | |
| 16 namespace v8 { | |
| 17 namespace internal { | |
| 18 namespace compiler { | |
| 19 | |
| 20 class BasicBlock; | |
| 21 class Schedule; | |
| 22 | |
| 23 | |
| 24 class RawMachineAssembler : public GraphBuilder { | |
| 25 public: | |
| 26 class Label { | |
| 27 public: | |
| 28 Label() : block_(NULL), used_(false), bound_(false) {} | |
| 29 ~Label() { DCHECK(bound_ || !used_); } | |
| 30 | |
| 31 BasicBlock* block() { return block_; } | |
| 32 | |
| 33 private: | |
| 34 // Private constructor for exit label. | |
| 35 explicit Label(BasicBlock* block) | |
| 36 : block_(block), used_(false), bound_(false) {} | |
| 37 | |
| 38 BasicBlock* block_; | |
| 39 bool used_; | |
| 40 bool bound_; | |
| 41 friend class RawMachineAssembler; | |
| 42 DISALLOW_COPY_AND_ASSIGN(Label); | |
| 43 }; | |
| 44 | |
| 45 RawMachineAssembler(Isolate* isolate, Graph* graph, | |
| 46 const MachineSignature* machine_sig, | |
| 47 MachineType word = kMachPtr, | |
| 48 MachineOperatorBuilder::Flags flags = | |
| 49 MachineOperatorBuilder::Flag::kNoFlags); | |
| 50 ~RawMachineAssembler() override {} | |
| 51 | |
| 52 Zone* zone() const { return graph()->zone(); } | |
| 53 MachineOperatorBuilder* machine() { return &machine_; } | |
| 54 CommonOperatorBuilder* common() { return &common_; } | |
| 55 CallDescriptor* call_descriptor() const { return call_descriptor_; } | |
| 56 size_t parameter_count() const { return machine_sig_->parameter_count(); } | |
| 57 const MachineSignature* machine_sig() const { return machine_sig_; } | |
| 58 | |
| 59 Node* UndefinedConstant() { | |
| 60 Unique<HeapObject> unique = Unique<HeapObject>::CreateImmovable( | |
| 61 isolate()->factory()->undefined_value()); | |
| 62 return NewNode(common()->HeapConstant(unique)); | |
| 63 } | |
| 64 | |
| 65 // Constants. | |
| 66 Node* PointerConstant(void* value) { | |
| 67 return IntPtrConstant(reinterpret_cast<intptr_t>(value)); | |
| 68 } | |
| 69 Node* IntPtrConstant(intptr_t value) { | |
| 70 // TODO(dcarney): mark generated code as unserializable if value != 0. | |
| 71 return kPointerSize == 8 ? Int64Constant(value) | |
| 72 : Int32Constant(static_cast<int>(value)); | |
| 73 } | |
| 74 Node* Int32Constant(int32_t value) { | |
| 75 return NewNode(common()->Int32Constant(value)); | |
| 76 } | |
| 77 Node* Int64Constant(int64_t value) { | |
| 78 return NewNode(common()->Int64Constant(value)); | |
| 79 } | |
| 80 Node* NumberConstant(double value) { | |
| 81 return NewNode(common()->NumberConstant(value)); | |
| 82 } | |
| 83 Node* Float32Constant(float value) { | |
| 84 return NewNode(common()->Float32Constant(value)); | |
| 85 } | |
| 86 Node* Float64Constant(double value) { | |
| 87 return NewNode(common()->Float64Constant(value)); | |
| 88 } | |
| 89 Node* HeapConstant(Handle<HeapObject> object) { | |
| 90 Unique<HeapObject> val = Unique<HeapObject>::CreateUninitialized(object); | |
| 91 return NewNode(common()->HeapConstant(val)); | |
| 92 } | |
| 93 Node* ExternalConstant(ExternalReference address) { | |
| 94 return NewNode(common()->ExternalConstant(address)); | |
| 95 } | |
| 96 | |
| 97 Node* Projection(int index, Node* a) { | |
| 98 return NewNode(common()->Projection(index), a); | |
| 99 } | |
| 100 | |
| 101 // Memory Operations. | |
| 102 Node* Load(MachineType rep, Node* base) { | |
| 103 return Load(rep, base, IntPtrConstant(0)); | |
| 104 } | |
| 105 Node* Load(MachineType rep, Node* base, Node* index) { | |
| 106 return NewNode(machine()->Load(rep), base, index, graph()->start(), | |
| 107 graph()->start()); | |
| 108 } | |
| 109 void Store(MachineType rep, Node* base, Node* value) { | |
| 110 Store(rep, base, IntPtrConstant(0), value); | |
| 111 } | |
| 112 void Store(MachineType rep, Node* base, Node* index, Node* value) { | |
| 113 NewNode(machine()->Store(StoreRepresentation(rep, kNoWriteBarrier)), base, | |
| 114 index, value, graph()->start(), graph()->start()); | |
| 115 } | |
| 116 // Arithmetic Operations. | |
| 117 Node* WordAnd(Node* a, Node* b) { | |
| 118 return NewNode(machine()->WordAnd(), a, b); | |
| 119 } | |
| 120 Node* WordOr(Node* a, Node* b) { return NewNode(machine()->WordOr(), a, b); } | |
| 121 Node* WordXor(Node* a, Node* b) { | |
| 122 return NewNode(machine()->WordXor(), a, b); | |
| 123 } | |
| 124 Node* WordShl(Node* a, Node* b) { | |
| 125 return NewNode(machine()->WordShl(), a, b); | |
| 126 } | |
| 127 Node* WordShr(Node* a, Node* b) { | |
| 128 return NewNode(machine()->WordShr(), a, b); | |
| 129 } | |
| 130 Node* WordSar(Node* a, Node* b) { | |
| 131 return NewNode(machine()->WordSar(), a, b); | |
| 132 } | |
| 133 Node* WordRor(Node* a, Node* b) { | |
| 134 return NewNode(machine()->WordRor(), a, b); | |
| 135 } | |
| 136 Node* WordEqual(Node* a, Node* b) { | |
| 137 return NewNode(machine()->WordEqual(), a, b); | |
| 138 } | |
| 139 Node* WordNotEqual(Node* a, Node* b) { | |
| 140 return WordBinaryNot(WordEqual(a, b)); | |
| 141 } | |
| 142 Node* WordNot(Node* a) { | |
| 143 if (machine()->Is32()) { | |
| 144 return Word32Not(a); | |
| 145 } else { | |
| 146 return Word64Not(a); | |
| 147 } | |
| 148 } | |
| 149 Node* WordBinaryNot(Node* a) { | |
| 150 if (machine()->Is32()) { | |
| 151 return Word32BinaryNot(a); | |
| 152 } else { | |
| 153 return Word64BinaryNot(a); | |
| 154 } | |
| 155 } | |
| 156 | |
| 157 Node* Word32And(Node* a, Node* b) { | |
| 158 return NewNode(machine()->Word32And(), a, b); | |
| 159 } | |
| 160 Node* Word32Or(Node* a, Node* b) { | |
| 161 return NewNode(machine()->Word32Or(), a, b); | |
| 162 } | |
| 163 Node* Word32Xor(Node* a, Node* b) { | |
| 164 return NewNode(machine()->Word32Xor(), a, b); | |
| 165 } | |
| 166 Node* Word32Shl(Node* a, Node* b) { | |
| 167 return NewNode(machine()->Word32Shl(), a, b); | |
| 168 } | |
| 169 Node* Word32Shr(Node* a, Node* b) { | |
| 170 return NewNode(machine()->Word32Shr(), a, b); | |
| 171 } | |
| 172 Node* Word32Sar(Node* a, Node* b) { | |
| 173 return NewNode(machine()->Word32Sar(), a, b); | |
| 174 } | |
| 175 Node* Word32Ror(Node* a, Node* b) { | |
| 176 return NewNode(machine()->Word32Ror(), a, b); | |
| 177 } | |
| 178 Node* Word32Clz(Node* a) { return NewNode(machine()->Word32Clz(), a); } | |
| 179 Node* Word32Equal(Node* a, Node* b) { | |
| 180 return NewNode(machine()->Word32Equal(), a, b); | |
| 181 } | |
| 182 Node* Word32NotEqual(Node* a, Node* b) { | |
| 183 return Word32BinaryNot(Word32Equal(a, b)); | |
| 184 } | |
| 185 Node* Word32Not(Node* a) { return Word32Xor(a, Int32Constant(-1)); } | |
| 186 Node* Word32BinaryNot(Node* a) { return Word32Equal(a, Int32Constant(0)); } | |
| 187 | |
| 188 Node* Word64And(Node* a, Node* b) { | |
| 189 return NewNode(machine()->Word64And(), a, b); | |
| 190 } | |
| 191 Node* Word64Or(Node* a, Node* b) { | |
| 192 return NewNode(machine()->Word64Or(), a, b); | |
| 193 } | |
| 194 Node* Word64Xor(Node* a, Node* b) { | |
| 195 return NewNode(machine()->Word64Xor(), a, b); | |
| 196 } | |
| 197 Node* Word64Shl(Node* a, Node* b) { | |
| 198 return NewNode(machine()->Word64Shl(), a, b); | |
| 199 } | |
| 200 Node* Word64Shr(Node* a, Node* b) { | |
| 201 return NewNode(machine()->Word64Shr(), a, b); | |
| 202 } | |
| 203 Node* Word64Sar(Node* a, Node* b) { | |
| 204 return NewNode(machine()->Word64Sar(), a, b); | |
| 205 } | |
| 206 Node* Word64Ror(Node* a, Node* b) { | |
| 207 return NewNode(machine()->Word64Ror(), a, b); | |
| 208 } | |
| 209 Node* Word64Equal(Node* a, Node* b) { | |
| 210 return NewNode(machine()->Word64Equal(), a, b); | |
| 211 } | |
| 212 Node* Word64NotEqual(Node* a, Node* b) { | |
| 213 return Word64BinaryNot(Word64Equal(a, b)); | |
| 214 } | |
| 215 Node* Word64Not(Node* a) { return Word64Xor(a, Int64Constant(-1)); } | |
| 216 Node* Word64BinaryNot(Node* a) { return Word64Equal(a, Int64Constant(0)); } | |
| 217 | |
| 218 Node* Int32Add(Node* a, Node* b) { | |
| 219 return NewNode(machine()->Int32Add(), a, b); | |
| 220 } | |
| 221 Node* Int32AddWithOverflow(Node* a, Node* b) { | |
| 222 return NewNode(machine()->Int32AddWithOverflow(), a, b); | |
| 223 } | |
| 224 Node* Int32Sub(Node* a, Node* b) { | |
| 225 return NewNode(machine()->Int32Sub(), a, b); | |
| 226 } | |
| 227 Node* Int32SubWithOverflow(Node* a, Node* b) { | |
| 228 return NewNode(machine()->Int32SubWithOverflow(), a, b); | |
| 229 } | |
| 230 Node* Int32Mul(Node* a, Node* b) { | |
| 231 return NewNode(machine()->Int32Mul(), a, b); | |
| 232 } | |
| 233 Node* Int32MulHigh(Node* a, Node* b) { | |
| 234 return NewNode(machine()->Int32MulHigh(), a, b); | |
| 235 } | |
| 236 Node* Int32Div(Node* a, Node* b) { | |
| 237 return NewNode(machine()->Int32Div(), a, b, graph()->start()); | |
| 238 } | |
| 239 Node* Int32Mod(Node* a, Node* b) { | |
| 240 return NewNode(machine()->Int32Mod(), a, b, graph()->start()); | |
| 241 } | |
| 242 Node* Int32LessThan(Node* a, Node* b) { | |
| 243 return NewNode(machine()->Int32LessThan(), a, b); | |
| 244 } | |
| 245 Node* Int32LessThanOrEqual(Node* a, Node* b) { | |
| 246 return NewNode(machine()->Int32LessThanOrEqual(), a, b); | |
| 247 } | |
| 248 Node* Uint32Div(Node* a, Node* b) { | |
| 249 return NewNode(machine()->Uint32Div(), a, b, graph()->start()); | |
| 250 } | |
| 251 Node* Uint32LessThan(Node* a, Node* b) { | |
| 252 return NewNode(machine()->Uint32LessThan(), a, b); | |
| 253 } | |
| 254 Node* Uint32LessThanOrEqual(Node* a, Node* b) { | |
| 255 return NewNode(machine()->Uint32LessThanOrEqual(), a, b); | |
| 256 } | |
| 257 Node* Uint32Mod(Node* a, Node* b) { | |
| 258 return NewNode(machine()->Uint32Mod(), a, b, graph()->start()); | |
| 259 } | |
| 260 Node* Uint32MulHigh(Node* a, Node* b) { | |
| 261 return NewNode(machine()->Uint32MulHigh(), a, b); | |
| 262 } | |
| 263 Node* Int32GreaterThan(Node* a, Node* b) { return Int32LessThan(b, a); } | |
| 264 Node* Int32GreaterThanOrEqual(Node* a, Node* b) { | |
| 265 return Int32LessThanOrEqual(b, a); | |
| 266 } | |
| 267 Node* Int32Neg(Node* a) { return Int32Sub(Int32Constant(0), a); } | |
| 268 | |
| 269 Node* Int64Add(Node* a, Node* b) { | |
| 270 return NewNode(machine()->Int64Add(), a, b); | |
| 271 } | |
| 272 Node* Int64Sub(Node* a, Node* b) { | |
| 273 return NewNode(machine()->Int64Sub(), a, b); | |
| 274 } | |
| 275 Node* Int64Mul(Node* a, Node* b) { | |
| 276 return NewNode(machine()->Int64Mul(), a, b); | |
| 277 } | |
| 278 Node* Int64Div(Node* a, Node* b) { | |
| 279 return NewNode(machine()->Int64Div(), a, b); | |
| 280 } | |
| 281 Node* Int64Mod(Node* a, Node* b) { | |
| 282 return NewNode(machine()->Int64Mod(), a, b); | |
| 283 } | |
| 284 Node* Int64Neg(Node* a) { return Int64Sub(Int64Constant(0), a); } | |
| 285 Node* Int64LessThan(Node* a, Node* b) { | |
| 286 return NewNode(machine()->Int64LessThan(), a, b); | |
| 287 } | |
| 288 Node* Int64LessThanOrEqual(Node* a, Node* b) { | |
| 289 return NewNode(machine()->Int64LessThanOrEqual(), a, b); | |
| 290 } | |
| 291 Node* Uint64LessThan(Node* a, Node* b) { | |
| 292 return NewNode(machine()->Uint64LessThan(), a, b); | |
| 293 } | |
| 294 Node* Uint64LessThanOrEqual(Node* a, Node* b) { | |
| 295 return NewNode(machine()->Uint64LessThanOrEqual(), a, b); | |
| 296 } | |
| 297 Node* Int64GreaterThan(Node* a, Node* b) { return Int64LessThan(b, a); } | |
| 298 Node* Int64GreaterThanOrEqual(Node* a, Node* b) { | |
| 299 return Int64LessThanOrEqual(b, a); | |
| 300 } | |
| 301 Node* Uint64Div(Node* a, Node* b) { | |
| 302 return NewNode(machine()->Uint64Div(), a, b); | |
| 303 } | |
| 304 Node* Uint64Mod(Node* a, Node* b) { | |
| 305 return NewNode(machine()->Uint64Mod(), a, b); | |
| 306 } | |
| 307 | |
| 308 #define INTPTR_BINOP(prefix, name) \ | |
| 309 Node* IntPtr##name(Node* a, Node* b) { \ | |
| 310 return kPointerSize == 8 ? prefix##64##name(a, b) \ | |
| 311 : prefix##32##name(a, b); \ | |
| 312 } | |
| 313 | |
| 314 INTPTR_BINOP(Int, Add); | |
| 315 INTPTR_BINOP(Int, Sub); | |
| 316 INTPTR_BINOP(Int, LessThan); | |
| 317 INTPTR_BINOP(Int, LessThanOrEqual); | |
| 318 INTPTR_BINOP(Word, Equal); | |
| 319 INTPTR_BINOP(Word, NotEqual); | |
| 320 INTPTR_BINOP(Int, GreaterThanOrEqual); | |
| 321 INTPTR_BINOP(Int, GreaterThan); | |
| 322 | |
| 323 #undef INTPTR_BINOP | |
| 324 | |
| 325 Node* Float32Add(Node* a, Node* b) { | |
| 326 return NewNode(machine()->Float32Add(), a, b); | |
| 327 } | |
| 328 Node* Float32Sub(Node* a, Node* b) { | |
| 329 return NewNode(machine()->Float32Sub(), a, b); | |
| 330 } | |
| 331 Node* Float32Mul(Node* a, Node* b) { | |
| 332 return NewNode(machine()->Float32Mul(), a, b); | |
| 333 } | |
| 334 Node* Float32Div(Node* a, Node* b) { | |
| 335 return NewNode(machine()->Float32Div(), a, b); | |
| 336 } | |
| 337 Node* Float32Abs(Node* a) { return NewNode(machine()->Float32Abs(), a); } | |
| 338 Node* Float32Sqrt(Node* a) { return NewNode(machine()->Float32Sqrt(), a); } | |
| 339 Node* Float32Equal(Node* a, Node* b) { | |
| 340 return NewNode(machine()->Float32Equal(), a, b); | |
| 341 } | |
| 342 Node* Float32NotEqual(Node* a, Node* b) { | |
| 343 return WordBinaryNot(Float32Equal(a, b)); | |
| 344 } | |
| 345 Node* Float32LessThan(Node* a, Node* b) { | |
| 346 return NewNode(machine()->Float32LessThan(), a, b); | |
| 347 } | |
| 348 Node* Float32LessThanOrEqual(Node* a, Node* b) { | |
| 349 return NewNode(machine()->Float32LessThanOrEqual(), a, b); | |
| 350 } | |
| 351 Node* Float32GreaterThan(Node* a, Node* b) { return Float32LessThan(b, a); } | |
| 352 Node* Float32GreaterThanOrEqual(Node* a, Node* b) { | |
| 353 return Float32LessThanOrEqual(b, a); | |
| 354 } | |
| 355 | |
| 356 Node* Float64Add(Node* a, Node* b) { | |
| 357 return NewNode(machine()->Float64Add(), a, b); | |
| 358 } | |
| 359 Node* Float64Sub(Node* a, Node* b) { | |
| 360 return NewNode(machine()->Float64Sub(), a, b); | |
| 361 } | |
| 362 Node* Float64Mul(Node* a, Node* b) { | |
| 363 return NewNode(machine()->Float64Mul(), a, b); | |
| 364 } | |
| 365 Node* Float64Div(Node* a, Node* b) { | |
| 366 return NewNode(machine()->Float64Div(), a, b); | |
| 367 } | |
| 368 Node* Float64Mod(Node* a, Node* b) { | |
| 369 return NewNode(machine()->Float64Mod(), a, b); | |
| 370 } | |
| 371 Node* Float64Abs(Node* a) { return NewNode(machine()->Float64Abs(), a); } | |
| 372 Node* Float64Sqrt(Node* a) { return NewNode(machine()->Float64Sqrt(), a); } | |
| 373 Node* Float64Equal(Node* a, Node* b) { | |
| 374 return NewNode(machine()->Float64Equal(), a, b); | |
| 375 } | |
| 376 Node* Float64NotEqual(Node* a, Node* b) { | |
| 377 return WordBinaryNot(Float64Equal(a, b)); | |
| 378 } | |
| 379 Node* Float64LessThan(Node* a, Node* b) { | |
| 380 return NewNode(machine()->Float64LessThan(), a, b); | |
| 381 } | |
| 382 Node* Float64LessThanOrEqual(Node* a, Node* b) { | |
| 383 return NewNode(machine()->Float64LessThanOrEqual(), a, b); | |
| 384 } | |
| 385 Node* Float64GreaterThan(Node* a, Node* b) { return Float64LessThan(b, a); } | |
| 386 Node* Float64GreaterThanOrEqual(Node* a, Node* b) { | |
| 387 return Float64LessThanOrEqual(b, a); | |
| 388 } | |
| 389 | |
| 390 // Conversions. | |
| 391 Node* ChangeFloat32ToFloat64(Node* a) { | |
| 392 return NewNode(machine()->ChangeFloat32ToFloat64(), a); | |
| 393 } | |
| 394 Node* ChangeInt32ToFloat64(Node* a) { | |
| 395 return NewNode(machine()->ChangeInt32ToFloat64(), a); | |
| 396 } | |
| 397 Node* ChangeUint32ToFloat64(Node* a) { | |
| 398 return NewNode(machine()->ChangeUint32ToFloat64(), a); | |
| 399 } | |
| 400 Node* ChangeFloat64ToInt32(Node* a) { | |
| 401 return NewNode(machine()->ChangeFloat64ToInt32(), a); | |
| 402 } | |
| 403 Node* ChangeFloat64ToUint32(Node* a) { | |
| 404 return NewNode(machine()->ChangeFloat64ToUint32(), a); | |
| 405 } | |
| 406 Node* ChangeInt32ToInt64(Node* a) { | |
| 407 return NewNode(machine()->ChangeInt32ToInt64(), a); | |
| 408 } | |
| 409 Node* ChangeUint32ToUint64(Node* a) { | |
| 410 return NewNode(machine()->ChangeUint32ToUint64(), a); | |
| 411 } | |
| 412 Node* TruncateFloat64ToFloat32(Node* a) { | |
| 413 return NewNode(machine()->TruncateFloat64ToFloat32(), a); | |
| 414 } | |
| 415 Node* TruncateFloat64ToInt32(Node* a) { | |
| 416 return NewNode(machine()->TruncateFloat64ToInt32(), a); | |
| 417 } | |
| 418 Node* TruncateInt64ToInt32(Node* a) { | |
| 419 return NewNode(machine()->TruncateInt64ToInt32(), a); | |
| 420 } | |
| 421 Node* Float64RoundDown(Node* a) { | |
| 422 return NewNode(machine()->Float64RoundDown().op(), a); | |
| 423 } | |
| 424 Node* Float64RoundTruncate(Node* a) { | |
| 425 return NewNode(machine()->Float64RoundTruncate().op(), a); | |
| 426 } | |
| 427 Node* Float64RoundTiesAway(Node* a) { | |
| 428 return NewNode(machine()->Float64RoundTiesAway().op(), a); | |
| 429 } | |
| 430 | |
| 431 // Float64 bit operations. | |
| 432 Node* Float64ExtractLowWord32(Node* a) { | |
| 433 return NewNode(machine()->Float64ExtractLowWord32(), a); | |
| 434 } | |
| 435 Node* Float64ExtractHighWord32(Node* a) { | |
| 436 return NewNode(machine()->Float64ExtractHighWord32(), a); | |
| 437 } | |
| 438 Node* Float64InsertLowWord32(Node* a, Node* b) { | |
| 439 return NewNode(machine()->Float64InsertLowWord32(), a, b); | |
| 440 } | |
| 441 Node* Float64InsertHighWord32(Node* a, Node* b) { | |
| 442 return NewNode(machine()->Float64InsertHighWord32(), a, b); | |
| 443 } | |
| 444 | |
| 445 // Stack operations. | |
| 446 Node* LoadStackPointer() { return NewNode(machine()->LoadStackPointer()); } | |
| 447 Node* LoadFramePointer() { return NewNode(machine()->LoadFramePointer()); } | |
| 448 | |
| 449 // Parameters. | |
| 450 Node* Parameter(size_t index); | |
| 451 | |
| 452 // Pointer utilities. | |
| 453 Node* LoadFromPointer(void* address, MachineType rep, int32_t offset = 0) { | |
| 454 return Load(rep, PointerConstant(address), Int32Constant(offset)); | |
| 455 } | |
| 456 void StoreToPointer(void* address, MachineType rep, Node* node) { | |
| 457 Store(rep, PointerConstant(address), node); | |
| 458 } | |
| 459 Node* StringConstant(const char* string) { | |
| 460 return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); | |
| 461 } | |
| 462 | |
| 463 // Control flow. | |
| 464 void Goto(Label* label); | |
| 465 void Branch(Node* condition, Label* true_val, Label* false_val); | |
| 466 void Switch(Node* index, Label* default_label, int32_t* case_values, | |
| 467 Label** case_labels, size_t case_count); | |
| 468 // Call through CallFunctionStub with lazy deopt and frame-state. | |
| 469 Node* CallFunctionStub0(Node* function, Node* receiver, Node* context, | |
| 470 Node* frame_state, CallFunctionFlags flags); | |
| 471 // Call to a JS function with zero parameters. | |
| 472 Node* CallJS0(Node* function, Node* receiver, Node* context, | |
| 473 Node* frame_state); | |
| 474 // Call to a runtime function with zero parameters. | |
| 475 Node* CallRuntime1(Runtime::FunctionId function, Node* arg0, Node* context, | |
| 476 Node* frame_state); | |
| 477 // Call to a C function with zero parameters. | |
| 478 Node* CallCFunction0(MachineType return_type, Node* function); | |
| 479 // Call to a C function with one parameter. | |
| 480 Node* CallCFunction1(MachineType return_type, MachineType arg0_type, | |
| 481 Node* function, Node* arg0); | |
| 482 // Call to a C function with two parameters. | |
| 483 Node* CallCFunction2(MachineType return_type, MachineType arg0_type, | |
| 484 MachineType arg1_type, Node* function, Node* arg0, | |
| 485 Node* arg1); | |
| 486 // Call to a C function with eight parameters. | |
| 487 Node* CallCFunction8(MachineType return_type, MachineType arg0_type, | |
| 488 MachineType arg1_type, MachineType arg2_type, | |
| 489 MachineType arg3_type, MachineType arg4_type, | |
| 490 MachineType arg5_type, MachineType arg6_type, | |
| 491 MachineType arg7_type, Node* function, Node* arg0, | |
| 492 Node* arg1, Node* arg2, Node* arg3, Node* arg4, | |
| 493 Node* arg5, Node* arg6, Node* arg7); | |
| 494 void Return(Node* value); | |
| 495 void Bind(Label* label); | |
| 496 void Deoptimize(Node* state); | |
| 497 | |
| 498 // Variables. | |
| 499 Node* Phi(MachineType type, Node* n1, Node* n2) { | |
| 500 return NewNode(common()->Phi(type, 2), n1, n2); | |
| 501 } | |
| 502 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) { | |
| 503 return NewNode(common()->Phi(type, 3), n1, n2, n3); | |
| 504 } | |
| 505 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) { | |
| 506 return NewNode(common()->Phi(type, 4), n1, n2, n3, n4); | |
| 507 } | |
| 508 | |
| 509 // MachineAssembler is invalid after export. | |
| 510 Schedule* Export(); | |
| 511 | |
| 512 protected: | |
| 513 Node* MakeNode(const Operator* op, int input_count, Node** inputs, | |
| 514 bool incomplete) final; | |
| 515 | |
| 516 bool ScheduleValid() { return schedule_ != NULL; } | |
| 517 | |
| 518 Schedule* schedule() { | |
| 519 DCHECK(ScheduleValid()); | |
| 520 return schedule_; | |
| 521 } | |
| 522 | |
| 523 private: | |
| 524 BasicBlock* Use(Label* label); | |
| 525 BasicBlock* EnsureBlock(Label* label); | |
| 526 BasicBlock* CurrentBlock(); | |
| 527 | |
| 528 Schedule* schedule_; | |
| 529 MachineOperatorBuilder machine_; | |
| 530 CommonOperatorBuilder common_; | |
| 531 const MachineSignature* machine_sig_; | |
| 532 CallDescriptor* call_descriptor_; | |
| 533 Node** parameters_; | |
| 534 BasicBlock* current_block_; | |
| 535 | |
| 536 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | |
| 537 }; | |
| 538 | |
| 539 } // namespace compiler | |
| 540 } // namespace internal | |
| 541 } // namespace v8 | |
| 542 | |
| 543 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | |
| OLD | NEW |