OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "src/crankshaft/s390/lithium-codegen-s390.h" | 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 __ ltr(scratch, scratch); // use 32 bit version LoadAndTestRR even in 64 bit | 1271 __ ltr(scratch, scratch); // use 32 bit version LoadAndTestRR even in 64 bit |
1272 __ bge(&done, Label::kNear); | 1272 __ bge(&done, Label::kNear); |
1273 | 1273 |
1274 // If there is no remainder then we are done. | 1274 // If there is no remainder then we are done. |
1275 __ lr(scratch, result); | 1275 __ lr(scratch, result); |
1276 __ msr(scratch, divisor); | 1276 __ msr(scratch, divisor); |
1277 __ Cmp32(dividend, scratch); | 1277 __ Cmp32(dividend, scratch); |
1278 __ beq(&done, Label::kNear); | 1278 __ beq(&done, Label::kNear); |
1279 | 1279 |
1280 // We performed a truncating division. Correct the result. | 1280 // We performed a truncating division. Correct the result. |
1281 __ SubP(result, result, Operand(1)); | 1281 __ Sub32(result, result, Operand(1)); |
1282 __ bind(&done); | 1282 __ bind(&done); |
1283 } | 1283 } |
1284 | 1284 |
1285 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) { | 1285 void LCodeGen::DoMultiplyAddD(LMultiplyAddD* instr) { |
1286 DoubleRegister addend = ToDoubleRegister(instr->addend()); | 1286 DoubleRegister addend = ToDoubleRegister(instr->addend()); |
1287 DoubleRegister multiplier = ToDoubleRegister(instr->multiplier()); | 1287 DoubleRegister multiplier = ToDoubleRegister(instr->multiplier()); |
1288 DoubleRegister multiplicand = ToDoubleRegister(instr->multiplicand()); | 1288 DoubleRegister multiplicand = ToDoubleRegister(instr->multiplicand()); |
1289 DoubleRegister result = ToDoubleRegister(instr->result()); | 1289 DoubleRegister result = ToDoubleRegister(instr->result()); |
1290 | 1290 |
1291 // Unable to use madbr as the intermediate value is not rounded | 1291 // Unable to use madbr as the intermediate value is not rounded |
(...skipping 2927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4219 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); | 4219 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
4220 offset += ToInteger32(const_operand) * kPointerSize; | 4220 offset += ToInteger32(const_operand) * kPointerSize; |
4221 } else { | 4221 } else { |
4222 // Even though the HLoadKeyed instruction forces the input | 4222 // Even though the HLoadKeyed instruction forces the input |
4223 // representation for the key to be an integer, the input gets replaced | 4223 // representation for the key to be an integer, the input gets replaced |
4224 // during bound check elimination with the index argument to the bounds | 4224 // during bound check elimination with the index argument to the bounds |
4225 // check, which can be tagged, so that case must be handled here, too. | 4225 // check, which can be tagged, so that case must be handled here, too. |
4226 if (hinstr->key()->representation().IsSmi()) { | 4226 if (hinstr->key()->representation().IsSmi()) { |
4227 __ SmiToPtrArrayOffset(scratch, key); | 4227 __ SmiToPtrArrayOffset(scratch, key); |
4228 } else { | 4228 } else { |
4229 __ ShiftLeftP(scratch, key, Operand(kPointerSizeLog2)); | 4229 if (instr->hydrogen()->IsDehoisted()) { |
| 4230 #if V8_TARGET_ARCH_S390X |
| 4231 // If array access is dehoisted, the key, being an int32, can contain |
| 4232 // a negative value, as needs to be sign-extended to 64-bit for |
| 4233 // memory access. |
| 4234 __ lgfr(key, key); |
| 4235 #endif |
| 4236 __ ShiftLeftP(scratch, key, Operand(kPointerSizeLog2)); |
| 4237 } else { |
| 4238 // Small optimization to reduce pathlength. After Bounds Check, |
| 4239 // the key is guaranteed to be non-negative. Leverage RISBG, |
| 4240 // which also performs zero-extension. |
| 4241 __ risbg(scratch, key, Operand(32 - kPointerSizeLog2), |
| 4242 Operand(63 - kPointerSizeLog2), Operand(kPointerSizeLog2), |
| 4243 true); |
| 4244 } |
4230 } | 4245 } |
4231 } | 4246 } |
4232 | 4247 |
4233 Representation representation = hinstr->value()->representation(); | 4248 Representation representation = hinstr->value()->representation(); |
4234 | 4249 |
4235 #if V8_TARGET_ARCH_S390X | 4250 #if V8_TARGET_ARCH_S390X |
4236 // 64-bit Smi optimization | 4251 // 64-bit Smi optimization |
4237 if (representation.IsInteger32()) { | 4252 if (representation.IsInteger32()) { |
4238 DCHECK(hinstr->store_mode() == STORE_TO_INITIALIZED_ENTRY); | 4253 DCHECK(hinstr->store_mode() == STORE_TO_INITIALIZED_ENTRY); |
4239 DCHECK(hinstr->elements_kind() == FAST_SMI_ELEMENTS); | 4254 DCHECK(hinstr->elements_kind() == FAST_SMI_ELEMENTS); |
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5646 } | 5661 } |
5647 | 5662 |
5648 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { | 5663 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { |
5649 Register context = ToRegister(instr->context()); | 5664 Register context = ToRegister(instr->context()); |
5650 __ StoreP(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5665 __ StoreP(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
5651 } | 5666 } |
5652 | 5667 |
5653 #undef __ | 5668 #undef __ |
5654 } // namespace internal | 5669 } // namespace internal |
5655 } // namespace v8 | 5670 } // namespace v8 |
OLD | NEW |