| 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/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 Node* low_node = | 282 Node* low_node = |
| 283 graph()->NewNode(machine()->Word32Xor(), GetReplacementLow(left), | 283 graph()->NewNode(machine()->Word32Xor(), GetReplacementLow(left), |
| 284 GetReplacementLow(right)); | 284 GetReplacementLow(right)); |
| 285 Node* high_node = | 285 Node* high_node = |
| 286 graph()->NewNode(machine()->Word32Xor(), GetReplacementHigh(left), | 286 graph()->NewNode(machine()->Word32Xor(), GetReplacementHigh(left), |
| 287 GetReplacementHigh(right)); | 287 GetReplacementHigh(right)); |
| 288 ReplaceNode(node, low_node, high_node); | 288 ReplaceNode(node, low_node, high_node); |
| 289 break; | 289 break; |
| 290 } | 290 } |
| 291 // kExprI64Shl: | 291 // kExprI64Shl: |
| 292 case IrOpcode::kWord64Shl: { |
| 293 // TODO(turbofan): if the shift count >= 32, then we can set the low word |
| 294 // of the output to 0 and just calculate the high word. |
| 295 DCHECK(node->InputCount() == 2); |
| 296 Node* shift = node->InputAt(1); |
| 297 if (HasReplacementLow(shift)) { |
| 298 // We do not have to care about the high word replacement, because |
| 299 // the shift can only be between 0 and 63 anyways. |
| 300 node->ReplaceInput(1, GetReplacementLow(shift)); |
| 301 } |
| 302 |
| 303 Node* value = node->InputAt(0); |
| 304 node->ReplaceInput(0, GetReplacementLow(value)); |
| 305 node->InsertInput(zone(), 1, GetReplacementHigh(value)); |
| 306 |
| 307 NodeProperties::ChangeOp(node, machine()->Word32PairShl()); |
| 308 // We access the additional return values through projections. |
| 309 Node* low_node = graph()->NewNode(common()->Projection(0), node); |
| 310 Node* high_node = graph()->NewNode(common()->Projection(1), node); |
| 311 ReplaceNode(node, low_node, high_node); |
| 312 break; |
| 313 } |
| 292 // kExprI64ShrU: | 314 // kExprI64ShrU: |
| 293 // kExprI64ShrS: | 315 // kExprI64ShrS: |
| 294 // kExprI64Eq: | 316 // kExprI64Eq: |
| 295 case IrOpcode::kWord64Equal: { | 317 case IrOpcode::kWord64Equal: { |
| 296 DCHECK(node->InputCount() == 2); | 318 DCHECK(node->InputCount() == 2); |
| 297 Node* left = node->InputAt(0); | 319 Node* left = node->InputAt(0); |
| 298 Node* right = node->InputAt(1); | 320 Node* right = node->InputAt(1); |
| 299 | 321 |
| 300 // TODO(wasm): Use explicit comparisons and && here? | 322 // TODO(wasm): Use explicit comparisons and && here? |
| 301 Node* replacement = graph()->NewNode( | 323 Node* replacement = graph()->NewNode( |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 435 } |
| 414 | 436 |
| 415 Node* Int64Lowering::GetReplacementHigh(Node* node) { | 437 Node* Int64Lowering::GetReplacementHigh(Node* node) { |
| 416 Node* result = replacements_[node->id()].high; | 438 Node* result = replacements_[node->id()].high; |
| 417 DCHECK(result); | 439 DCHECK(result); |
| 418 return result; | 440 return result; |
| 419 } | 441 } |
| 420 } // namespace compiler | 442 } // namespace compiler |
| 421 } // namespace internal | 443 } // namespace internal |
| 422 } // namespace v8 | 444 } // namespace v8 |
| OLD | NEW |