| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_MIPS | 9 #if V8_TARGET_ARCH_MIPS |
| 10 | 10 |
| 11 #include "src/base/bits.h" | 11 #include "src/base/bits.h" |
| 12 #include "src/base/division-by-constant.h" | 12 #include "src/base/division-by-constant.h" |
| 13 #include "src/bootstrapper.h" | 13 #include "src/bootstrapper.h" |
| 14 #include "src/codegen.h" | 14 #include "src/codegen.h" |
| 15 #include "src/cpu-profiler.h" | 15 #include "src/cpu-profiler.h" |
| 16 #include "src/debug.h" | 16 #include "src/debug.h" |
| 17 #include "src/isolate-inl.h" | 17 #include "src/isolate-inl.h" |
| 18 #include "src/runtime/runtime.h" | 18 #include "src/runtime/runtime.h" |
| 19 | 19 |
| 20 namespace v8 { | 20 namespace v8 { |
| 21 namespace internal { | 21 namespace internal { |
| 22 | 22 |
| 23 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 23 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
| 24 : Assembler(arg_isolate, buffer, size), | 24 : Assembler(arg_isolate, buffer, size), |
| 25 generating_stub_(false), | 25 generating_stub_(false), |
| 26 has_frame_(false) { | 26 has_frame_(false), |
| 27 has_double_zero_reg_set(false) { |
| 27 if (isolate() != NULL) { | 28 if (isolate() != NULL) { |
| 28 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), | 29 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), |
| 29 isolate()); | 30 isolate()); |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| 33 | 34 |
| 34 void MacroAssembler::Load(Register dst, | 35 void MacroAssembler::Load(Register dst, |
| 35 const MemOperand& src, | 36 const MemOperand& src, |
| 36 Representation r) { | 37 Representation r) { |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 nop(); | 1524 nop(); |
| 1524 } | 1525 } |
| 1525 } | 1526 } |
| 1526 | 1527 |
| 1527 | 1528 |
| 1528 void MacroAssembler::Move(FPURegister dst, double imm) { | 1529 void MacroAssembler::Move(FPURegister dst, double imm) { |
| 1529 static const DoubleRepresentation minus_zero(-0.0); | 1530 static const DoubleRepresentation minus_zero(-0.0); |
| 1530 static const DoubleRepresentation zero(0.0); | 1531 static const DoubleRepresentation zero(0.0); |
| 1531 DoubleRepresentation value_rep(imm); | 1532 DoubleRepresentation value_rep(imm); |
| 1532 // Handle special values first. | 1533 // Handle special values first. |
| 1533 bool force_load = dst.is(kDoubleRegZero); | 1534 if (value_rep == zero && has_double_zero_reg_set) { |
| 1534 if (value_rep == zero && !force_load) { | |
| 1535 mov_d(dst, kDoubleRegZero); | 1535 mov_d(dst, kDoubleRegZero); |
| 1536 } else if (value_rep == minus_zero && !force_load) { | 1536 } else if (value_rep == minus_zero && has_double_zero_reg_set) { |
| 1537 neg_d(dst, kDoubleRegZero); | 1537 neg_d(dst, kDoubleRegZero); |
| 1538 } else { | 1538 } else { |
| 1539 uint32_t lo, hi; | 1539 uint32_t lo, hi; |
| 1540 DoubleAsTwoUInt32(imm, &lo, &hi); | 1540 DoubleAsTwoUInt32(imm, &lo, &hi); |
| 1541 // Move the low part of the double into the lower of the corresponding FPU | 1541 // Move the low part of the double into the lower of the corresponding FPU |
| 1542 // register of FPU register pair. | 1542 // register of FPU register pair. |
| 1543 if (lo != 0) { | 1543 if (lo != 0) { |
| 1544 li(at, Operand(lo)); | 1544 li(at, Operand(lo)); |
| 1545 mtc1(at, dst); | 1545 mtc1(at, dst); |
| 1546 } else { | 1546 } else { |
| 1547 mtc1(zero_reg, dst); | 1547 mtc1(zero_reg, dst); |
| 1548 } | 1548 } |
| 1549 // Move the high part of the double into the higher of the corresponding FPU | 1549 // Move the high part of the double into the higher of the corresponding FPU |
| 1550 // register of FPU register pair. | 1550 // register of FPU register pair. |
| 1551 if (hi != 0) { | 1551 if (hi != 0) { |
| 1552 li(at, Operand(hi)); | 1552 li(at, Operand(hi)); |
| 1553 Mthc1(at, dst); | 1553 Mthc1(at, dst); |
| 1554 } else { | 1554 } else { |
| 1555 Mthc1(zero_reg, dst); | 1555 Mthc1(zero_reg, dst); |
| 1556 } | 1556 } |
| 1557 if (dst.is(kDoubleRegZero)) has_double_zero_reg_set = true; |
| 1557 } | 1558 } |
| 1558 } | 1559 } |
| 1559 | 1560 |
| 1560 | 1561 |
| 1561 void MacroAssembler::Movz(Register rd, Register rs, Register rt) { | 1562 void MacroAssembler::Movz(Register rd, Register rs, Register rt) { |
| 1562 if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) { | 1563 if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) { |
| 1563 Label done; | 1564 Label done; |
| 1564 Branch(&done, ne, rt, Operand(zero_reg)); | 1565 Branch(&done, ne, rt, Operand(zero_reg)); |
| 1565 mov(rd, rs); | 1566 mov(rd, rs); |
| 1566 bind(&done); | 1567 bind(&done); |
| (...skipping 4647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6214 } | 6215 } |
| 6215 if (mag.shift > 0) sra(result, result, mag.shift); | 6216 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6216 srl(at, dividend, 31); | 6217 srl(at, dividend, 31); |
| 6217 Addu(result, result, Operand(at)); | 6218 Addu(result, result, Operand(at)); |
| 6218 } | 6219 } |
| 6219 | 6220 |
| 6220 | 6221 |
| 6221 } } // namespace v8::internal | 6222 } } // namespace v8::internal |
| 6222 | 6223 |
| 6223 #endif // V8_TARGET_ARCH_MIPS | 6224 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |