Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 StoreBufferOverflowStub(fp_mode); | 595 StoreBufferOverflowStub(fp_mode); |
| 596 CallStub(&store_buffer_overflow); | 596 CallStub(&store_buffer_overflow); |
| 597 pop(lr); | 597 pop(lr); |
| 598 bind(&done); | 598 bind(&done); |
| 599 if (and_then == kReturnAtEnd) { | 599 if (and_then == kReturnAtEnd) { |
| 600 Ret(); | 600 Ret(); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 | 603 |
| 604 | 604 |
| 605 void MacroAssembler::PushFixedFrame(Register marker_reg) { | |
| 606 ASSERT(!marker_reg.is_valid() || marker_reg.code() < pp.code()); | |
|
Rodolph Perfetta
2013/11/27 20:09:41
marker_reg.code() < cp.code()
rmcilroy
2013/11/28 11:32:26
Good catch, thanks! Done.
| |
| 607 stm(db_w, sp, (marker_reg.is_valid() ? marker_reg.bit() : 0) | | |
| 608 cp.bit() | | |
| 609 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) | | |
| 610 fp.bit() | | |
| 611 lr.bit()); | |
| 612 } | |
| 613 | |
| 614 | |
| 615 void MacroAssembler::PopFixedFrame(Register marker_reg) { | |
| 616 ASSERT(!marker_reg.is_valid() || marker_reg.code() < pp.code()); | |
|
Rodolph Perfetta
2013/11/27 20:09:41
ditto.
rmcilroy
2013/11/28 11:32:26
Done.
| |
| 617 ldm(ia_w, sp, (marker_reg.is_valid() ? marker_reg.bit() : 0) | | |
| 618 cp.bit() | | |
| 619 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) | | |
| 620 fp.bit() | | |
| 621 lr.bit()); | |
| 622 } | |
| 623 | |
| 624 | |
| 605 // Push and pop all registers that can hold pointers. | 625 // Push and pop all registers that can hold pointers. |
| 606 void MacroAssembler::PushSafepointRegisters() { | 626 void MacroAssembler::PushSafepointRegisters() { |
| 607 // Safepoints expect a block of contiguous register values starting with r0: | 627 // Safepoints expect a block of contiguous register values starting with r0: |
| 608 ASSERT(((1 << kNumSafepointSavedRegisters) - 1) == kSafepointSavedRegisters); | 628 ASSERT(((1 << kNumSafepointSavedRegisters) - 1) == kSafepointSavedRegisters); |
| 609 // Safepoints expect a block of kNumSafepointRegisters values on the | 629 // Safepoints expect a block of kNumSafepointRegisters values on the |
| 610 // stack, so adjust the stack for unsaved registers. | 630 // stack, so adjust the stack for unsaved registers. |
| 611 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; | 631 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; |
| 612 ASSERT(num_unsaved >= 0); | 632 ASSERT(num_unsaved >= 0); |
| 613 sub(sp, sp, Operand(num_unsaved * kPointerSize)); | 633 sub(sp, sp, Operand(num_unsaved * kPointerSize)); |
| 614 stm(db_w, sp, kSafepointSavedRegisters); | 634 stm(db_w, sp, kSafepointSavedRegisters); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 const LowDwVfpRegister loc = LowDwVfpRegister::from_code(dst.code()); | 883 const LowDwVfpRegister loc = LowDwVfpRegister::from_code(dst.code()); |
| 864 vmov(loc.low(), src); | 884 vmov(loc.low(), src); |
| 865 } else { | 885 } else { |
| 866 vmov(dst, VmovIndexLo, src); | 886 vmov(dst, VmovIndexLo, src); |
| 867 } | 887 } |
| 868 } | 888 } |
| 869 | 889 |
| 870 | 890 |
| 871 void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { | 891 void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { |
| 872 if (frame_mode == BUILD_STUB_FRAME) { | 892 if (frame_mode == BUILD_STUB_FRAME) { |
| 873 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 893 PushFixedFrame(); |
| 874 Push(Smi::FromInt(StackFrame::STUB)); | 894 Push(Smi::FromInt(StackFrame::STUB)); |
| 875 // Adjust FP to point to saved FP. | 895 // Adjust FP to point to saved FP. |
| 876 add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 896 add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 877 } else { | 897 } else { |
| 878 PredictableCodeSizeScope predictible_code_size_scope( | 898 PredictableCodeSizeScope predictible_code_size_scope( |
| 879 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); | 899 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); |
| 880 // The following three instructions must remain together and unmodified | 900 // The following three instructions must remain together and unmodified |
| 881 // for code aging to work properly. | 901 // for code aging to work properly. |
| 882 if (isolate()->IsCodePreAgingActive()) { | 902 if (isolate()->IsCodePreAgingActive()) { |
| 883 // Pre-age the code. | 903 // Pre-age the code. |
| 884 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); | 904 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
| 885 add(r0, pc, Operand(-8)); | 905 add(r0, pc, Operand(-8)); |
| 886 ldr(pc, MemOperand(pc, -4)); | 906 ldr(pc, MemOperand(pc, -4)); |
| 887 emit_code_stub_address(stub); | 907 emit_code_stub_address(stub); |
| 888 } else { | 908 } else { |
| 889 stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); | 909 PushFixedFrame(r1); |
| 890 nop(ip.code()); | 910 if (FLAG_enable_ool_constant_pool) { |
| 911 ldr(pp, FieldMemOperand(r1, JSFunction::kConstantPoolOffset)); | |
| 912 } else { | |
| 913 nop(ip.code()); | |
| 914 } | |
| 891 // Adjust FP to point to saved FP. | 915 // Adjust FP to point to saved FP. |
| 892 add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 916 add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 893 } | 917 } |
| 894 } | 918 } |
| 895 } | 919 } |
| 896 | 920 |
| 897 | 921 |
| 898 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 922 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
| 899 // r0-r3: preserved | 923 // r0-r3: preserved |
| 900 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 924 PushFixedFrame(); |
| 901 mov(ip, Operand(Smi::FromInt(type))); | 925 mov(ip, Operand(Smi::FromInt(type))); |
| 902 push(ip); | 926 push(ip); |
| 903 mov(ip, Operand(CodeObject())); | 927 mov(ip, Operand(CodeObject())); |
| 904 push(ip); | 928 push(ip); |
| 905 // Adjust FP to point to saved FP. | 929 // Adjust FP to point to saved FP. |
| 906 add(fp, sp, | 930 add(fp, sp, |
| 907 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); | 931 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); |
| 908 } | 932 } |
| 909 | 933 |
| 910 | 934 |
| 911 void MacroAssembler::LeaveFrame(StackFrame::Type type) { | 935 void MacroAssembler::LeaveFrame(StackFrame::Type type) { |
| 912 // r0: preserved | 936 // r0: preserved |
| 913 // r1: preserved | 937 // r1: preserved |
| 914 // r2: preserved | 938 // r2: preserved |
| 915 | 939 |
| 916 // Drop the execution stack down to the frame pointer and restore | 940 // Drop the execution stack down to the frame pointer and restore |
| 917 // the caller frame pointer and return address. | 941 // the caller frame pointer, return address and constant pool pointer |
| 918 mov(sp, fp); | 942 // (if FLAG_enable_ool_constant_pool). |
| 919 ldm(ia_w, sp, fp.bit() | lr.bit()); | 943 if (FLAG_enable_ool_constant_pool) { |
| 944 add(sp, fp, Operand(StandardFrameConstants::kConstantPoolOffset)); | |
| 945 ldm(ia_w, sp, pp.bit() | fp.bit() | lr.bit()); | |
| 946 } else { | |
| 947 mov(sp, fp); | |
| 948 ldm(ia_w, sp, fp.bit() | lr.bit()); | |
| 949 } | |
| 920 } | 950 } |
| 921 | 951 |
| 922 | 952 |
| 923 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { | 953 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { |
| 924 // Set up the frame structure on the stack. | 954 // Set up the frame structure on the stack. |
| 925 ASSERT_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement); | 955 ASSERT_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement); |
| 926 ASSERT_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset); | 956 ASSERT_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset); |
| 927 ASSERT_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset); | 957 ASSERT_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset); |
| 928 Push(lr, fp); | 958 Push(lr, fp); |
| 929 mov(fp, Operand(sp)); // Set up new frame pointer. | 959 mov(fp, Operand(sp)); // Set up new frame pointer. |
| (...skipping 3126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4056 void CodePatcher::EmitCondition(Condition cond) { | 4086 void CodePatcher::EmitCondition(Condition cond) { |
| 4057 Instr instr = Assembler::instr_at(masm_.pc_); | 4087 Instr instr = Assembler::instr_at(masm_.pc_); |
| 4058 instr = (instr & ~kCondMask) | cond; | 4088 instr = (instr & ~kCondMask) | cond; |
| 4059 masm_.emit(instr); | 4089 masm_.emit(instr); |
| 4060 } | 4090 } |
| 4061 | 4091 |
| 4062 | 4092 |
| 4063 } } // namespace v8::internal | 4093 } } // namespace v8::internal |
| 4064 | 4094 |
| 4065 #endif // V8_TARGET_ARCH_ARM | 4095 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |