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 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 ASSERT(AllowThisStubCall(&ces)); | 2569 ASSERT(AllowThisStubCall(&ces)); |
2570 Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); | 2570 Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); |
2571 } | 2571 } |
2572 | 2572 |
2573 #endif // ENABLE_DEBUGGER_SUPPORT | 2573 #endif // ENABLE_DEBUGGER_SUPPORT |
2574 | 2574 |
2575 | 2575 |
2576 // --------------------------------------------------------------------------- | 2576 // --------------------------------------------------------------------------- |
2577 // Exception handling. | 2577 // Exception handling. |
2578 | 2578 |
2579 void MacroAssembler::PushTryHandler(CodeLocation try_location, | 2579 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
2580 HandlerType type, | |
2581 int handler_index) { | 2580 int handler_index) { |
2582 // Adjust this code if not the case. | 2581 // Adjust this code if not the case. |
2583 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 2582 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); |
2584 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); | 2583 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); |
2585 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 2584 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); |
2586 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 2585 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); |
2587 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 2586 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); |
2588 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | 2587 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); |
2589 | 2588 |
2590 // For the JSEntry handler, we must preserve a0-a3 and s0. | 2589 // For the JSEntry handler, we must preserve a0-a3 and s0. |
2591 // t1-t3 are available. We will build up the handler from the bottom by | 2590 // t1-t3 are available. We will build up the handler from the bottom by |
2592 // pushing on the stack. First compute the state. | 2591 // pushing on the stack. |
2593 unsigned state = StackHandler::OffsetField::encode(handler_index); | |
2594 if (try_location == IN_JAVASCRIPT) { | |
2595 state |= (type == TRY_CATCH_HANDLER) | |
2596 ? StackHandler::KindField::encode(StackHandler::TRY_CATCH) | |
2597 : StackHandler::KindField::encode(StackHandler::TRY_FINALLY); | |
2598 } else { | |
2599 ASSERT(try_location == IN_JS_ENTRY); | |
2600 state |= StackHandler::KindField::encode(StackHandler::ENTRY); | |
2601 } | |
2602 | |
2603 // Set up the code object (t1) and the state (t2) for pushing. | 2592 // Set up the code object (t1) and the state (t2) for pushing. |
| 2593 unsigned state = |
| 2594 StackHandler::IndexField::encode(handler_index) | |
| 2595 StackHandler::KindField::encode(kind); |
2604 li(t1, Operand(CodeObject())); | 2596 li(t1, Operand(CodeObject())); |
2605 li(t2, Operand(state)); | 2597 li(t2, Operand(state)); |
2606 | 2598 |
2607 // Push the frame pointer, context, state, and code object. | 2599 // Push the frame pointer, context, state, and code object. |
2608 if (try_location == IN_JAVASCRIPT) { | 2600 if (kind == StackHandler::JS_ENTRY) { |
2609 MultiPush(t1.bit() | t2.bit() | cp.bit() | fp.bit()); | |
2610 } else { | |
2611 ASSERT_EQ(Smi::FromInt(0), 0); | 2601 ASSERT_EQ(Smi::FromInt(0), 0); |
2612 // The second zero_reg indicates no context. | 2602 // The second zero_reg indicates no context. |
2613 // The first zero_reg is the NULL frame pointer. | 2603 // The first zero_reg is the NULL frame pointer. |
2614 // The operands are reversed to match the order of MultiPush/Pop. | 2604 // The operands are reversed to match the order of MultiPush/Pop. |
2615 Push(zero_reg, zero_reg, t2, t1); | 2605 Push(zero_reg, zero_reg, t2, t1); |
| 2606 } else { |
| 2607 MultiPush(t1.bit() | t2.bit() | cp.bit() | fp.bit()); |
2616 } | 2608 } |
2617 | 2609 |
2618 // Link the current handler as the next handler. | 2610 // Link the current handler as the next handler. |
2619 li(t2, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | 2611 li(t2, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
2620 lw(t1, MemOperand(t2)); | 2612 lw(t1, MemOperand(t2)); |
2621 push(t1); | 2613 push(t1); |
2622 // Set this new handler as the current one. | 2614 // Set this new handler as the current one. |
2623 sw(sp, MemOperand(t2)); | 2615 sw(sp, MemOperand(t2)); |
2624 } | 2616 } |
2625 | 2617 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2720 li(a3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | 2712 li(a3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
2721 lw(sp, MemOperand(a3)); | 2713 lw(sp, MemOperand(a3)); |
2722 | 2714 |
2723 // Unwind the handlers until the ENTRY handler is found. | 2715 // Unwind the handlers until the ENTRY handler is found. |
2724 Label fetch_next, check_kind; | 2716 Label fetch_next, check_kind; |
2725 jmp(&check_kind); | 2717 jmp(&check_kind); |
2726 bind(&fetch_next); | 2718 bind(&fetch_next); |
2727 lw(sp, MemOperand(sp, StackHandlerConstants::kNextOffset)); | 2719 lw(sp, MemOperand(sp, StackHandlerConstants::kNextOffset)); |
2728 | 2720 |
2729 bind(&check_kind); | 2721 bind(&check_kind); |
2730 STATIC_ASSERT(StackHandler::ENTRY == 0); | 2722 STATIC_ASSERT(StackHandler::JS_ENTRY == 0); |
2731 lw(a2, MemOperand(sp, StackHandlerConstants::kStateOffset)); | 2723 lw(a2, MemOperand(sp, StackHandlerConstants::kStateOffset)); |
2732 And(a2, a2, Operand(StackHandler::KindField::kMask)); | 2724 And(a2, a2, Operand(StackHandler::KindField::kMask)); |
2733 Branch(&fetch_next, ne, a2, Operand(zero_reg)); | 2725 Branch(&fetch_next, ne, a2, Operand(zero_reg)); |
2734 | 2726 |
2735 // Set the top handler address to next handler past the top ENTRY handler. | 2727 // Set the top handler address to next handler past the top ENTRY handler. |
2736 pop(a2); | 2728 pop(a2); |
2737 sw(a2, MemOperand(a3)); | 2729 sw(a2, MemOperand(a3)); |
2738 | 2730 |
2739 // Get the code object (a1) and state (a2). Clear the context and frame | 2731 // Get the code object (a1) and state (a2). Clear the context and frame |
2740 // pointer (0 was saved in the handler). | 2732 // pointer (0 was saved in the handler). |
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5221 opcode == BGTZL); | 5213 opcode == BGTZL); |
5222 opcode = (cond == eq) ? BEQ : BNE; | 5214 opcode = (cond == eq) ? BEQ : BNE; |
5223 instr = (instr & ~kOpcodeMask) | opcode; | 5215 instr = (instr & ~kOpcodeMask) | opcode; |
5224 masm_.emit(instr); | 5216 masm_.emit(instr); |
5225 } | 5217 } |
5226 | 5218 |
5227 | 5219 |
5228 } } // namespace v8::internal | 5220 } } // namespace v8::internal |
5229 | 5221 |
5230 #endif // V8_TARGET_ARCH_MIPS | 5222 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |