| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 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/int64-lowering.h" | 5 #include "src/compiler/int64-lowering.h" |
| 6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
| 7 #include "src/compiler/diamond.h" | 7 #include "src/compiler/diamond.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 ReplaceNode(node, low_node, high_node); | 261 ReplaceNode(node, low_node, high_node); |
| 262 break; | 262 break; |
| 263 } | 263 } |
| 264 case IrOpcode::kTruncateInt64ToInt32: { | 264 case IrOpcode::kTruncateInt64ToInt32: { |
| 265 DCHECK(node->InputCount() == 1); | 265 DCHECK(node->InputCount() == 1); |
| 266 Node* input = node->InputAt(0); | 266 Node* input = node->InputAt(0); |
| 267 ReplaceNode(node, GetReplacementLow(input), nullptr); | 267 ReplaceNode(node, GetReplacementLow(input), nullptr); |
| 268 node->NullAllInputs(); | 268 node->NullAllInputs(); |
| 269 break; | 269 break; |
| 270 } | 270 } |
| 271 // todo(ahaas): I added a list of missing instructions here to make merging | |
| 272 // easier when I do them one by one. | |
| 273 // kExprI64Add: | |
| 274 case IrOpcode::kInt64Add: { | 271 case IrOpcode::kInt64Add: { |
| 275 DCHECK(node->InputCount() == 2); | 272 DCHECK(node->InputCount() == 2); |
| 276 | 273 |
| 277 Node* right = node->InputAt(1); | 274 Node* right = node->InputAt(1); |
| 278 node->ReplaceInput(1, GetReplacementLow(right)); | 275 node->ReplaceInput(1, GetReplacementLow(right)); |
| 279 node->AppendInput(zone(), GetReplacementHigh(right)); | 276 node->AppendInput(zone(), GetReplacementHigh(right)); |
| 280 | 277 |
| 281 Node* left = node->InputAt(0); | 278 Node* left = node->InputAt(0); |
| 282 node->ReplaceInput(0, GetReplacementLow(left)); | 279 node->ReplaceInput(0, GetReplacementLow(left)); |
| 283 node->InsertInput(zone(), 1, GetReplacementHigh(left)); | 280 node->InsertInput(zone(), 1, GetReplacementHigh(left)); |
| 284 | 281 |
| 285 NodeProperties::ChangeOp(node, machine()->Int32PairAdd()); | 282 NodeProperties::ChangeOp(node, machine()->Int32PairAdd()); |
| 286 // We access the additional return values through projections. | 283 // We access the additional return values through projections. |
| 287 Node* low_node = graph()->NewNode(common()->Projection(0), node); | 284 Node* low_node = graph()->NewNode(common()->Projection(0), node); |
| 288 Node* high_node = graph()->NewNode(common()->Projection(1), node); | 285 Node* high_node = graph()->NewNode(common()->Projection(1), node); |
| 289 ReplaceNode(node, low_node, high_node); | 286 ReplaceNode(node, low_node, high_node); |
| 290 break; | 287 break; |
| 291 } | 288 } |
| 292 | |
| 293 // kExprI64Sub: | |
| 294 case IrOpcode::kInt64Sub: { | 289 case IrOpcode::kInt64Sub: { |
| 295 DCHECK(node->InputCount() == 2); | 290 DCHECK(node->InputCount() == 2); |
| 296 | 291 |
| 297 Node* right = node->InputAt(1); | 292 Node* right = node->InputAt(1); |
| 298 node->ReplaceInput(1, GetReplacementLow(right)); | 293 node->ReplaceInput(1, GetReplacementLow(right)); |
| 299 node->AppendInput(zone(), GetReplacementHigh(right)); | 294 node->AppendInput(zone(), GetReplacementHigh(right)); |
| 300 | 295 |
| 301 Node* left = node->InputAt(0); | 296 Node* left = node->InputAt(0); |
| 302 node->ReplaceInput(0, GetReplacementLow(left)); | 297 node->ReplaceInput(0, GetReplacementLow(left)); |
| 303 node->InsertInput(zone(), 1, GetReplacementHigh(left)); | 298 node->InsertInput(zone(), 1, GetReplacementHigh(left)); |
| 304 | 299 |
| 305 NodeProperties::ChangeOp(node, machine()->Int32PairSub()); | 300 NodeProperties::ChangeOp(node, machine()->Int32PairSub()); |
| 306 // We access the additional return values through projections. | 301 // We access the additional return values through projections. |
| 307 Node* low_node = graph()->NewNode(common()->Projection(0), node); | 302 Node* low_node = graph()->NewNode(common()->Projection(0), node); |
| 308 Node* high_node = graph()->NewNode(common()->Projection(1), node); | 303 Node* high_node = graph()->NewNode(common()->Projection(1), node); |
| 309 ReplaceNode(node, low_node, high_node); | 304 ReplaceNode(node, low_node, high_node); |
| 310 break; | 305 break; |
| 311 } | 306 } |
| 312 // kExprI64Mul: | |
| 313 case IrOpcode::kInt64Mul: { | 307 case IrOpcode::kInt64Mul: { |
| 314 DCHECK(node->InputCount() == 2); | 308 DCHECK(node->InputCount() == 2); |
| 315 | 309 |
| 316 Node* right = node->InputAt(1); | 310 Node* right = node->InputAt(1); |
| 317 node->ReplaceInput(1, GetReplacementLow(right)); | 311 node->ReplaceInput(1, GetReplacementLow(right)); |
| 318 node->AppendInput(zone(), GetReplacementHigh(right)); | 312 node->AppendInput(zone(), GetReplacementHigh(right)); |
| 319 | 313 |
| 320 Node* left = node->InputAt(0); | 314 Node* left = node->InputAt(0); |
| 321 node->ReplaceInput(0, GetReplacementLow(left)); | 315 node->ReplaceInput(0, GetReplacementLow(left)); |
| 322 node->InsertInput(zone(), 1, GetReplacementHigh(left)); | 316 node->InsertInput(zone(), 1, GetReplacementHigh(left)); |
| 323 | 317 |
| 324 NodeProperties::ChangeOp(node, machine()->Int32PairMul()); | 318 NodeProperties::ChangeOp(node, machine()->Int32PairMul()); |
| 325 // We access the additional return values through projections. | 319 // We access the additional return values through projections. |
| 326 Node* low_node = graph()->NewNode(common()->Projection(0), node); | 320 Node* low_node = graph()->NewNode(common()->Projection(0), node); |
| 327 Node* high_node = graph()->NewNode(common()->Projection(1), node); | 321 Node* high_node = graph()->NewNode(common()->Projection(1), node); |
| 328 ReplaceNode(node, low_node, high_node); | 322 ReplaceNode(node, low_node, high_node); |
| 329 break; | 323 break; |
| 330 } | 324 } |
| 331 // kExprI64DivS: | |
| 332 // kExprI64DivU: | |
| 333 // kExprI64RemS: | |
| 334 // kExprI64RemU: | |
| 335 // kExprI64Ior: | |
| 336 case IrOpcode::kWord64Or: { | 325 case IrOpcode::kWord64Or: { |
| 337 DCHECK(node->InputCount() == 2); | 326 DCHECK(node->InputCount() == 2); |
| 338 Node* left = node->InputAt(0); | 327 Node* left = node->InputAt(0); |
| 339 Node* right = node->InputAt(1); | 328 Node* right = node->InputAt(1); |
| 340 | 329 |
| 341 Node* low_node = | 330 Node* low_node = |
| 342 graph()->NewNode(machine()->Word32Or(), GetReplacementLow(left), | 331 graph()->NewNode(machine()->Word32Or(), GetReplacementLow(left), |
| 343 GetReplacementLow(right)); | 332 GetReplacementLow(right)); |
| 344 Node* high_node = | 333 Node* high_node = |
| 345 graph()->NewNode(machine()->Word32Or(), GetReplacementHigh(left), | 334 graph()->NewNode(machine()->Word32Or(), GetReplacementHigh(left), |
| 346 GetReplacementHigh(right)); | 335 GetReplacementHigh(right)); |
| 347 ReplaceNode(node, low_node, high_node); | 336 ReplaceNode(node, low_node, high_node); |
| 348 break; | 337 break; |
| 349 } | 338 } |
| 350 | |
| 351 // kExprI64Xor: | |
| 352 case IrOpcode::kWord64Xor: { | 339 case IrOpcode::kWord64Xor: { |
| 353 DCHECK(node->InputCount() == 2); | 340 DCHECK(node->InputCount() == 2); |
| 354 Node* left = node->InputAt(0); | 341 Node* left = node->InputAt(0); |
| 355 Node* right = node->InputAt(1); | 342 Node* right = node->InputAt(1); |
| 356 | 343 |
| 357 Node* low_node = | 344 Node* low_node = |
| 358 graph()->NewNode(machine()->Word32Xor(), GetReplacementLow(left), | 345 graph()->NewNode(machine()->Word32Xor(), GetReplacementLow(left), |
| 359 GetReplacementLow(right)); | 346 GetReplacementLow(right)); |
| 360 Node* high_node = | 347 Node* high_node = |
| 361 graph()->NewNode(machine()->Word32Xor(), GetReplacementHigh(left), | 348 graph()->NewNode(machine()->Word32Xor(), GetReplacementHigh(left), |
| 362 GetReplacementHigh(right)); | 349 GetReplacementHigh(right)); |
| 363 ReplaceNode(node, low_node, high_node); | 350 ReplaceNode(node, low_node, high_node); |
| 364 break; | 351 break; |
| 365 } | 352 } |
| 366 // kExprI64Shl: | |
| 367 case IrOpcode::kWord64Shl: { | 353 case IrOpcode::kWord64Shl: { |
| 368 // TODO(turbofan): if the shift count >= 32, then we can set the low word | 354 // TODO(turbofan): if the shift count >= 32, then we can set the low word |
| 369 // of the output to 0 and just calculate the high word. | 355 // of the output to 0 and just calculate the high word. |
| 370 DCHECK(node->InputCount() == 2); | 356 DCHECK(node->InputCount() == 2); |
| 371 Node* shift = node->InputAt(1); | 357 Node* shift = node->InputAt(1); |
| 372 if (HasReplacementLow(shift)) { | 358 if (HasReplacementLow(shift)) { |
| 373 // We do not have to care about the high word replacement, because | 359 // We do not have to care about the high word replacement, because |
| 374 // the shift can only be between 0 and 63 anyways. | 360 // the shift can only be between 0 and 63 anyways. |
| 375 node->ReplaceInput(1, GetReplacementLow(shift)); | 361 node->ReplaceInput(1, GetReplacementLow(shift)); |
| 376 } | 362 } |
| 377 | 363 |
| 378 Node* value = node->InputAt(0); | 364 Node* value = node->InputAt(0); |
| 379 node->ReplaceInput(0, GetReplacementLow(value)); | 365 node->ReplaceInput(0, GetReplacementLow(value)); |
| 380 node->InsertInput(zone(), 1, GetReplacementHigh(value)); | 366 node->InsertInput(zone(), 1, GetReplacementHigh(value)); |
| 381 | 367 |
| 382 NodeProperties::ChangeOp(node, machine()->Word32PairShl()); | 368 NodeProperties::ChangeOp(node, machine()->Word32PairShl()); |
| 383 // We access the additional return values through projections. | 369 // We access the additional return values through projections. |
| 384 Node* low_node = graph()->NewNode(common()->Projection(0), node); | 370 Node* low_node = graph()->NewNode(common()->Projection(0), node); |
| 385 Node* high_node = graph()->NewNode(common()->Projection(1), node); | 371 Node* high_node = graph()->NewNode(common()->Projection(1), node); |
| 386 ReplaceNode(node, low_node, high_node); | 372 ReplaceNode(node, low_node, high_node); |
| 387 break; | 373 break; |
| 388 } | 374 } |
| 389 // kExprI64ShrU: | |
| 390 case IrOpcode::kWord64Shr: { | 375 case IrOpcode::kWord64Shr: { |
| 391 // TODO(turbofan): if the shift count >= 32, then we can set the low word | 376 // TODO(turbofan): if the shift count >= 32, then we can set the low word |
| 392 // of the output to 0 and just calculate the high word. | 377 // of the output to 0 and just calculate the high word. |
| 393 DCHECK(node->InputCount() == 2); | 378 DCHECK(node->InputCount() == 2); |
| 394 Node* shift = node->InputAt(1); | 379 Node* shift = node->InputAt(1); |
| 395 if (HasReplacementLow(shift)) { | 380 if (HasReplacementLow(shift)) { |
| 396 // We do not have to care about the high word replacement, because | 381 // We do not have to care about the high word replacement, because |
| 397 // the shift can only be between 0 and 63 anyways. | 382 // the shift can only be between 0 and 63 anyways. |
| 398 node->ReplaceInput(1, GetReplacementLow(shift)); | 383 node->ReplaceInput(1, GetReplacementLow(shift)); |
| 399 } | 384 } |
| 400 | 385 |
| 401 Node* value = node->InputAt(0); | 386 Node* value = node->InputAt(0); |
| 402 node->ReplaceInput(0, GetReplacementLow(value)); | 387 node->ReplaceInput(0, GetReplacementLow(value)); |
| 403 node->InsertInput(zone(), 1, GetReplacementHigh(value)); | 388 node->InsertInput(zone(), 1, GetReplacementHigh(value)); |
| 404 | 389 |
| 405 NodeProperties::ChangeOp(node, machine()->Word32PairShr()); | 390 NodeProperties::ChangeOp(node, machine()->Word32PairShr()); |
| 406 // We access the additional return values through projections. | 391 // We access the additional return values through projections. |
| 407 Node* low_node = graph()->NewNode(common()->Projection(0), node); | 392 Node* low_node = graph()->NewNode(common()->Projection(0), node); |
| 408 Node* high_node = graph()->NewNode(common()->Projection(1), node); | 393 Node* high_node = graph()->NewNode(common()->Projection(1), node); |
| 409 ReplaceNode(node, low_node, high_node); | 394 ReplaceNode(node, low_node, high_node); |
| 410 break; | 395 break; |
| 411 } | 396 } |
| 412 // kExprI64ShrS: | |
| 413 case IrOpcode::kWord64Sar: { | 397 case IrOpcode::kWord64Sar: { |
| 414 // TODO(turbofan): if the shift count >= 32, then we can set the low word | 398 // TODO(turbofan): if the shift count >= 32, then we can set the low word |
| 415 // of the output to 0 and just calculate the high word. | 399 // of the output to 0 and just calculate the high word. |
| 416 DCHECK(node->InputCount() == 2); | 400 DCHECK(node->InputCount() == 2); |
| 417 Node* shift = node->InputAt(1); | 401 Node* shift = node->InputAt(1); |
| 418 if (HasReplacementLow(shift)) { | 402 if (HasReplacementLow(shift)) { |
| 419 // We do not have to care about the high word replacement, because | 403 // We do not have to care about the high word replacement, because |
| 420 // the shift can only be between 0 and 63 anyways. | 404 // the shift can only be between 0 and 63 anyways. |
| 421 node->ReplaceInput(1, GetReplacementLow(shift)); | 405 node->ReplaceInput(1, GetReplacementLow(shift)); |
| 422 } | 406 } |
| 423 | 407 |
| 424 Node* value = node->InputAt(0); | 408 Node* value = node->InputAt(0); |
| 425 node->ReplaceInput(0, GetReplacementLow(value)); | 409 node->ReplaceInput(0, GetReplacementLow(value)); |
| 426 node->InsertInput(zone(), 1, GetReplacementHigh(value)); | 410 node->InsertInput(zone(), 1, GetReplacementHigh(value)); |
| 427 | 411 |
| 428 NodeProperties::ChangeOp(node, machine()->Word32PairSar()); | 412 NodeProperties::ChangeOp(node, machine()->Word32PairSar()); |
| 429 // We access the additional return values through projections. | 413 // We access the additional return values through projections. |
| 430 Node* low_node = graph()->NewNode(common()->Projection(0), node); | 414 Node* low_node = graph()->NewNode(common()->Projection(0), node); |
| 431 Node* high_node = graph()->NewNode(common()->Projection(1), node); | 415 Node* high_node = graph()->NewNode(common()->Projection(1), node); |
| 432 ReplaceNode(node, low_node, high_node); | 416 ReplaceNode(node, low_node, high_node); |
| 433 break; | 417 break; |
| 434 } | 418 } |
| 435 // kExprI64Eq: | |
| 436 case IrOpcode::kWord64Equal: { | 419 case IrOpcode::kWord64Equal: { |
| 437 DCHECK(node->InputCount() == 2); | 420 DCHECK(node->InputCount() == 2); |
| 438 Node* left = node->InputAt(0); | 421 Node* left = node->InputAt(0); |
| 439 Node* right = node->InputAt(1); | 422 Node* right = node->InputAt(1); |
| 440 | 423 |
| 441 // TODO(wasm): Use explicit comparisons and && here? | 424 // TODO(wasm): Use explicit comparisons and && here? |
| 442 Node* replacement = graph()->NewNode( | 425 Node* replacement = graph()->NewNode( |
| 443 machine()->Word32Equal(), | 426 machine()->Word32Equal(), |
| 444 graph()->NewNode( | 427 graph()->NewNode( |
| 445 machine()->Word32Or(), | 428 machine()->Word32Or(), |
| 446 graph()->NewNode(machine()->Word32Xor(), GetReplacementLow(left), | 429 graph()->NewNode(machine()->Word32Xor(), GetReplacementLow(left), |
| 447 GetReplacementLow(right)), | 430 GetReplacementLow(right)), |
| 448 graph()->NewNode(machine()->Word32Xor(), GetReplacementHigh(left), | 431 graph()->NewNode(machine()->Word32Xor(), GetReplacementHigh(left), |
| 449 GetReplacementHigh(right))), | 432 GetReplacementHigh(right))), |
| 450 graph()->NewNode(common()->Int32Constant(0))); | 433 graph()->NewNode(common()->Int32Constant(0))); |
| 451 | 434 |
| 452 ReplaceNode(node, replacement, nullptr); | 435 ReplaceNode(node, replacement, nullptr); |
| 453 break; | 436 break; |
| 454 } | 437 } |
| 455 // kExprI64LtS: | |
| 456 case IrOpcode::kInt64LessThan: { | 438 case IrOpcode::kInt64LessThan: { |
| 457 LowerComparison(node, machine()->Int32LessThan(), | 439 LowerComparison(node, machine()->Int32LessThan(), |
| 458 machine()->Uint32LessThan()); | 440 machine()->Uint32LessThan()); |
| 459 break; | 441 break; |
| 460 } | 442 } |
| 461 case IrOpcode::kInt64LessThanOrEqual: { | 443 case IrOpcode::kInt64LessThanOrEqual: { |
| 462 LowerComparison(node, machine()->Int32LessThan(), | 444 LowerComparison(node, machine()->Int32LessThan(), |
| 463 machine()->Uint32LessThanOrEqual()); | 445 machine()->Uint32LessThanOrEqual()); |
| 464 break; | 446 break; |
| 465 } | 447 } |
| 466 case IrOpcode::kUint64LessThan: { | 448 case IrOpcode::kUint64LessThan: { |
| 467 LowerComparison(node, machine()->Uint32LessThan(), | 449 LowerComparison(node, machine()->Uint32LessThan(), |
| 468 machine()->Uint32LessThan()); | 450 machine()->Uint32LessThan()); |
| 469 break; | 451 break; |
| 470 } | 452 } |
| 471 case IrOpcode::kUint64LessThanOrEqual: { | 453 case IrOpcode::kUint64LessThanOrEqual: { |
| 472 LowerComparison(node, machine()->Uint32LessThan(), | 454 LowerComparison(node, machine()->Uint32LessThan(), |
| 473 machine()->Uint32LessThanOrEqual()); | 455 machine()->Uint32LessThanOrEqual()); |
| 474 break; | 456 break; |
| 475 } | 457 } |
| 476 | |
| 477 // kExprI64SConvertI32: | |
| 478 case IrOpcode::kChangeInt32ToInt64: { | 458 case IrOpcode::kChangeInt32ToInt64: { |
| 479 DCHECK(node->InputCount() == 1); | 459 DCHECK(node->InputCount() == 1); |
| 480 Node* input = node->InputAt(0); | 460 Node* input = node->InputAt(0); |
| 481 if (HasReplacementLow(input)) { | 461 if (HasReplacementLow(input)) { |
| 482 input = GetReplacementLow(input); | 462 input = GetReplacementLow(input); |
| 483 } | 463 } |
| 484 // We use SAR to preserve the sign in the high word. | 464 // We use SAR to preserve the sign in the high word. |
| 485 ReplaceNode( | 465 ReplaceNode( |
| 486 node, input, | 466 node, input, |
| 487 graph()->NewNode(machine()->Word32Sar(), input, | 467 graph()->NewNode(machine()->Word32Sar(), input, |
| 488 graph()->NewNode(common()->Int32Constant(31)))); | 468 graph()->NewNode(common()->Int32Constant(31)))); |
| 489 node->NullAllInputs(); | 469 node->NullAllInputs(); |
| 490 break; | 470 break; |
| 491 } | 471 } |
| 492 // kExprI64UConvertI32: { | |
| 493 case IrOpcode::kChangeUint32ToUint64: { | 472 case IrOpcode::kChangeUint32ToUint64: { |
| 494 DCHECK(node->InputCount() == 1); | 473 DCHECK(node->InputCount() == 1); |
| 495 Node* input = node->InputAt(0); | 474 Node* input = node->InputAt(0); |
| 496 if (HasReplacementLow(input)) { | 475 if (HasReplacementLow(input)) { |
| 497 input = GetReplacementLow(input); | 476 input = GetReplacementLow(input); |
| 498 } | 477 } |
| 499 ReplaceNode(node, input, graph()->NewNode(common()->Int32Constant(0))); | 478 ReplaceNode(node, input, graph()->NewNode(common()->Int32Constant(0))); |
| 500 node->NullAllInputs(); | 479 node->NullAllInputs(); |
| 501 break; | 480 break; |
| 502 } | 481 } |
| 503 // kExprF64ReinterpretI64: | |
| 504 case IrOpcode::kBitcastInt64ToFloat64: { | 482 case IrOpcode::kBitcastInt64ToFloat64: { |
| 505 DCHECK(node->InputCount() == 1); | 483 DCHECK(node->InputCount() == 1); |
| 506 Node* input = node->InputAt(0); | 484 Node* input = node->InputAt(0); |
| 507 Node* stack_slot = graph()->NewNode( | 485 Node* stack_slot = graph()->NewNode( |
| 508 machine()->StackSlot(MachineRepresentation::kWord64)); | 486 machine()->StackSlot(MachineRepresentation::kWord64)); |
| 509 | 487 |
| 510 Node* store_high_word = graph()->NewNode( | 488 Node* store_high_word = graph()->NewNode( |
| 511 machine()->Store( | 489 machine()->Store( |
| 512 StoreRepresentation(MachineRepresentation::kWord32, | 490 StoreRepresentation(MachineRepresentation::kWord32, |
| 513 WriteBarrierKind::kNoWriteBarrier)), | 491 WriteBarrierKind::kNoWriteBarrier)), |
| 514 stack_slot, graph()->NewNode(common()->Int32Constant(4)), | 492 stack_slot, graph()->NewNode(common()->Int32Constant(4)), |
| 515 GetReplacementHigh(input), graph()->start(), graph()->start()); | 493 GetReplacementHigh(input), graph()->start(), graph()->start()); |
| 516 | 494 |
| 517 Node* store_low_word = graph()->NewNode( | 495 Node* store_low_word = graph()->NewNode( |
| 518 machine()->Store( | 496 machine()->Store( |
| 519 StoreRepresentation(MachineRepresentation::kWord32, | 497 StoreRepresentation(MachineRepresentation::kWord32, |
| 520 WriteBarrierKind::kNoWriteBarrier)), | 498 WriteBarrierKind::kNoWriteBarrier)), |
| 521 stack_slot, graph()->NewNode(common()->Int32Constant(0)), | 499 stack_slot, graph()->NewNode(common()->Int32Constant(0)), |
| 522 GetReplacementLow(input), store_high_word, graph()->start()); | 500 GetReplacementLow(input), store_high_word, graph()->start()); |
| 523 | 501 |
| 524 Node* load = | 502 Node* load = |
| 525 graph()->NewNode(machine()->Load(MachineType::Float64()), stack_slot, | 503 graph()->NewNode(machine()->Load(MachineType::Float64()), stack_slot, |
| 526 graph()->NewNode(common()->Int32Constant(0)), | 504 graph()->NewNode(common()->Int32Constant(0)), |
| 527 store_low_word, graph()->start()); | 505 store_low_word, graph()->start()); |
| 528 | 506 |
| 529 ReplaceNode(node, load, nullptr); | 507 ReplaceNode(node, load, nullptr); |
| 530 break; | 508 break; |
| 531 } | 509 } |
| 532 // kExprI64ReinterpretF64: | |
| 533 case IrOpcode::kBitcastFloat64ToInt64: { | 510 case IrOpcode::kBitcastFloat64ToInt64: { |
| 534 DCHECK(node->InputCount() == 1); | 511 DCHECK(node->InputCount() == 1); |
| 535 Node* input = node->InputAt(0); | 512 Node* input = node->InputAt(0); |
| 536 if (HasReplacementLow(input)) { | 513 if (HasReplacementLow(input)) { |
| 537 input = GetReplacementLow(input); | 514 input = GetReplacementLow(input); |
| 538 } | 515 } |
| 539 Node* stack_slot = graph()->NewNode( | 516 Node* stack_slot = graph()->NewNode( |
| 540 machine()->StackSlot(MachineRepresentation::kWord64)); | 517 machine()->StackSlot(MachineRepresentation::kWord64)); |
| 541 Node* store = graph()->NewNode( | 518 Node* store = graph()->NewNode( |
| 542 machine()->Store( | 519 machine()->Store( |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 | 635 |
| 659 Node* high_node = graph()->NewNode( | 636 Node* high_node = graph()->NewNode( |
| 660 machine()->Word32Or(), | 637 machine()->Word32Or(), |
| 661 graph()->NewNode(machine()->Word32And(), rotate_high, bit_mask), | 638 graph()->NewNode(machine()->Word32And(), rotate_high, bit_mask), |
| 662 graph()->NewNode(machine()->Word32And(), rotate_low, inv_mask)); | 639 graph()->NewNode(machine()->Word32And(), rotate_low, inv_mask)); |
| 663 | 640 |
| 664 ReplaceNode(node, low_node, high_node); | 641 ReplaceNode(node, low_node, high_node); |
| 665 } | 642 } |
| 666 break; | 643 break; |
| 667 } | 644 } |
| 668 // kExprI64Clz: | |
| 669 case IrOpcode::kWord64Clz: { | 645 case IrOpcode::kWord64Clz: { |
| 670 DCHECK(node->InputCount() == 1); | 646 DCHECK(node->InputCount() == 1); |
| 671 Node* input = node->InputAt(0); | 647 Node* input = node->InputAt(0); |
| 672 Diamond d( | 648 Diamond d( |
| 673 graph(), common(), | 649 graph(), common(), |
| 674 graph()->NewNode(machine()->Word32Equal(), GetReplacementHigh(input), | 650 graph()->NewNode(machine()->Word32Equal(), GetReplacementHigh(input), |
| 675 graph()->NewNode(common()->Int32Constant(0)))); | 651 graph()->NewNode(common()->Int32Constant(0)))); |
| 676 | 652 |
| 677 Node* low_node = d.Phi( | 653 Node* low_node = d.Phi( |
| 678 MachineRepresentation::kWord32, | 654 MachineRepresentation::kWord32, |
| 679 graph()->NewNode(machine()->Int32Add(), | 655 graph()->NewNode(machine()->Int32Add(), |
| 680 graph()->NewNode(machine()->Word32Clz(), | 656 graph()->NewNode(machine()->Word32Clz(), |
| 681 GetReplacementLow(input)), | 657 GetReplacementLow(input)), |
| 682 graph()->NewNode(common()->Int32Constant(32))), | 658 graph()->NewNode(common()->Int32Constant(32))), |
| 683 graph()->NewNode(machine()->Word32Clz(), GetReplacementHigh(input))); | 659 graph()->NewNode(machine()->Word32Clz(), GetReplacementHigh(input))); |
| 684 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0))); | 660 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0))); |
| 685 break; | 661 break; |
| 686 } | 662 } |
| 687 // kExprI64Ctz: | |
| 688 case IrOpcode::kWord64Ctz: { | 663 case IrOpcode::kWord64Ctz: { |
| 689 DCHECK(node->InputCount() == 1); | 664 DCHECK(node->InputCount() == 1); |
| 690 DCHECK(machine()->Word32Ctz().IsSupported()); | 665 DCHECK(machine()->Word32Ctz().IsSupported()); |
| 691 Node* input = node->InputAt(0); | 666 Node* input = node->InputAt(0); |
| 692 Diamond d( | 667 Diamond d( |
| 693 graph(), common(), | 668 graph(), common(), |
| 694 graph()->NewNode(machine()->Word32Equal(), GetReplacementLow(input), | 669 graph()->NewNode(machine()->Word32Equal(), GetReplacementLow(input), |
| 695 graph()->NewNode(common()->Int32Constant(0)))); | 670 graph()->NewNode(common()->Int32Constant(0)))); |
| 696 Node* low_node = | 671 Node* low_node = |
| 697 d.Phi(MachineRepresentation::kWord32, | 672 d.Phi(MachineRepresentation::kWord32, |
| 698 graph()->NewNode(machine()->Int32Add(), | 673 graph()->NewNode(machine()->Int32Add(), |
| 699 graph()->NewNode(machine()->Word32Ctz().op(), | 674 graph()->NewNode(machine()->Word32Ctz().op(), |
| 700 GetReplacementHigh(input)), | 675 GetReplacementHigh(input)), |
| 701 graph()->NewNode(common()->Int32Constant(32))), | 676 graph()->NewNode(common()->Int32Constant(32))), |
| 702 graph()->NewNode(machine()->Word32Ctz().op(), | 677 graph()->NewNode(machine()->Word32Ctz().op(), |
| 703 GetReplacementLow(input))); | 678 GetReplacementLow(input))); |
| 704 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0))); | 679 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0))); |
| 705 break; | 680 break; |
| 706 } | 681 } |
| 707 // kExprI64Popcnt: | |
| 708 case IrOpcode::kWord64Popcnt: { | 682 case IrOpcode::kWord64Popcnt: { |
| 709 DCHECK(node->InputCount() == 1); | 683 DCHECK(node->InputCount() == 1); |
| 710 Node* input = node->InputAt(0); | 684 Node* input = node->InputAt(0); |
| 711 // We assume that a Word64Popcnt node only has been created if | 685 // We assume that a Word64Popcnt node only has been created if |
| 712 // Word32Popcnt is actually supported. | 686 // Word32Popcnt is actually supported. |
| 713 DCHECK(machine()->Word32Popcnt().IsSupported()); | 687 DCHECK(machine()->Word32Popcnt().IsSupported()); |
| 714 ReplaceNode(node, graph()->NewNode( | 688 ReplaceNode(node, graph()->NewNode( |
| 715 machine()->Int32Add(), | 689 machine()->Int32Add(), |
| 716 graph()->NewNode(machine()->Word32Popcnt().op(), | 690 graph()->NewNode(machine()->Word32Popcnt().op(), |
| 717 GetReplacementLow(input)), | 691 GetReplacementLow(input)), |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 common()->Phi(MachineRepresentation::kWord32, value_count), | 798 common()->Phi(MachineRepresentation::kWord32, value_count), |
| 825 value_count + 1, inputs_low, false), | 799 value_count + 1, inputs_low, false), |
| 826 graph()->NewNode( | 800 graph()->NewNode( |
| 827 common()->Phi(MachineRepresentation::kWord32, value_count), | 801 common()->Phi(MachineRepresentation::kWord32, value_count), |
| 828 value_count + 1, inputs_high, false)); | 802 value_count + 1, inputs_high, false)); |
| 829 } | 803 } |
| 830 } | 804 } |
| 831 } // namespace compiler | 805 } // namespace compiler |
| 832 } // namespace internal | 806 } // namespace internal |
| 833 } // namespace v8 | 807 } // namespace v8 |
| OLD | NEW |