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 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3425 __ b(eq, &retry); | 3425 __ b(eq, &retry); |
3426 | 3426 |
3427 // Special handling of out of memory exceptions. | 3427 // Special handling of out of memory exceptions. |
3428 Failure* out_of_memory = Failure::OutOfMemoryException(); | 3428 Failure* out_of_memory = Failure::OutOfMemoryException(); |
3429 __ cmp(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | 3429 __ cmp(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); |
3430 __ b(eq, throw_out_of_memory_exception); | 3430 __ b(eq, throw_out_of_memory_exception); |
3431 | 3431 |
3432 // Retrieve the pending exception and clear the variable. | 3432 // Retrieve the pending exception and clear the variable. |
3433 __ mov(ip, Operand(ExternalReference::the_hole_value_location(isolate))); | 3433 __ mov(ip, Operand(ExternalReference::the_hole_value_location(isolate))); |
3434 __ ldr(r3, MemOperand(ip)); | 3434 __ ldr(r3, MemOperand(ip)); |
3435 __ mov(ip, Operand(ExternalReference(Isolate::k_pending_exception_address, | 3435 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
3436 isolate))); | 3436 isolate))); |
3437 __ ldr(r0, MemOperand(ip)); | 3437 __ ldr(r0, MemOperand(ip)); |
3438 __ str(r3, MemOperand(ip)); | 3438 __ str(r3, MemOperand(ip)); |
3439 | 3439 |
3440 // Special handling of termination exceptions which are uncatchable | 3440 // Special handling of termination exceptions which are uncatchable |
3441 // by javascript code. | 3441 // by javascript code. |
3442 __ cmp(r0, Operand(isolate->factory()->termination_exception())); | 3442 __ cmp(r0, Operand(isolate->factory()->termination_exception())); |
3443 __ b(eq, throw_termination_exception); | 3443 __ b(eq, throw_termination_exception); |
3444 | 3444 |
3445 // Handle normal exception. | 3445 // Handle normal exception. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3560 // r1: function | 3560 // r1: function |
3561 // r2: receiver | 3561 // r2: receiver |
3562 // r3: argc | 3562 // r3: argc |
3563 // r4: argv | 3563 // r4: argv |
3564 Isolate* isolate = masm->isolate(); | 3564 Isolate* isolate = masm->isolate(); |
3565 __ mov(r8, Operand(-1)); // Push a bad frame pointer to fail if it is used. | 3565 __ mov(r8, Operand(-1)); // Push a bad frame pointer to fail if it is used. |
3566 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 3566 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
3567 __ mov(r7, Operand(Smi::FromInt(marker))); | 3567 __ mov(r7, Operand(Smi::FromInt(marker))); |
3568 __ mov(r6, Operand(Smi::FromInt(marker))); | 3568 __ mov(r6, Operand(Smi::FromInt(marker))); |
3569 __ mov(r5, | 3569 __ mov(r5, |
3570 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate))); | 3570 Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate))); |
3571 __ ldr(r5, MemOperand(r5)); | 3571 __ ldr(r5, MemOperand(r5)); |
3572 __ Push(r8, r7, r6, r5); | 3572 __ Push(r8, r7, r6, r5); |
3573 | 3573 |
3574 // Setup frame pointer for the frame to be pushed. | 3574 // Setup frame pointer for the frame to be pushed. |
3575 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); | 3575 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); |
3576 | 3576 |
3577 // If this is the outermost JS call, set js_entry_sp value. | 3577 // If this is the outermost JS call, set js_entry_sp value. |
3578 Label non_outermost_js; | 3578 Label non_outermost_js; |
3579 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); | 3579 ExternalReference js_entry_sp(Isolate::kJSEntrySPAddress, isolate); |
3580 __ mov(r5, Operand(ExternalReference(js_entry_sp))); | 3580 __ mov(r5, Operand(ExternalReference(js_entry_sp))); |
3581 __ ldr(r6, MemOperand(r5)); | 3581 __ ldr(r6, MemOperand(r5)); |
3582 __ cmp(r6, Operand::Zero()); | 3582 __ cmp(r6, Operand::Zero()); |
3583 __ b(ne, &non_outermost_js); | 3583 __ b(ne, &non_outermost_js); |
3584 __ str(fp, MemOperand(r5)); | 3584 __ str(fp, MemOperand(r5)); |
3585 __ mov(ip, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 3585 __ mov(ip, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
3586 Label cont; | 3586 Label cont; |
3587 __ b(&cont); | 3587 __ b(&cont); |
3588 __ bind(&non_outermost_js); | 3588 __ bind(&non_outermost_js); |
3589 __ mov(ip, Operand(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); | 3589 __ mov(ip, Operand(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); |
3590 __ bind(&cont); | 3590 __ bind(&cont); |
3591 __ push(ip); | 3591 __ push(ip); |
3592 | 3592 |
3593 // Call a faked try-block that does the invoke. | 3593 // Call a faked try-block that does the invoke. |
3594 __ bl(&invoke); | 3594 __ bl(&invoke); |
3595 | 3595 |
3596 // Caught exception: Store result (exception) in the pending | 3596 // Caught exception: Store result (exception) in the pending |
3597 // exception field in the JSEnv and return a failure sentinel. | 3597 // exception field in the JSEnv and return a failure sentinel. |
3598 // Coming in here the fp will be invalid because the PushTryHandler below | 3598 // Coming in here the fp will be invalid because the PushTryHandler below |
3599 // sets it to 0 to signal the existence of the JSEntry frame. | 3599 // sets it to 0 to signal the existence of the JSEntry frame. |
3600 __ mov(ip, Operand(ExternalReference(Isolate::k_pending_exception_address, | 3600 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
3601 isolate))); | 3601 isolate))); |
3602 __ str(r0, MemOperand(ip)); | 3602 __ str(r0, MemOperand(ip)); |
3603 __ mov(r0, Operand(reinterpret_cast<int32_t>(Failure::Exception()))); | 3603 __ mov(r0, Operand(reinterpret_cast<int32_t>(Failure::Exception()))); |
3604 __ b(&exit); | 3604 __ b(&exit); |
3605 | 3605 |
3606 // Invoke: Link this frame into the handler chain. | 3606 // Invoke: Link this frame into the handler chain. |
3607 __ bind(&invoke); | 3607 __ bind(&invoke); |
3608 // Must preserve r0-r4, r5-r7 are available. | 3608 // Must preserve r0-r4, r5-r7 are available. |
3609 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 3609 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
3610 // If an exception not caught by another handler occurs, this handler | 3610 // If an exception not caught by another handler occurs, this handler |
3611 // returns control to the code after the bl(&invoke) above, which | 3611 // returns control to the code after the bl(&invoke) above, which |
3612 // restores all kCalleeSaved registers (including cp and fp) to their | 3612 // restores all kCalleeSaved registers (including cp and fp) to their |
3613 // saved values before returning a failure to C. | 3613 // saved values before returning a failure to C. |
3614 | 3614 |
3615 // Clear any pending exceptions. | 3615 // Clear any pending exceptions. |
3616 __ mov(ip, Operand(ExternalReference::the_hole_value_location(isolate))); | 3616 __ mov(ip, Operand(ExternalReference::the_hole_value_location(isolate))); |
3617 __ ldr(r5, MemOperand(ip)); | 3617 __ ldr(r5, MemOperand(ip)); |
3618 __ mov(ip, Operand(ExternalReference(Isolate::k_pending_exception_address, | 3618 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
3619 isolate))); | 3619 isolate))); |
3620 __ str(r5, MemOperand(ip)); | 3620 __ str(r5, MemOperand(ip)); |
3621 | 3621 |
3622 // Invoke the function by calling through JS entry trampoline builtin. | 3622 // Invoke the function by calling through JS entry trampoline builtin. |
3623 // Notice that we cannot store a reference to the trampoline code directly in | 3623 // Notice that we cannot store a reference to the trampoline code directly in |
3624 // this stub, because runtime stubs are not traversed when doing GC. | 3624 // this stub, because runtime stubs are not traversed when doing GC. |
3625 | 3625 |
3626 // Expected registers by Builtins::JSEntryTrampoline | 3626 // Expected registers by Builtins::JSEntryTrampoline |
3627 // r0: code entry | 3627 // r0: code entry |
3628 // r1: function | 3628 // r1: function |
(...skipping 26 matching lines...) Expand all Loading... |
3655 __ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 3655 __ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
3656 __ b(ne, &non_outermost_js_2); | 3656 __ b(ne, &non_outermost_js_2); |
3657 __ mov(r6, Operand::Zero()); | 3657 __ mov(r6, Operand::Zero()); |
3658 __ mov(r5, Operand(ExternalReference(js_entry_sp))); | 3658 __ mov(r5, Operand(ExternalReference(js_entry_sp))); |
3659 __ str(r6, MemOperand(r5)); | 3659 __ str(r6, MemOperand(r5)); |
3660 __ bind(&non_outermost_js_2); | 3660 __ bind(&non_outermost_js_2); |
3661 | 3661 |
3662 // Restore the top frame descriptors from the stack. | 3662 // Restore the top frame descriptors from the stack. |
3663 __ pop(r3); | 3663 __ pop(r3); |
3664 __ mov(ip, | 3664 __ mov(ip, |
3665 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate))); | 3665 Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate))); |
3666 __ str(r3, MemOperand(ip)); | 3666 __ str(r3, MemOperand(ip)); |
3667 | 3667 |
3668 // Reset the stack to the callee saved registers. | 3668 // Reset the stack to the callee saved registers. |
3669 __ add(sp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); | 3669 __ add(sp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); |
3670 | 3670 |
3671 // Restore callee-saved registers and return. | 3671 // Restore callee-saved registers and return. |
3672 #ifdef DEBUG | 3672 #ifdef DEBUG |
3673 if (FLAG_debug_code) { | 3673 if (FLAG_debug_code) { |
3674 __ mov(lr, Operand(pc)); | 3674 __ mov(lr, Operand(pc)); |
3675 } | 3675 } |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4527 __ b(eq, &failure); | 4527 __ b(eq, &failure); |
4528 __ cmp(r0, Operand(NativeRegExpMacroAssembler::EXCEPTION)); | 4528 __ cmp(r0, Operand(NativeRegExpMacroAssembler::EXCEPTION)); |
4529 // If not exception it can only be retry. Handle that in the runtime system. | 4529 // If not exception it can only be retry. Handle that in the runtime system. |
4530 __ b(ne, &runtime); | 4530 __ b(ne, &runtime); |
4531 // Result must now be exception. If there is no pending exception already a | 4531 // Result must now be exception. If there is no pending exception already a |
4532 // stack overflow (on the backtrack stack) was detected in RegExp code but | 4532 // stack overflow (on the backtrack stack) was detected in RegExp code but |
4533 // haven't created the exception yet. Handle that in the runtime system. | 4533 // haven't created the exception yet. Handle that in the runtime system. |
4534 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 4534 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
4535 __ mov(r1, Operand(ExternalReference::the_hole_value_location(isolate))); | 4535 __ mov(r1, Operand(ExternalReference::the_hole_value_location(isolate))); |
4536 __ ldr(r1, MemOperand(r1, 0)); | 4536 __ ldr(r1, MemOperand(r1, 0)); |
4537 __ mov(r2, Operand(ExternalReference(Isolate::k_pending_exception_address, | 4537 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
4538 isolate))); | 4538 isolate))); |
4539 __ ldr(r0, MemOperand(r2, 0)); | 4539 __ ldr(r0, MemOperand(r2, 0)); |
4540 __ cmp(r0, r1); | 4540 __ cmp(r0, r1); |
4541 __ b(eq, &runtime); | 4541 __ b(eq, &runtime); |
4542 | 4542 |
4543 __ str(r1, MemOperand(r2, 0)); // Clear pending exception. | 4543 __ str(r1, MemOperand(r2, 0)); // Clear pending exception. |
4544 | 4544 |
4545 // Check if the exception is a termination. If so, throw as uncatchable. | 4545 // Check if the exception is a termination. If so, throw as uncatchable. |
4546 __ CompareRoot(r0, Heap::kTerminationExceptionRootIndex); | 4546 __ CompareRoot(r0, Heap::kTerminationExceptionRootIndex); |
4547 | 4547 |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6685 __ mov(result, Operand::Zero()); | 6685 __ mov(result, Operand::Zero()); |
6686 __ Ret(); | 6686 __ Ret(); |
6687 } | 6687 } |
6688 | 6688 |
6689 | 6689 |
6690 #undef __ | 6690 #undef __ |
6691 | 6691 |
6692 } } // namespace v8::internal | 6692 } } // namespace v8::internal |
6693 | 6693 |
6694 #endif // V8_TARGET_ARCH_ARM | 6694 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |