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 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2808 gc_required, | 2808 gc_required, |
2809 TAG_OBJECT); | 2809 TAG_OBJECT); |
2810 InitializeNewString(result, | 2810 InitializeNewString(result, |
2811 length, | 2811 length, |
2812 Heap::kConsAsciiStringMapRootIndex, | 2812 Heap::kConsAsciiStringMapRootIndex, |
2813 scratch1, | 2813 scratch1, |
2814 scratch2); | 2814 scratch2); |
2815 } | 2815 } |
2816 | 2816 |
2817 | 2817 |
2818 void MacroAssembler::AllocateTwoByteSlicedString(Register result, | |
2819 Register length, | |
2820 Register scratch1, | |
2821 Register scratch2, | |
2822 Label* gc_required) { | |
2823 AllocateInNewSpace(SlicedString::kSize, | |
2824 result, | |
2825 scratch1, | |
2826 scratch2, | |
2827 gc_required, | |
2828 TAG_OBJECT); | |
2829 | |
2830 InitializeNewString(result, | |
2831 length, | |
2832 Heap::kSlicedStringMapRootIndex, | |
2833 scratch1, | |
2834 scratch2); | |
2835 } | |
2836 | |
2837 | |
2838 void MacroAssembler::AllocateAsciiSlicedString(Register result, | |
2839 Register length, | |
2840 Register scratch1, | |
2841 Register scratch2, | |
2842 Label* gc_required) { | |
2843 AllocateInNewSpace(SlicedString::kSize, | |
2844 result, | |
2845 scratch1, | |
2846 scratch2, | |
2847 gc_required, | |
2848 TAG_OBJECT); | |
2849 | |
2850 InitializeNewString(result, | |
2851 length, | |
2852 Heap::kSlicedAsciiStringMapRootIndex, | |
2853 scratch1, | |
2854 scratch2); | |
2855 } | |
2856 | |
2857 | |
2858 // Allocates a heap number or jumps to the label if the young space is full and | 2818 // Allocates a heap number or jumps to the label if the young space is full and |
2859 // a scavenge is needed. | 2819 // a scavenge is needed. |
2860 void MacroAssembler::AllocateHeapNumber(Register result, | 2820 void MacroAssembler::AllocateHeapNumber(Register result, |
2861 Register scratch1, | 2821 Register scratch1, |
2862 Register scratch2, | 2822 Register scratch2, |
2863 Register heap_number_map, | 2823 Register heap_number_map, |
2864 Label* need_gc) { | 2824 Label* need_gc) { |
2865 // Allocate an object in the heap for the heap number and tag it as a heap | 2825 // Allocate an object in the heap for the heap number and tag it as a heap |
2866 // object. | 2826 // object. |
2867 AllocateInNewSpace(HeapNumber::kSize, | 2827 AllocateInNewSpace(HeapNumber::kSize, |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4246 static const int kRegisterPassedArguments = 4; | 4206 static const int kRegisterPassedArguments = 4; |
4247 | 4207 |
4248 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 4208 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { |
4249 int frame_alignment = ActivationFrameAlignment(); | 4209 int frame_alignment = ActivationFrameAlignment(); |
4250 | 4210 |
4251 // Up to four simple arguments are passed in registers a0..a3. | 4211 // Up to four simple arguments are passed in registers a0..a3. |
4252 // Those four arguments must have reserved argument slots on the stack for | 4212 // Those four arguments must have reserved argument slots on the stack for |
4253 // mips, even though those argument slots are not normally used. | 4213 // mips, even though those argument slots are not normally used. |
4254 // Remaining arguments are pushed on the stack, above (higher address than) | 4214 // Remaining arguments are pushed on the stack, above (higher address than) |
4255 // the argument slots. | 4215 // the argument slots. |
| 4216 ASSERT(StandardFrameConstants::kCArgsSlotsSize % kPointerSize == 0); |
4256 int stack_passed_arguments = ((num_arguments <= kRegisterPassedArguments) ? | 4217 int stack_passed_arguments = ((num_arguments <= kRegisterPassedArguments) ? |
4257 0 : num_arguments - kRegisterPassedArguments) + | 4218 0 : num_arguments - kRegisterPassedArguments) + |
4258 kCArgSlotCount; | 4219 (StandardFrameConstants::kCArgsSlotsSize / |
| 4220 kPointerSize); |
4259 if (frame_alignment > kPointerSize) { | 4221 if (frame_alignment > kPointerSize) { |
4260 // Make stack end at alignment and make room for num_arguments - 4 words | 4222 // Make stack end at alignment and make room for num_arguments - 4 words |
4261 // and the original value of sp. | 4223 // and the original value of sp. |
4262 mov(scratch, sp); | 4224 mov(scratch, sp); |
4263 Subu(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); | 4225 Subu(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); |
4264 ASSERT(IsPowerOf2(frame_alignment)); | 4226 ASSERT(IsPowerOf2(frame_alignment)); |
4265 And(sp, sp, Operand(-frame_alignment)); | 4227 And(sp, sp, Operand(-frame_alignment)); |
4266 sw(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 4228 sw(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
4267 } else { | 4229 } else { |
4268 Subu(sp, sp, Operand(stack_passed_arguments * kPointerSize)); | 4230 Subu(sp, sp, Operand(stack_passed_arguments * kPointerSize)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4320 if (function.is(no_reg)) { | 4282 if (function.is(no_reg)) { |
4321 function = t9; | 4283 function = t9; |
4322 li(function, Operand(function_reference)); | 4284 li(function, Operand(function_reference)); |
4323 } else if (!function.is(t9)) { | 4285 } else if (!function.is(t9)) { |
4324 mov(t9, function); | 4286 mov(t9, function); |
4325 function = t9; | 4287 function = t9; |
4326 } | 4288 } |
4327 | 4289 |
4328 Call(function); | 4290 Call(function); |
4329 | 4291 |
| 4292 ASSERT(StandardFrameConstants::kCArgsSlotsSize % kPointerSize == 0); |
4330 int stack_passed_arguments = ((num_arguments <= kRegisterPassedArguments) ? | 4293 int stack_passed_arguments = ((num_arguments <= kRegisterPassedArguments) ? |
4331 0 : num_arguments - kRegisterPassedArguments) + | 4294 0 : num_arguments - kRegisterPassedArguments) + |
4332 kCArgSlotCount; | 4295 (StandardFrameConstants::kCArgsSlotsSize / |
| 4296 kPointerSize); |
4333 | 4297 |
4334 if (OS::ActivationFrameAlignment() > kPointerSize) { | 4298 if (OS::ActivationFrameAlignment() > kPointerSize) { |
4335 lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 4299 lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
4336 } else { | 4300 } else { |
4337 Addu(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize))); | 4301 Addu(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize))); |
4338 } | 4302 } |
4339 } | 4303 } |
4340 | 4304 |
4341 | 4305 |
4342 #undef BRANCH_ARGS_CHECK | 4306 #undef BRANCH_ARGS_CHECK |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4403 opcode == BGTZL); | 4367 opcode == BGTZL); |
4404 opcode = (cond == eq) ? BEQ : BNE; | 4368 opcode = (cond == eq) ? BEQ : BNE; |
4405 instr = (instr & ~kOpcodeMask) | opcode; | 4369 instr = (instr & ~kOpcodeMask) | opcode; |
4406 masm_.emit(instr); | 4370 masm_.emit(instr); |
4407 } | 4371 } |
4408 | 4372 |
4409 | 4373 |
4410 } } // namespace v8::internal | 4374 } } // namespace v8::internal |
4411 | 4375 |
4412 #endif // V8_TARGET_ARCH_MIPS | 4376 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |