Chromium Code Reviews| 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/base/adapters.h" | 5 #include "src/base/adapters.h" |
| 6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
| 7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
| 8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 | 10 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 case MachineRepresentation::kBit: // Fall through. | 160 case MachineRepresentation::kBit: // Fall through. |
| 161 case MachineRepresentation::kWord8: | 161 case MachineRepresentation::kWord8: |
| 162 opcode = load_rep.IsUnsigned() ? kMips64Lbu : kMips64Lb; | 162 opcode = load_rep.IsUnsigned() ? kMips64Lbu : kMips64Lb; |
| 163 break; | 163 break; |
| 164 case MachineRepresentation::kWord16: | 164 case MachineRepresentation::kWord16: |
| 165 opcode = load_rep.IsUnsigned() ? kMips64Lhu : kMips64Lh; | 165 opcode = load_rep.IsUnsigned() ? kMips64Lhu : kMips64Lh; |
| 166 break; | 166 break; |
| 167 case MachineRepresentation::kWord32: | 167 case MachineRepresentation::kWord32: |
| 168 opcode = load_rep.IsUnsigned() ? kMips64Lwu : kMips64Lw; | 168 opcode = load_rep.IsUnsigned() ? kMips64Lwu : kMips64Lw; |
| 169 break; | 169 break; |
| 170 | |
|
balazs.kilvady
2016/07/13 08:21:28
There are no newlines at other cases, please remov
Marija Antic
2016/07/13 08:32:37
Done.
| |
| 170 case MachineRepresentation::kTagged: // Fall through. | 171 case MachineRepresentation::kTagged: // Fall through. |
| 171 case MachineRepresentation::kWord64: | 172 case MachineRepresentation::kWord64: |
| 172 opcode = kMips64Ld; | 173 opcode = kMips64Ld; |
| 173 break; | 174 break; |
| 174 case MachineRepresentation::kSimd128: // Fall through. | 175 case MachineRepresentation::kSimd128: // Fall through. |
| 175 case MachineRepresentation::kNone: | 176 case MachineRepresentation::kNone: |
| 176 UNREACHABLE(); | 177 UNREACHABLE(); |
| 177 return; | 178 return; |
| 178 } | 179 } |
| 179 | 180 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 case MachineRepresentation::kBit: // Fall through. | 242 case MachineRepresentation::kBit: // Fall through. |
| 242 case MachineRepresentation::kWord8: | 243 case MachineRepresentation::kWord8: |
| 243 opcode = kMips64Sb; | 244 opcode = kMips64Sb; |
| 244 break; | 245 break; |
| 245 case MachineRepresentation::kWord16: | 246 case MachineRepresentation::kWord16: |
| 246 opcode = kMips64Sh; | 247 opcode = kMips64Sh; |
| 247 break; | 248 break; |
| 248 case MachineRepresentation::kWord32: | 249 case MachineRepresentation::kWord32: |
| 249 opcode = kMips64Sw; | 250 opcode = kMips64Sw; |
| 250 break; | 251 break; |
| 252 | |
|
balazs.kilvady
2016/07/13 08:21:28
There are no newlines at other cases, please remov
Marija Antic
2016/07/13 08:32:37
Done.
| |
| 251 case MachineRepresentation::kTagged: // Fall through. | 253 case MachineRepresentation::kTagged: // Fall through. |
| 252 case MachineRepresentation::kWord64: | 254 case MachineRepresentation::kWord64: |
| 253 opcode = kMips64Sd; | 255 opcode = kMips64Sd; |
| 254 break; | 256 break; |
| 255 case MachineRepresentation::kSimd128: // Fall through. | 257 case MachineRepresentation::kSimd128: // Fall through. |
| 256 case MachineRepresentation::kNone: | 258 case MachineRepresentation::kNone: |
| 257 UNREACHABLE(); | 259 UNREACHABLE(); |
| 258 return; | 260 return; |
| 259 } | 261 } |
| 260 | 262 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 uint32_t msb = base::bits::CountLeadingZeros32(~mask); | 314 uint32_t msb = base::bits::CountLeadingZeros32(~mask); |
| 313 if (shift != 0 && shift != 32 && msb + shift == 32) { | 315 if (shift != 0 && shift != 32 && msb + shift == 32) { |
| 314 // Insert zeros for (x >> K) << K => x & ~(2^K - 1) expression reduction | 316 // Insert zeros for (x >> K) << K => x & ~(2^K - 1) expression reduction |
| 315 // and remove constant loading of inverted mask. | 317 // and remove constant loading of inverted mask. |
| 316 Emit(kMips64Ins, g.DefineSameAsFirst(node), | 318 Emit(kMips64Ins, g.DefineSameAsFirst(node), |
| 317 g.UseRegister(m.left().node()), g.TempImmediate(0), | 319 g.UseRegister(m.left().node()), g.TempImmediate(0), |
| 318 g.TempImmediate(shift)); | 320 g.TempImmediate(shift)); |
| 319 return; | 321 return; |
| 320 } | 322 } |
| 321 } | 323 } |
| 322 VisitBinop(this, node, kMips64And); | 324 VisitBinop(this, node, kMips64And32); |
| 323 } | 325 } |
| 324 | 326 |
| 325 | 327 |
| 326 void InstructionSelector::VisitWord64And(Node* node) { | 328 void InstructionSelector::VisitWord64And(Node* node) { |
| 327 Mips64OperandGenerator g(this); | 329 Mips64OperandGenerator g(this); |
| 328 Int64BinopMatcher m(node); | 330 Int64BinopMatcher m(node); |
| 329 if (m.left().IsWord64Shr() && CanCover(node, m.left().node()) && | 331 if (m.left().IsWord64Shr() && CanCover(node, m.left().node()) && |
| 330 m.right().HasValue()) { | 332 m.right().HasValue()) { |
| 331 uint64_t mask = m.right().Value(); | 333 uint64_t mask = m.right().Value(); |
| 332 uint32_t mask_width = base::bits::CountPopulation64(mask); | 334 uint32_t mask_width = base::bits::CountPopulation64(mask); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 g.UseRegister(m.left().node()), g.TempImmediate(0), | 370 g.UseRegister(m.left().node()), g.TempImmediate(0), |
| 369 g.TempImmediate(shift)); | 371 g.TempImmediate(shift)); |
| 370 return; | 372 return; |
| 371 } | 373 } |
| 372 } | 374 } |
| 373 VisitBinop(this, node, kMips64And); | 375 VisitBinop(this, node, kMips64And); |
| 374 } | 376 } |
| 375 | 377 |
| 376 | 378 |
| 377 void InstructionSelector::VisitWord32Or(Node* node) { | 379 void InstructionSelector::VisitWord32Or(Node* node) { |
| 378 VisitBinop(this, node, kMips64Or); | 380 VisitBinop(this, node, kMips64Or32); |
| 379 } | 381 } |
| 380 | 382 |
| 381 | 383 |
| 382 void InstructionSelector::VisitWord64Or(Node* node) { | 384 void InstructionSelector::VisitWord64Or(Node* node) { |
| 383 VisitBinop(this, node, kMips64Or); | 385 VisitBinop(this, node, kMips64Or); |
| 384 } | 386 } |
| 385 | 387 |
| 386 | 388 |
| 387 void InstructionSelector::VisitWord32Xor(Node* node) { | 389 void InstructionSelector::VisitWord32Xor(Node* node) { |
| 388 Int32BinopMatcher m(node); | 390 Int32BinopMatcher m(node); |
| 389 if (m.left().IsWord32Or() && CanCover(node, m.left().node()) && | 391 if (m.left().IsWord32Or() && CanCover(node, m.left().node()) && |
| 390 m.right().Is(-1)) { | 392 m.right().Is(-1)) { |
| 391 Int32BinopMatcher mleft(m.left().node()); | 393 Int32BinopMatcher mleft(m.left().node()); |
| 392 if (!mleft.right().HasValue()) { | 394 if (!mleft.right().HasValue()) { |
| 393 Mips64OperandGenerator g(this); | 395 Mips64OperandGenerator g(this); |
| 394 Emit(kMips64Nor, g.DefineAsRegister(node), | 396 Emit(kMips64Nor32, g.DefineAsRegister(node), |
| 395 g.UseRegister(mleft.left().node()), | 397 g.UseRegister(mleft.left().node()), |
| 396 g.UseRegister(mleft.right().node())); | 398 g.UseRegister(mleft.right().node())); |
| 397 return; | 399 return; |
| 398 } | 400 } |
| 399 } | 401 } |
| 400 if (m.right().Is(-1)) { | 402 if (m.right().Is(-1)) { |
| 401 // Use Nor for bit negation and eliminate constant loading for xori. | 403 // Use Nor for bit negation and eliminate constant loading for xori. |
| 402 Mips64OperandGenerator g(this); | 404 Mips64OperandGenerator g(this); |
| 403 Emit(kMips64Nor, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 405 Emit(kMips64Nor32, g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
| 404 g.TempImmediate(0)); | 406 g.TempImmediate(0)); |
| 405 return; | 407 return; |
| 406 } | 408 } |
| 407 VisitBinop(this, node, kMips64Xor); | 409 VisitBinop(this, node, kMips64Xor32); |
| 408 } | 410 } |
| 409 | 411 |
| 410 | 412 |
| 411 void InstructionSelector::VisitWord64Xor(Node* node) { | 413 void InstructionSelector::VisitWord64Xor(Node* node) { |
| 412 Int64BinopMatcher m(node); | 414 Int64BinopMatcher m(node); |
| 413 if (m.left().IsWord64Or() && CanCover(node, m.left().node()) && | 415 if (m.left().IsWord64Or() && CanCover(node, m.left().node()) && |
| 414 m.right().Is(-1)) { | 416 m.right().Is(-1)) { |
| 415 Int64BinopMatcher mleft(m.left().node()); | 417 Int64BinopMatcher mleft(m.left().node()); |
| 416 if (!mleft.right().HasValue()) { | 418 if (!mleft.right().HasValue()) { |
| 417 Mips64OperandGenerator g(this); | 419 Mips64OperandGenerator g(this); |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2093 } else { | 2095 } else { |
| 2094 DCHECK(kArchVariant == kMips64r2); | 2096 DCHECK(kArchVariant == kMips64r2); |
| 2095 return MachineOperatorBuilder::AlignmentRequirements:: | 2097 return MachineOperatorBuilder::AlignmentRequirements:: |
| 2096 NoUnalignedAccessSupport(); | 2098 NoUnalignedAccessSupport(); |
| 2097 } | 2099 } |
| 2098 } | 2100 } |
| 2099 | 2101 |
| 2100 } // namespace compiler | 2102 } // namespace compiler |
| 2101 } // namespace internal | 2103 } // namespace internal |
| 2102 } // namespace v8 | 2104 } // namespace v8 |
| OLD | NEW |