Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/regexp-macro-assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include <limits.h> // For LONG_MIN, LONG_MAX. 28 #include <limits.h> // For LONG_MIN, LONG_MAX.
29 29
30 #include "v8.h" 30 #include "v8.h"
31 31
32 #if defined(V8_TARGET_ARCH_MIPS) 32 #if V8_TARGET_ARCH_MIPS
33 33
34 #include "bootstrapper.h" 34 #include "bootstrapper.h"
35 #include "codegen.h" 35 #include "codegen.h"
36 #include "cpu-profiler.h"
36 #include "debug.h" 37 #include "debug.h"
37 #include "runtime.h" 38 #include "runtime.h"
38 39
39 namespace v8 { 40 namespace v8 {
40 namespace internal { 41 namespace internal {
41 42
42 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) 43 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
43 : Assembler(arg_isolate, buffer, size), 44 : Assembler(arg_isolate, buffer, size),
44 generating_stub_(false), 45 generating_stub_(false),
45 allow_stub_calls_(true), 46 allow_stub_calls_(true),
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 srl(rd, rs, 0); 761 srl(rd, rs, 0);
761 } else { 762 } else {
762 srl(at, rs, rt.imm32_); 763 srl(at, rs, rt.imm32_);
763 sll(rd, rs, (0x20 - rt.imm32_) & 0x1f); 764 sll(rd, rs, (0x20 - rt.imm32_) & 0x1f);
764 or_(rd, rd, at); 765 or_(rd, rd, at);
765 } 766 }
766 } 767 }
767 } 768 }
768 } 769 }
769 770
771
770 //------------Pseudo-instructions------------- 772 //------------Pseudo-instructions-------------
771 773
772 void MacroAssembler::li(Register rd, Operand j, LiFlags mode) { 774 void MacroAssembler::li(Register rd, Operand j, LiFlags mode) {
773 ASSERT(!j.is_reg()); 775 ASSERT(!j.is_reg());
774 BlockTrampolinePoolScope block_trampoline_pool(this); 776 BlockTrampolinePoolScope block_trampoline_pool(this);
775 if (!MustUseReg(j.rmode_) && mode == OPTIMIZE_SIZE) { 777 if (!MustUseReg(j.rmode_) && mode == OPTIMIZE_SIZE) {
776 // Normal load of an immediate value which does not need Relocation Info. 778 // Normal load of an immediate value which does not need Relocation Info.
777 if (is_int16(j.imm32_)) { 779 if (is_int16(j.imm32_)) {
778 addiu(rd, zero_reg, j.imm32_); 780 addiu(rd, zero_reg, j.imm32_);
779 } else if (!(j.imm32_ & kHiMask)) { 781 } else if (!(j.imm32_ & kHiMask)) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 } 1015 }
1014 1016
1015 1017
1016 void MacroAssembler::Trunc_uw_d(FPURegister fd, 1018 void MacroAssembler::Trunc_uw_d(FPURegister fd,
1017 FPURegister fs, 1019 FPURegister fs,
1018 FPURegister scratch) { 1020 FPURegister scratch) {
1019 Trunc_uw_d(fs, t8, scratch); 1021 Trunc_uw_d(fs, t8, scratch);
1020 mtc1(t8, fd); 1022 mtc1(t8, fd);
1021 } 1023 }
1022 1024
1025
1023 void MacroAssembler::Trunc_w_d(FPURegister fd, FPURegister fs) { 1026 void MacroAssembler::Trunc_w_d(FPURegister fd, FPURegister fs) {
1024 if (kArchVariant == kLoongson && fd.is(fs)) { 1027 if (kArchVariant == kLoongson && fd.is(fs)) {
1025 mfc1(t8, FPURegister::from_code(fs.code() + 1)); 1028 mfc1(t8, FPURegister::from_code(fs.code() + 1));
1026 trunc_w_d(fd, fs); 1029 trunc_w_d(fd, fs);
1027 mtc1(t8, FPURegister::from_code(fs.code() + 1)); 1030 mtc1(t8, FPURegister::from_code(fs.code() + 1));
1028 } else { 1031 } else {
1029 trunc_w_d(fd, fs); 1032 trunc_w_d(fd, fs);
1030 } 1033 }
1031 } 1034 }
1032 1035
1036
1033 void MacroAssembler::Round_w_d(FPURegister fd, FPURegister fs) { 1037 void MacroAssembler::Round_w_d(FPURegister fd, FPURegister fs) {
1034 if (kArchVariant == kLoongson && fd.is(fs)) { 1038 if (kArchVariant == kLoongson && fd.is(fs)) {
1035 mfc1(t8, FPURegister::from_code(fs.code() + 1)); 1039 mfc1(t8, FPURegister::from_code(fs.code() + 1));
1036 round_w_d(fd, fs); 1040 round_w_d(fd, fs);
1037 mtc1(t8, FPURegister::from_code(fs.code() + 1)); 1041 mtc1(t8, FPURegister::from_code(fs.code() + 1));
1038 } else { 1042 } else {
1039 round_w_d(fd, fs); 1043 round_w_d(fd, fs);
1040 } 1044 }
1041 } 1045 }
1042 1046
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 lui(at, (imm32 & kHiMask) >> kLuiShift); 2635 lui(at, (imm32 & kHiMask) >> kLuiShift);
2632 ori(at, at, (imm32 & kImm16Mask)); 2636 ori(at, at, (imm32 & kImm16Mask));
2633 } 2637 }
2634 jalr(at); 2638 jalr(at);
2635 2639
2636 // Emit a nop in the branch delay slot if required. 2640 // Emit a nop in the branch delay slot if required.
2637 if (bdslot == PROTECT) 2641 if (bdslot == PROTECT)
2638 nop(); 2642 nop();
2639 } 2643 }
2640 2644
2645
2641 void MacroAssembler::DropAndRet(int drop) { 2646 void MacroAssembler::DropAndRet(int drop) {
2642 Ret(USE_DELAY_SLOT); 2647 Ret(USE_DELAY_SLOT);
2643 addiu(sp, sp, drop * kPointerSize); 2648 addiu(sp, sp, drop * kPointerSize);
2644 } 2649 }
2645 2650
2646 void MacroAssembler::DropAndRet(int drop, 2651 void MacroAssembler::DropAndRet(int drop,
2647 Condition cond, 2652 Condition cond,
2648 Register r1, 2653 Register r1,
2649 const Operand& r2) { 2654 const Operand& r2) {
2650 // Both Drop and Ret need to be conditional. 2655 // Both Drop and Ret need to be conditional.
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 TAG_OBJECT); 3200 TAG_OBJECT);
3196 3201
3197 InitializeNewString(result, 3202 InitializeNewString(result,
3198 length, 3203 length,
3199 Heap::kSlicedAsciiStringMapRootIndex, 3204 Heap::kSlicedAsciiStringMapRootIndex,
3200 scratch1, 3205 scratch1,
3201 scratch2); 3206 scratch2);
3202 } 3207 }
3203 3208
3204 3209
3210 void MacroAssembler::JumpIfNotUniqueName(Register reg,
3211 Label* not_unique_name) {
3212 STATIC_ASSERT(((SYMBOL_TYPE - 1) & kIsInternalizedMask) == kInternalizedTag);
3213 Branch(not_unique_name, lt, reg, Operand(kIsInternalizedMask));
3214 Branch(not_unique_name, gt, reg, Operand(SYMBOL_TYPE));
3215 }
3216
3217
3205 // Allocates a heap number or jumps to the label if the young space is full and 3218 // Allocates a heap number or jumps to the label if the young space is full and
3206 // a scavenge is needed. 3219 // a scavenge is needed.
3207 void MacroAssembler::AllocateHeapNumber(Register result, 3220 void MacroAssembler::AllocateHeapNumber(Register result,
3208 Register scratch1, 3221 Register scratch1,
3209 Register scratch2, 3222 Register scratch2,
3210 Register heap_number_map, 3223 Register heap_number_map,
3211 Label* need_gc, 3224 Label* need_gc,
3212 TaggingMode tagging_mode) { 3225 TaggingMode tagging_mode) {
3213 // Allocate an object in the heap for the heap number and tag it as a heap 3226 // Allocate an object in the heap for the heap number and tag it as a heap
3214 // object. 3227 // object.
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
4708 sll(scratch1, length, kSmiTagSize); 4721 sll(scratch1, length, kSmiTagSize);
4709 LoadRoot(scratch2, map_index); 4722 LoadRoot(scratch2, map_index);
4710 sw(scratch1, FieldMemOperand(string, String::kLengthOffset)); 4723 sw(scratch1, FieldMemOperand(string, String::kLengthOffset));
4711 li(scratch1, Operand(String::kEmptyHashField)); 4724 li(scratch1, Operand(String::kEmptyHashField));
4712 sw(scratch2, FieldMemOperand(string, HeapObject::kMapOffset)); 4725 sw(scratch2, FieldMemOperand(string, HeapObject::kMapOffset));
4713 sw(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); 4726 sw(scratch1, FieldMemOperand(string, String::kHashFieldOffset));
4714 } 4727 }
4715 4728
4716 4729
4717 int MacroAssembler::ActivationFrameAlignment() { 4730 int MacroAssembler::ActivationFrameAlignment() {
4718 #if defined(V8_HOST_ARCH_MIPS) 4731 #if V8_HOST_ARCH_MIPS
4719 // Running on the real platform. Use the alignment as mandated by the local 4732 // Running on the real platform. Use the alignment as mandated by the local
4720 // environment. 4733 // environment.
4721 // Note: This will break if we ever start generating snapshots on one Mips 4734 // Note: This will break if we ever start generating snapshots on one Mips
4722 // platform for another Mips platform with a different alignment. 4735 // platform for another Mips platform with a different alignment.
4723 return OS::ActivationFrameAlignment(); 4736 return OS::ActivationFrameAlignment();
4724 #else // defined(V8_HOST_ARCH_MIPS) 4737 #else // V8_HOST_ARCH_MIPS
4725 // If we are using the simulator then we should always align to the expected 4738 // If we are using the simulator then we should always align to the expected
4726 // alignment. As the simulator is used to generate snapshots we do not know 4739 // alignment. As the simulator is used to generate snapshots we do not know
4727 // if the target platform will need alignment, so this is controlled from a 4740 // if the target platform will need alignment, so this is controlled from a
4728 // flag. 4741 // flag.
4729 return FLAG_sim_stack_alignment; 4742 return FLAG_sim_stack_alignment;
4730 #endif // defined(V8_HOST_ARCH_MIPS) 4743 #endif // V8_HOST_ARCH_MIPS
4731 } 4744 }
4732 4745
4733 4746
4734 void MacroAssembler::AssertStackIsAligned() { 4747 void MacroAssembler::AssertStackIsAligned() {
4735 if (emit_debug_code()) { 4748 if (emit_debug_code()) {
4736 const int frame_alignment = ActivationFrameAlignment(); 4749 const int frame_alignment = ActivationFrameAlignment();
4737 const int frame_alignment_mask = frame_alignment - 1; 4750 const int frame_alignment_mask = frame_alignment - 1;
4738 4751
4739 if (frame_alignment > kPointerSize) { 4752 if (frame_alignment > kPointerSize) {
4740 Label alignment_as_expected; 4753 Label alignment_as_expected;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
5051 void MacroAssembler::CallCFunctionHelper(Register function, 5064 void MacroAssembler::CallCFunctionHelper(Register function,
5052 int num_reg_arguments, 5065 int num_reg_arguments,
5053 int num_double_arguments) { 5066 int num_double_arguments) {
5054 ASSERT(has_frame()); 5067 ASSERT(has_frame());
5055 // Make sure that the stack is aligned before calling a C function unless 5068 // Make sure that the stack is aligned before calling a C function unless
5056 // running in the simulator. The simulator has its own alignment check which 5069 // running in the simulator. The simulator has its own alignment check which
5057 // provides more information. 5070 // provides more information.
5058 // The argument stots are presumed to have been set up by 5071 // The argument stots are presumed to have been set up by
5059 // PrepareCallCFunction. The C function must be called via t9, for mips ABI. 5072 // PrepareCallCFunction. The C function must be called via t9, for mips ABI.
5060 5073
5061 #if defined(V8_HOST_ARCH_MIPS) 5074 #if V8_HOST_ARCH_MIPS
5062 if (emit_debug_code()) { 5075 if (emit_debug_code()) {
5063 int frame_alignment = OS::ActivationFrameAlignment(); 5076 int frame_alignment = OS::ActivationFrameAlignment();
5064 int frame_alignment_mask = frame_alignment - 1; 5077 int frame_alignment_mask = frame_alignment - 1;
5065 if (frame_alignment > kPointerSize) { 5078 if (frame_alignment > kPointerSize) {
5066 ASSERT(IsPowerOf2(frame_alignment)); 5079 ASSERT(IsPowerOf2(frame_alignment));
5067 Label alignment_as_expected; 5080 Label alignment_as_expected;
5068 And(at, sp, Operand(frame_alignment_mask)); 5081 And(at, sp, Operand(frame_alignment_mask));
5069 Branch(&alignment_as_expected, eq, at, Operand(zero_reg)); 5082 Branch(&alignment_as_expected, eq, at, Operand(zero_reg));
5070 // Don't use Check here, as it will call Runtime_Abort possibly 5083 // Don't use Check here, as it will call Runtime_Abort possibly
5071 // re-entering here. 5084 // re-entering here.
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
5548 opcode == BGTZL); 5561 opcode == BGTZL);
5549 opcode = (cond == eq) ? BEQ : BNE; 5562 opcode = (cond == eq) ? BEQ : BNE;
5550 instr = (instr & ~kOpcodeMask) | opcode; 5563 instr = (instr & ~kOpcodeMask) | opcode;
5551 masm_.emit(instr); 5564 masm_.emit(instr);
5552 } 5565 }
5553 5566
5554 5567
5555 } } // namespace v8::internal 5568 } } // namespace v8::internal
5556 5569
5557 #endif // V8_TARGET_ARCH_MIPS 5570 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/regexp-macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698