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

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

Issue 153923005: A64: Synchronize with r17525. (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/stub-cache-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 17 matching lines...) Expand all
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 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 "cpu-profiler.h"
37 #include "debug.h" 37 #include "debug.h"
38 #include "isolate-inl.h"
38 #include "runtime.h" 39 #include "runtime.h"
39 40
40 namespace v8 { 41 namespace v8 {
41 namespace internal { 42 namespace internal {
42 43
43 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) 44 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
44 : Assembler(arg_isolate, buffer, size), 45 : Assembler(arg_isolate, buffer, size),
45 generating_stub_(false), 46 generating_stub_(false),
46 allow_stub_calls_(true), 47 allow_stub_calls_(true),
47 has_frame_(false) { 48 has_frame_(false) {
(...skipping 27 matching lines...) Expand all
75 76
76 void MacroAssembler::StoreRoot(Register source, 77 void MacroAssembler::StoreRoot(Register source,
77 Heap::RootListIndex index, 78 Heap::RootListIndex index,
78 Condition cond, 79 Condition cond,
79 Register src1, const Operand& src2) { 80 Register src1, const Operand& src2) {
80 Branch(2, NegateCondition(cond), src1, src2); 81 Branch(2, NegateCondition(cond), src1, src2);
81 sw(source, MemOperand(s6, index << kPointerSizeLog2)); 82 sw(source, MemOperand(s6, index << kPointerSizeLog2));
82 } 83 }
83 84
84 85
85 void MacroAssembler::LoadHeapObject(Register result,
86 Handle<HeapObject> object) {
87 AllowDeferredHandleDereference using_raw_address;
88 if (isolate()->heap()->InNewSpace(*object)) {
89 Handle<Cell> cell = isolate()->factory()->NewCell(object);
90 li(result, Operand(cell));
91 lw(result, FieldMemOperand(result, Cell::kValueOffset));
92 } else {
93 li(result, Operand(object));
94 }
95 }
96
97
98 // Push and pop all registers that can hold pointers. 86 // Push and pop all registers that can hold pointers.
99 void MacroAssembler::PushSafepointRegisters() { 87 void MacroAssembler::PushSafepointRegisters() {
100 // Safepoints expect a block of kNumSafepointRegisters values on the 88 // Safepoints expect a block of kNumSafepointRegisters values on the
101 // stack, so adjust the stack for unsaved registers. 89 // stack, so adjust the stack for unsaved registers.
102 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; 90 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters;
103 ASSERT(num_unsaved >= 0); 91 ASSERT(num_unsaved >= 0);
104 if (num_unsaved > 0) { 92 if (num_unsaved > 0) {
105 Subu(sp, sp, Operand(num_unsaved * kPointerSize)); 93 Subu(sp, sp, Operand(num_unsaved * kPointerSize));
106 } 94 }
107 MultiPush(kSafepointSavedRegisters); 95 MultiPush(kSafepointSavedRegisters);
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 sll(rd, rs, (0x20 - rt.imm32_) & 0x1f); 748 sll(rd, rs, (0x20 - rt.imm32_) & 0x1f);
761 or_(rd, rd, at); 749 or_(rd, rd, at);
762 } 750 }
763 } 751 }
764 } 752 }
765 } 753 }
766 754
767 755
768 //------------Pseudo-instructions------------- 756 //------------Pseudo-instructions-------------
769 757
758 void MacroAssembler::li(Register dst, Handle<Object> value, LiFlags mode) {
759 AllowDeferredHandleDereference smi_check;
760 if (value->IsSmi()) {
761 li(dst, Operand(value), mode);
762 } else {
763 ASSERT(value->IsHeapObject());
764 if (isolate()->heap()->InNewSpace(*value)) {
765 Handle<Cell> cell = isolate()->factory()->NewCell(value);
766 li(dst, Operand(cell));
767 lw(dst, FieldMemOperand(dst, Cell::kValueOffset));
768 } else {
769 li(dst, Operand(value));
770 }
771 }
772 }
773
774
770 void MacroAssembler::li(Register rd, Operand j, LiFlags mode) { 775 void MacroAssembler::li(Register rd, Operand j, LiFlags mode) {
771 ASSERT(!j.is_reg()); 776 ASSERT(!j.is_reg());
772 BlockTrampolinePoolScope block_trampoline_pool(this); 777 BlockTrampolinePoolScope block_trampoline_pool(this);
773 if (!MustUseReg(j.rmode_) && mode == OPTIMIZE_SIZE) { 778 if (!MustUseReg(j.rmode_) && mode == OPTIMIZE_SIZE) {
774 // Normal load of an immediate value which does not need Relocation Info. 779 // Normal load of an immediate value which does not need Relocation Info.
775 if (is_int16(j.imm32_)) { 780 if (is_int16(j.imm32_)) {
776 addiu(rd, zero_reg, j.imm32_); 781 addiu(rd, zero_reg, j.imm32_);
777 } else if (!(j.imm32_ & kHiMask)) { 782 } else if (!(j.imm32_ & kHiMask)) {
778 ori(rd, zero_reg, j.imm32_); 783 ori(rd, zero_reg, j.imm32_);
779 } else if (!(j.imm32_ & kImm16Mask)) { 784 } else if (!(j.imm32_ & kImm16Mask)) {
(...skipping 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after
3689 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, 3694 void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
3690 const ParameterCount& expected, 3695 const ParameterCount& expected,
3691 const ParameterCount& actual, 3696 const ParameterCount& actual,
3692 InvokeFlag flag, 3697 InvokeFlag flag,
3693 const CallWrapper& call_wrapper, 3698 const CallWrapper& call_wrapper,
3694 CallKind call_kind) { 3699 CallKind call_kind) {
3695 // You can't call a function without a valid frame. 3700 // You can't call a function without a valid frame.
3696 ASSERT(flag == JUMP_FUNCTION || has_frame()); 3701 ASSERT(flag == JUMP_FUNCTION || has_frame());
3697 3702
3698 // Get the function and setup the context. 3703 // Get the function and setup the context.
3699 LoadHeapObject(a1, function); 3704 li(a1, function);
3700 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 3705 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
3701 3706
3702 // We call indirectly through the code field in the function to 3707 // We call indirectly through the code field in the function to
3703 // allow recompilation to take effect without changing any of the 3708 // allow recompilation to take effect without changing any of the
3704 // call sites. 3709 // call sites.
3705 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 3710 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
3706 InvokeCode(a3, expected, actual, flag, call_wrapper, call_kind); 3711 InvokeCode(a3, expected, actual, flag, call_wrapper, call_kind);
3707 } 3712 }
3708 3713
3709 3714
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
4589 if (frame_mode == BUILD_STUB_FRAME) { 4594 if (frame_mode == BUILD_STUB_FRAME) {
4590 Push(ra, fp, cp); 4595 Push(ra, fp, cp);
4591 Push(Smi::FromInt(StackFrame::STUB)); 4596 Push(Smi::FromInt(StackFrame::STUB));
4592 // Adjust FP to point to saved FP. 4597 // Adjust FP to point to saved FP.
4593 Addu(fp, sp, Operand(2 * kPointerSize)); 4598 Addu(fp, sp, Operand(2 * kPointerSize));
4594 } else { 4599 } else {
4595 PredictableCodeSizeScope predictible_code_size_scope( 4600 PredictableCodeSizeScope predictible_code_size_scope(
4596 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); 4601 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize);
4597 // The following three instructions must remain together and unmodified 4602 // The following three instructions must remain together and unmodified
4598 // for code aging to work properly. 4603 // for code aging to work properly.
4599 if (FLAG_optimize_for_size && FLAG_age_code) { 4604 if (isolate()->IsCodePreAgingActive()) {
4600 // Pre-age the code. 4605 // Pre-age the code.
4601 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); 4606 Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
4602 nop(Assembler::CODE_AGE_MARKER_NOP); 4607 nop(Assembler::CODE_AGE_MARKER_NOP);
4603 // Save the function's original return address 4608 // Save the function's original return address
4604 // (it will be clobbered by Call(t9)) 4609 // (it will be clobbered by Call(t9)).
4605 mov(at, ra); 4610 mov(at, ra);
4606 // Load the stub address to t9 and call it 4611 // Load the stub address to t9 and call it.
4607 li(t9, 4612 li(t9,
4608 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); 4613 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
4609 Call(t9); 4614 Call(t9);
4610 // Record the stub address in the empty space for GetCodeAgeAndParity() 4615 // Record the stub address in the empty space for GetCodeAgeAndParity().
4611 dd(reinterpret_cast<uint32_t>(stub->instruction_start())); 4616 emit_code_stub_address(stub);
4612 } else { 4617 } else {
4613 Push(ra, fp, cp, a1); 4618 Push(ra, fp, cp, a1);
4614 nop(Assembler::CODE_AGE_SEQUENCE_NOP); 4619 nop(Assembler::CODE_AGE_SEQUENCE_NOP);
4615 // Adjust fp to point to caller's fp. 4620 // Adjust fp to point to caller's fp.
4616 Addu(fp, sp, Operand(2 * kPointerSize)); 4621 Addu(fp, sp, Operand(2 * kPointerSize));
4617 } 4622 }
4618 } 4623 }
4619 } 4624 }
4620 4625
4621 4626
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
5709 opcode == BGTZL); 5714 opcode == BGTZL);
5710 opcode = (cond == eq) ? BEQ : BNE; 5715 opcode = (cond == eq) ? BEQ : BNE;
5711 instr = (instr & ~kOpcodeMask) | opcode; 5716 instr = (instr & ~kOpcodeMask) | opcode;
5712 masm_.emit(instr); 5717 masm_.emit(instr);
5713 } 5718 }
5714 5719
5715 5720
5716 } } // namespace v8::internal 5721 } } // namespace v8::internal
5717 5722
5718 #endif // V8_TARGET_ARCH_MIPS 5723 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698