OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 0, | 1792 0, |
1793 1); | 1793 1); |
1794 if (result->IsFailure()) { | 1794 if (result->IsFailure()) { |
1795 return result; | 1795 return result; |
1796 } | 1796 } |
1797 | 1797 |
1798 // HandleScope limit has changed. Delete allocated extensions. | 1798 // HandleScope limit has changed. Delete allocated extensions. |
1799 bind(&delete_allocated_handles); | 1799 bind(&delete_allocated_handles); |
1800 str(r5, MemOperand(r7, kLimitOffset)); | 1800 str(r5, MemOperand(r7, kLimitOffset)); |
1801 mov(r4, r0); | 1801 mov(r4, r0); |
1802 PrepareCallCFunction(0, r5); | 1802 PrepareCallCFunction(1, r5); |
| 1803 mov(r0, Operand(ExternalReference::isolate_address())); |
1803 CallCFunction( | 1804 CallCFunction( |
1804 ExternalReference::delete_handle_scope_extensions(isolate()), 0); | 1805 ExternalReference::delete_handle_scope_extensions(isolate()), 1); |
1805 mov(r0, r4); | 1806 mov(r0, r4); |
1806 jmp(&leave_exit_frame); | 1807 jmp(&leave_exit_frame); |
1807 | 1808 |
1808 return result; | 1809 return result; |
1809 } | 1810 } |
1810 | 1811 |
1811 | 1812 |
1812 void MacroAssembler::IllegalOperation(int num_arguments) { | 1813 void MacroAssembler::IllegalOperation(int num_arguments) { |
1813 if (num_arguments > 0) { | 1814 if (num_arguments > 0) { |
1814 add(sp, sp, Operand(num_arguments * kPointerSize)); | 1815 add(sp, sp, Operand(num_arguments * kPointerSize)); |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 and_(scratch, type, Operand(kFlatAsciiStringMask)); | 2791 and_(scratch, type, Operand(kFlatAsciiStringMask)); |
2791 cmp(scratch, Operand(kFlatAsciiStringTag)); | 2792 cmp(scratch, Operand(kFlatAsciiStringTag)); |
2792 b(ne, failure); | 2793 b(ne, failure); |
2793 } | 2794 } |
2794 | 2795 |
2795 static const int kRegisterPassedArguments = 4; | 2796 static const int kRegisterPassedArguments = 4; |
2796 | 2797 |
2797 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 2798 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { |
2798 int frame_alignment = ActivationFrameAlignment(); | 2799 int frame_alignment = ActivationFrameAlignment(); |
2799 | 2800 |
2800 // Reserve space for Isolate address which is always passed as last parameter | |
2801 num_arguments += 1; | |
2802 | |
2803 // Up to four simple arguments are passed in registers r0..r3. | 2801 // Up to four simple arguments are passed in registers r0..r3. |
2804 int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ? | 2802 int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ? |
2805 0 : num_arguments - kRegisterPassedArguments; | 2803 0 : num_arguments - kRegisterPassedArguments; |
2806 if (frame_alignment > kPointerSize) { | 2804 if (frame_alignment > kPointerSize) { |
2807 // Make stack end at alignment and make room for num_arguments - 4 words | 2805 // Make stack end at alignment and make room for num_arguments - 4 words |
2808 // and the original value of sp. | 2806 // and the original value of sp. |
2809 mov(scratch, sp); | 2807 mov(scratch, sp); |
2810 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); | 2808 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); |
2811 ASSERT(IsPowerOf2(frame_alignment)); | 2809 ASSERT(IsPowerOf2(frame_alignment)); |
2812 and_(sp, sp, Operand(-frame_alignment)); | 2810 and_(sp, sp, Operand(-frame_alignment)); |
(...skipping 16 matching lines...) Expand all Loading... |
2829 ExternalReference::the_hole_value_location(isolate()), | 2827 ExternalReference::the_hole_value_location(isolate()), |
2830 scratch, | 2828 scratch, |
2831 num_arguments); | 2829 num_arguments); |
2832 } | 2830 } |
2833 | 2831 |
2834 | 2832 |
2835 void MacroAssembler::CallCFunctionHelper(Register function, | 2833 void MacroAssembler::CallCFunctionHelper(Register function, |
2836 ExternalReference function_reference, | 2834 ExternalReference function_reference, |
2837 Register scratch, | 2835 Register scratch, |
2838 int num_arguments) { | 2836 int num_arguments) { |
2839 // Push Isolate address as the last argument. | |
2840 if (num_arguments < kRegisterPassedArguments) { | |
2841 Register arg_to_reg[] = {r0, r1, r2, r3}; | |
2842 Register r = arg_to_reg[num_arguments]; | |
2843 mov(r, Operand(ExternalReference::isolate_address())); | |
2844 } else { | |
2845 int stack_passed_arguments = num_arguments - kRegisterPassedArguments; | |
2846 // Push Isolate address on the stack after the arguments. | |
2847 mov(scratch, Operand(ExternalReference::isolate_address())); | |
2848 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); | |
2849 } | |
2850 num_arguments += 1; | |
2851 | |
2852 // Make sure that the stack is aligned before calling a C function unless | 2837 // Make sure that the stack is aligned before calling a C function unless |
2853 // running in the simulator. The simulator has its own alignment check which | 2838 // running in the simulator. The simulator has its own alignment check which |
2854 // provides more information. | 2839 // provides more information. |
2855 #if defined(V8_HOST_ARCH_ARM) | 2840 #if defined(V8_HOST_ARCH_ARM) |
2856 if (emit_debug_code()) { | 2841 if (emit_debug_code()) { |
2857 int frame_alignment = OS::ActivationFrameAlignment(); | 2842 int frame_alignment = OS::ActivationFrameAlignment(); |
2858 int frame_alignment_mask = frame_alignment - 1; | 2843 int frame_alignment_mask = frame_alignment - 1; |
2859 if (frame_alignment > kPointerSize) { | 2844 if (frame_alignment > kPointerSize) { |
2860 ASSERT(IsPowerOf2(frame_alignment)); | 2845 ASSERT(IsPowerOf2(frame_alignment)); |
2861 Label alignment_as_expected; | 2846 Label alignment_as_expected; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2942 void CodePatcher::EmitCondition(Condition cond) { | 2927 void CodePatcher::EmitCondition(Condition cond) { |
2943 Instr instr = Assembler::instr_at(masm_.pc_); | 2928 Instr instr = Assembler::instr_at(masm_.pc_); |
2944 instr = (instr & ~kCondMask) | cond; | 2929 instr = (instr & ~kCondMask) | cond; |
2945 masm_.emit(instr); | 2930 masm_.emit(instr); |
2946 } | 2931 } |
2947 | 2932 |
2948 | 2933 |
2949 } } // namespace v8::internal | 2934 } } // namespace v8::internal |
2950 | 2935 |
2951 #endif // V8_TARGET_ARCH_ARM | 2936 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |