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 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 4555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4566 // Initialize the JSValue. | 4566 // Initialize the JSValue. |
4567 LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); | 4567 LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); |
4568 sw(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); | 4568 sw(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); |
4569 LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); | 4569 LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); |
4570 sw(scratch1, FieldMemOperand(result, JSObject::kPropertiesOffset)); | 4570 sw(scratch1, FieldMemOperand(result, JSObject::kPropertiesOffset)); |
4571 sw(scratch1, FieldMemOperand(result, JSObject::kElementsOffset)); | 4571 sw(scratch1, FieldMemOperand(result, JSObject::kElementsOffset)); |
4572 sw(value, FieldMemOperand(result, JSValue::kValueOffset)); | 4572 sw(value, FieldMemOperand(result, JSValue::kValueOffset)); |
4573 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 4573 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
4574 } | 4574 } |
4575 | 4575 |
4576 | |
4577 void MacroAssembler::CopyBytes(Register src, | |
4578 Register dst, | |
4579 Register length, | |
4580 Register scratch) { | |
4581 Label align_loop_1, word_loop, byte_loop, byte_loop_1, done; | |
4582 | |
4583 // Align src before copying in word size chunks. | |
4584 Branch(&byte_loop, le, length, Operand(kPointerSize)); | |
4585 bind(&align_loop_1); | |
4586 And(scratch, src, kPointerSize - 1); | |
4587 Branch(&word_loop, eq, scratch, Operand(zero_reg)); | |
4588 lbu(scratch, MemOperand(src)); | |
4589 Addu(src, src, 1); | |
4590 sb(scratch, MemOperand(dst)); | |
4591 Addu(dst, dst, 1); | |
4592 Subu(length, length, Operand(1)); | |
4593 Branch(&align_loop_1, ne, length, Operand(zero_reg)); | |
4594 | |
4595 // Copy bytes in word size chunks. | |
4596 bind(&word_loop); | |
4597 if (emit_debug_code()) { | |
4598 And(scratch, src, kPointerSize - 1); | |
4599 Assert(eq, kExpectingAlignmentForCopyBytes, | |
4600 scratch, Operand(zero_reg)); | |
4601 } | |
4602 Branch(&byte_loop, lt, length, Operand(kPointerSize)); | |
4603 lw(scratch, MemOperand(src)); | |
4604 Addu(src, src, kPointerSize); | |
4605 | |
4606 // TODO(kalmard) check if this can be optimized to use sw in most cases. | |
4607 // Can't use unaligned access - copy byte by byte. | |
4608 if (kArchEndian == kLittle) { | |
4609 sb(scratch, MemOperand(dst, 0)); | |
4610 srl(scratch, scratch, 8); | |
4611 sb(scratch, MemOperand(dst, 1)); | |
4612 srl(scratch, scratch, 8); | |
4613 sb(scratch, MemOperand(dst, 2)); | |
4614 srl(scratch, scratch, 8); | |
4615 sb(scratch, MemOperand(dst, 3)); | |
4616 } else { | |
4617 sb(scratch, MemOperand(dst, 3)); | |
4618 srl(scratch, scratch, 8); | |
4619 sb(scratch, MemOperand(dst, 2)); | |
4620 srl(scratch, scratch, 8); | |
4621 sb(scratch, MemOperand(dst, 1)); | |
4622 srl(scratch, scratch, 8); | |
4623 sb(scratch, MemOperand(dst, 0)); | |
4624 } | |
4625 | |
4626 Addu(dst, dst, 4); | |
4627 | |
4628 Subu(length, length, Operand(kPointerSize)); | |
4629 Branch(&word_loop); | |
4630 | |
4631 // Copy the last bytes if any left. | |
4632 bind(&byte_loop); | |
4633 Branch(&done, eq, length, Operand(zero_reg)); | |
4634 bind(&byte_loop_1); | |
4635 lbu(scratch, MemOperand(src)); | |
4636 Addu(src, src, 1); | |
4637 sb(scratch, MemOperand(dst)); | |
4638 Addu(dst, dst, 1); | |
4639 Subu(length, length, Operand(1)); | |
4640 Branch(&byte_loop_1, ne, length, Operand(zero_reg)); | |
4641 bind(&done); | |
4642 } | |
4643 | |
4644 | |
4645 void MacroAssembler::InitializeFieldsWithFiller(Register current_address, | 4576 void MacroAssembler::InitializeFieldsWithFiller(Register current_address, |
4646 Register end_address, | 4577 Register end_address, |
4647 Register filler) { | 4578 Register filler) { |
4648 Label loop, entry; | 4579 Label loop, entry; |
4649 Branch(&entry); | 4580 Branch(&entry); |
4650 bind(&loop); | 4581 bind(&loop); |
4651 sw(filler, MemOperand(current_address)); | 4582 sw(filler, MemOperand(current_address)); |
4652 Addu(current_address, current_address, kPointerSize); | 4583 Addu(current_address, current_address, kPointerSize); |
4653 bind(&entry); | 4584 bind(&entry); |
4654 Branch(&loop, ult, current_address, Operand(end_address)); | 4585 Branch(&loop, ult, current_address, Operand(end_address)); |
(...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6878 if (mag.shift > 0) sra(result, result, mag.shift); | 6809 if (mag.shift > 0) sra(result, result, mag.shift); |
6879 srl(at, dividend, 31); | 6810 srl(at, dividend, 31); |
6880 Addu(result, result, Operand(at)); | 6811 Addu(result, result, Operand(at)); |
6881 } | 6812 } |
6882 | 6813 |
6883 | 6814 |
6884 } // namespace internal | 6815 } // namespace internal |
6885 } // namespace v8 | 6816 } // namespace v8 |
6886 | 6817 |
6887 #endif // V8_TARGET_ARCH_MIPS | 6818 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |