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 7512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7523 } | 7523 } |
7524 } | 7524 } |
7525 | 7525 |
7526 | 7526 |
7527 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | 7527 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
7528 // The entry hook is a "push ra" instruction, followed by a call. | 7528 // The entry hook is a "push ra" instruction, followed by a call. |
7529 // Note: on MIPS "push" is 2 instruction | 7529 // Note: on MIPS "push" is 2 instruction |
7530 const int32_t kReturnAddressDistanceFromFunctionStart = | 7530 const int32_t kReturnAddressDistanceFromFunctionStart = |
7531 Assembler::kCallTargetAddressOffset + (2 * Assembler::kInstrSize); | 7531 Assembler::kCallTargetAddressOffset + (2 * Assembler::kInstrSize); |
7532 | 7532 |
7533 // Save live volatile registers. | 7533 // This should contain all kCallerSaved registers. |
kisg
2013/07/01 20:48:22
kCallerSaved should read kJSCallerSaved
| |
7534 const RegList kSavedRegs = | |
7535 kJSCallerSaved | // Caller saved registers. | |
7536 s5.bit(); // Saved stack pointer. | |
7537 | |
7534 // We also save ra, so the count here is one higher than the mask indicates. | 7538 // We also save ra, so the count here is one higher than the mask indicates. |
7535 const int32_t kNumSavedRegs = kNumJSCallerSaved + 1; | 7539 const int32_t kNumSavedRegs = kNumJSCallerSaved + 2; |
7536 | 7540 |
7537 // Save all caller-save registers as this may be called from anywhere. | 7541 // Save all caller-save registers as this may be called from anywhere. |
7538 __ MultiPush(kJSCallerSaved | ra.bit()); | 7542 __ MultiPush(kSavedRegs | ra.bit()); |
7539 | 7543 |
7540 // Compute the function's address for the first argument. | 7544 // Compute the function's address for the first argument. |
7541 __ Subu(a0, ra, Operand(kReturnAddressDistanceFromFunctionStart)); | 7545 __ Subu(a0, ra, Operand(kReturnAddressDistanceFromFunctionStart)); |
7542 | 7546 |
7543 // The caller's return address is above the saved temporaries. | 7547 // The caller's return address is above the saved temporaries. |
7544 // Grab that for the second argument to the hook. | 7548 // Grab that for the second argument to the hook. |
7545 __ Addu(a1, sp, Operand(kNumSavedRegs * kPointerSize)); | 7549 __ Addu(a1, sp, Operand(kNumSavedRegs * kPointerSize)); |
7546 | 7550 |
7547 // Align the stack if necessary. | 7551 // Align the stack if necessary. |
7548 int frame_alignment = masm->ActivationFrameAlignment(); | 7552 int frame_alignment = masm->ActivationFrameAlignment(); |
7549 if (frame_alignment > kPointerSize) { | 7553 if (frame_alignment > kPointerSize) { |
7550 __ mov(t1, sp); | 7554 __ mov(s5, sp); |
7551 ASSERT(IsPowerOf2(frame_alignment)); | 7555 ASSERT(IsPowerOf2(frame_alignment)); |
7552 __ And(sp, sp, Operand(-frame_alignment)); | 7556 __ And(sp, sp, Operand(-frame_alignment)); |
7553 } | 7557 } |
7554 | 7558 |
7555 #if defined(V8_HOST_ARCH_MIPS) | 7559 #if defined(V8_HOST_ARCH_MIPS) |
7556 int32_t entry_hook = | 7560 int32_t entry_hook = |
7557 reinterpret_cast<int32_t>(masm->isolate()->function_entry_hook()); | 7561 reinterpret_cast<int32_t>(masm->isolate()->function_entry_hook()); |
7558 __ li(at, Operand(entry_hook)); | 7562 __ li(at, Operand(entry_hook)); |
7559 #else | 7563 #else |
7560 // Under the simulator we need to indirect the entry hook through a | 7564 // Under the simulator we need to indirect the entry hook through a |
7561 // trampoline function at a known address. | 7565 // trampoline function at a known address. |
7562 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); | 7566 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); |
7563 __ li(at, Operand(ExternalReference(&dispatcher, | 7567 __ li(at, Operand(ExternalReference(&dispatcher, |
7564 ExternalReference::BUILTIN_CALL, | 7568 ExternalReference::BUILTIN_CALL, |
7565 masm->isolate()))); | 7569 masm->isolate()))); |
7566 #endif | 7570 #endif |
7567 __ Call(at); | 7571 __ Call(at); |
7568 | 7572 |
7569 // Restore the stack pointer if needed. | 7573 // Restore the stack pointer if needed. |
7570 if (frame_alignment > kPointerSize) { | 7574 if (frame_alignment > kPointerSize) { |
7571 __ mov(sp, t1); | 7575 __ mov(sp, s5); |
7572 } | 7576 } |
7573 | 7577 |
7574 // Also pop ra to get Ret(0). | 7578 // Also pop ra to get Ret(0). |
7575 __ MultiPop(kJSCallerSaved | ra.bit()); | 7579 __ MultiPop(kSavedRegs | ra.bit()); |
7576 __ Ret(); | 7580 __ Ret(); |
7577 } | 7581 } |
7578 | 7582 |
7579 | 7583 |
7580 template<class T> | 7584 template<class T> |
7581 static void CreateArrayDispatch(MacroAssembler* masm) { | 7585 static void CreateArrayDispatch(MacroAssembler* masm) { |
7582 int last_index = GetSequenceIndexFromFastElementsKind( | 7586 int last_index = GetSequenceIndexFromFastElementsKind( |
7583 TERMINAL_FAST_ELEMENTS_KIND); | 7587 TERMINAL_FAST_ELEMENTS_KIND); |
7584 for (int i = 0; i <= last_index; ++i) { | 7588 for (int i = 0; i <= last_index; ++i) { |
7585 Label next; | 7589 Label next; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7845 __ bind(&fast_elements_case); | 7849 __ bind(&fast_elements_case); |
7846 GenerateCase(masm, FAST_ELEMENTS); | 7850 GenerateCase(masm, FAST_ELEMENTS); |
7847 } | 7851 } |
7848 | 7852 |
7849 | 7853 |
7850 #undef __ | 7854 #undef __ |
7851 | 7855 |
7852 } } // namespace v8::internal | 7856 } } // namespace v8::internal |
7853 | 7857 |
7854 #endif // V8_TARGET_ARCH_MIPS | 7858 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |