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 4195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4206 static const int kRegisterPassedArguments = 4; | 4206 static const int kRegisterPassedArguments = 4; |
4207 | 4207 |
4208 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 4208 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { |
4209 int frame_alignment = ActivationFrameAlignment(); | 4209 int frame_alignment = ActivationFrameAlignment(); |
4210 | 4210 |
4211 // Up to four simple arguments are passed in registers a0..a3. | 4211 // Up to four simple arguments are passed in registers a0..a3. |
4212 // 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 |
4213 // mips, even though those argument slots are not normally used. | 4213 // mips, even though those argument slots are not normally used. |
4214 // Remaining arguments are pushed on the stack, above (higher address than) | 4214 // Remaining arguments are pushed on the stack, above (higher address than) |
4215 // the argument slots. | 4215 // the argument slots. |
4216 ASSERT(StandardFrameConstants::kCArgsSlotsSize % kPointerSize == 0); | |
4217 int stack_passed_arguments = ((num_arguments <= kRegisterPassedArguments) ? | 4216 int stack_passed_arguments = ((num_arguments <= kRegisterPassedArguments) ? |
4218 0 : num_arguments - kRegisterPassedArguments) + | 4217 0 : num_arguments - kRegisterPassedArguments) + |
4219 (StandardFrameConstants::kCArgsSlotsSize / | 4218 kCArgSlotCount; |
4220 kPointerSize); | |
4221 if (frame_alignment > kPointerSize) { | 4219 if (frame_alignment > kPointerSize) { |
4222 // Make stack end at alignment and make room for num_arguments - 4 words | 4220 // Make stack end at alignment and make room for num_arguments - 4 words |
4223 // and the original value of sp. | 4221 // and the original value of sp. |
4224 mov(scratch, sp); | 4222 mov(scratch, sp); |
4225 Subu(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); | 4223 Subu(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); |
4226 ASSERT(IsPowerOf2(frame_alignment)); | 4224 ASSERT(IsPowerOf2(frame_alignment)); |
4227 And(sp, sp, Operand(-frame_alignment)); | 4225 And(sp, sp, Operand(-frame_alignment)); |
4228 sw(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 4226 sw(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
4229 } else { | 4227 } else { |
4230 Subu(sp, sp, Operand(stack_passed_arguments * kPointerSize)); | 4228 Subu(sp, sp, Operand(stack_passed_arguments * kPointerSize)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4282 if (function.is(no_reg)) { | 4280 if (function.is(no_reg)) { |
4283 function = t9; | 4281 function = t9; |
4284 li(function, Operand(function_reference)); | 4282 li(function, Operand(function_reference)); |
4285 } else if (!function.is(t9)) { | 4283 } else if (!function.is(t9)) { |
4286 mov(t9, function); | 4284 mov(t9, function); |
4287 function = t9; | 4285 function = t9; |
4288 } | 4286 } |
4289 | 4287 |
4290 Call(function); | 4288 Call(function); |
4291 | 4289 |
4292 ASSERT(StandardFrameConstants::kCArgsSlotsSize % kPointerSize == 0); | |
4293 int stack_passed_arguments = ((num_arguments <= kRegisterPassedArguments) ? | 4290 int stack_passed_arguments = ((num_arguments <= kRegisterPassedArguments) ? |
4294 0 : num_arguments - kRegisterPassedArguments) + | 4291 0 : num_arguments - kRegisterPassedArguments) + |
4295 (StandardFrameConstants::kCArgsSlotsSize / | 4292 kCArgSlotCount; |
4296 kPointerSize); | |
4297 | 4293 |
4298 if (OS::ActivationFrameAlignment() > kPointerSize) { | 4294 if (OS::ActivationFrameAlignment() > kPointerSize) { |
4299 lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 4295 lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
4300 } else { | 4296 } else { |
4301 Addu(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize))); | 4297 Addu(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize))); |
4302 } | 4298 } |
4303 } | 4299 } |
4304 | 4300 |
4305 | 4301 |
4306 #undef BRANCH_ARGS_CHECK | 4302 #undef BRANCH_ARGS_CHECK |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4367 opcode == BGTZL); | 4363 opcode == BGTZL); |
4368 opcode = (cond == eq) ? BEQ : BNE; | 4364 opcode = (cond == eq) ? BEQ : BNE; |
4369 instr = (instr & ~kOpcodeMask) | opcode; | 4365 instr = (instr & ~kOpcodeMask) | opcode; |
4370 masm_.emit(instr); | 4366 masm_.emit(instr); |
4371 } | 4367 } |
4372 | 4368 |
4373 | 4369 |
4374 } } // namespace v8::internal | 4370 } } // namespace v8::internal |
4375 | 4371 |
4376 #endif // V8_TARGET_ARCH_MIPS | 4372 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |