| 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 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3125 if (type == OUT_OF_MEMORY) { | 3125 if (type == OUT_OF_MEMORY) { |
| 3126 // Set external caught exception to false. | 3126 // Set external caught exception to false. |
| 3127 ExternalReference external_caught(Top::k_external_caught_exception_address); | 3127 ExternalReference external_caught(Top::k_external_caught_exception_address); |
| 3128 __ mov(r0, Operand(false, RelocInfo::NONE)); | 3128 __ mov(r0, Operand(false, RelocInfo::NONE)); |
| 3129 __ mov(r2, Operand(external_caught)); | 3129 __ mov(r2, Operand(external_caught)); |
| 3130 __ str(r0, MemOperand(r2)); | 3130 __ str(r0, MemOperand(r2)); |
| 3131 | 3131 |
| 3132 // Set pending exception and r0 to out of memory exception. | 3132 // Set pending exception and r0 to out of memory exception. |
| 3133 Failure* out_of_memory = Failure::OutOfMemoryException(); | 3133 Failure* out_of_memory = Failure::OutOfMemoryException(); |
| 3134 __ mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | 3134 __ mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); |
| 3135 __ mov(r2, Operand(ExternalReference::pending_exception_address())); | 3135 __ mov(r2, Operand(ExternalReference(Top::k_pending_exception_address))); |
| 3136 __ str(r0, MemOperand(r2)); | 3136 __ str(r0, MemOperand(r2)); |
| 3137 } | 3137 } |
| 3138 | 3138 |
| 3139 // Stack layout at this point. See also StackHandlerConstants. | 3139 // Stack layout at this point. See also StackHandlerConstants. |
| 3140 // sp -> state (ENTRY) | 3140 // sp -> state (ENTRY) |
| 3141 // fp | 3141 // fp |
| 3142 // lr | 3142 // lr |
| 3143 | 3143 |
| 3144 // Discard handler state (r2 is not used) and restore frame pointer. | 3144 // Discard handler state (r2 is not used) and restore frame pointer. |
| 3145 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 2 * kPointerSize); | 3145 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 2 * kPointerSize); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3255 __ b(eq, &retry); | 3255 __ b(eq, &retry); |
| 3256 | 3256 |
| 3257 // Special handling of out of memory exceptions. | 3257 // Special handling of out of memory exceptions. |
| 3258 Failure* out_of_memory = Failure::OutOfMemoryException(); | 3258 Failure* out_of_memory = Failure::OutOfMemoryException(); |
| 3259 __ cmp(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | 3259 __ cmp(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); |
| 3260 __ b(eq, throw_out_of_memory_exception); | 3260 __ b(eq, throw_out_of_memory_exception); |
| 3261 | 3261 |
| 3262 // Retrieve the pending exception and clear the variable. | 3262 // Retrieve the pending exception and clear the variable. |
| 3263 __ mov(ip, Operand(ExternalReference::the_hole_value_location())); | 3263 __ mov(ip, Operand(ExternalReference::the_hole_value_location())); |
| 3264 __ ldr(r3, MemOperand(ip)); | 3264 __ ldr(r3, MemOperand(ip)); |
| 3265 __ mov(ip, Operand(ExternalReference::pending_exception_address())); | 3265 __ mov(ip, Operand(ExternalReference(Top::k_pending_exception_address))); |
| 3266 __ ldr(r0, MemOperand(ip)); | 3266 __ ldr(r0, MemOperand(ip)); |
| 3267 __ str(r3, MemOperand(ip)); | 3267 __ str(r3, MemOperand(ip)); |
| 3268 | 3268 |
| 3269 // Special handling of termination exceptions which are uncatchable | 3269 // Special handling of termination exceptions which are uncatchable |
| 3270 // by javascript code. | 3270 // by javascript code. |
| 3271 __ cmp(r0, Operand(Factory::termination_exception())); | 3271 __ cmp(r0, Operand(Factory::termination_exception())); |
| 3272 __ b(eq, throw_termination_exception); | 3272 __ b(eq, throw_termination_exception); |
| 3273 | 3273 |
| 3274 // Handle normal exception. | 3274 // Handle normal exception. |
| 3275 __ jmp(throw_normal_exception); | 3275 __ jmp(throw_normal_exception); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3388 __ str(fp, MemOperand(r5), eq); | 3388 __ str(fp, MemOperand(r5), eq); |
| 3389 #endif | 3389 #endif |
| 3390 | 3390 |
| 3391 // Call a faked try-block that does the invoke. | 3391 // Call a faked try-block that does the invoke. |
| 3392 __ bl(&invoke); | 3392 __ bl(&invoke); |
| 3393 | 3393 |
| 3394 // Caught exception: Store result (exception) in the pending | 3394 // Caught exception: Store result (exception) in the pending |
| 3395 // exception field in the JSEnv and return a failure sentinel. | 3395 // exception field in the JSEnv and return a failure sentinel. |
| 3396 // Coming in here the fp will be invalid because the PushTryHandler below | 3396 // Coming in here the fp will be invalid because the PushTryHandler below |
| 3397 // sets it to 0 to signal the existence of the JSEntry frame. | 3397 // sets it to 0 to signal the existence of the JSEntry frame. |
| 3398 __ mov(ip, Operand(ExternalReference::pending_exception_address())); | 3398 __ mov(ip, Operand(ExternalReference(Top::k_pending_exception_address))); |
| 3399 __ str(r0, MemOperand(ip)); | 3399 __ str(r0, MemOperand(ip)); |
| 3400 __ mov(r0, Operand(reinterpret_cast<int32_t>(Failure::Exception()))); | 3400 __ mov(r0, Operand(reinterpret_cast<int32_t>(Failure::Exception()))); |
| 3401 __ b(&exit); | 3401 __ b(&exit); |
| 3402 | 3402 |
| 3403 // Invoke: Link this frame into the handler chain. | 3403 // Invoke: Link this frame into the handler chain. |
| 3404 __ bind(&invoke); | 3404 __ bind(&invoke); |
| 3405 // Must preserve r0-r4, r5-r7 are available. | 3405 // Must preserve r0-r4, r5-r7 are available. |
| 3406 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 3406 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
| 3407 // If an exception not caught by another handler occurs, this handler | 3407 // If an exception not caught by another handler occurs, this handler |
| 3408 // returns control to the code after the bl(&invoke) above, which | 3408 // returns control to the code after the bl(&invoke) above, which |
| 3409 // restores all kCalleeSaved registers (including cp and fp) to their | 3409 // restores all kCalleeSaved registers (including cp and fp) to their |
| 3410 // saved values before returning a failure to C. | 3410 // saved values before returning a failure to C. |
| 3411 | 3411 |
| 3412 // Clear any pending exceptions. | 3412 // Clear any pending exceptions. |
| 3413 __ mov(ip, Operand(ExternalReference::the_hole_value_location())); | 3413 __ mov(ip, Operand(ExternalReference::the_hole_value_location())); |
| 3414 __ ldr(r5, MemOperand(ip)); | 3414 __ ldr(r5, MemOperand(ip)); |
| 3415 __ mov(ip, Operand(ExternalReference::pending_exception_address())); | 3415 __ mov(ip, Operand(ExternalReference(Top::k_pending_exception_address))); |
| 3416 __ str(r5, MemOperand(ip)); | 3416 __ str(r5, MemOperand(ip)); |
| 3417 | 3417 |
| 3418 // Invoke the function by calling through JS entry trampoline builtin. | 3418 // Invoke the function by calling through JS entry trampoline builtin. |
| 3419 // Notice that we cannot store a reference to the trampoline code directly in | 3419 // Notice that we cannot store a reference to the trampoline code directly in |
| 3420 // this stub, because runtime stubs are not traversed when doing GC. | 3420 // this stub, because runtime stubs are not traversed when doing GC. |
| 3421 | 3421 |
| 3422 // Expected registers by Builtins::JSEntryTrampoline | 3422 // Expected registers by Builtins::JSEntryTrampoline |
| 3423 // r0: code entry | 3423 // r0: code entry |
| 3424 // r1: function | 3424 // r1: function |
| 3425 // r2: receiver | 3425 // r2: receiver |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4072 __ b(eq, &failure); | 4072 __ b(eq, &failure); |
| 4073 __ cmp(r0, Operand(NativeRegExpMacroAssembler::EXCEPTION)); | 4073 __ cmp(r0, Operand(NativeRegExpMacroAssembler::EXCEPTION)); |
| 4074 // If not exception it can only be retry. Handle that in the runtime system. | 4074 // If not exception it can only be retry. Handle that in the runtime system. |
| 4075 __ b(ne, &runtime); | 4075 __ b(ne, &runtime); |
| 4076 // Result must now be exception. If there is no pending exception already a | 4076 // Result must now be exception. If there is no pending exception already a |
| 4077 // stack overflow (on the backtrack stack) was detected in RegExp code but | 4077 // stack overflow (on the backtrack stack) was detected in RegExp code but |
| 4078 // haven't created the exception yet. Handle that in the runtime system. | 4078 // haven't created the exception yet. Handle that in the runtime system. |
| 4079 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 4079 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
| 4080 __ mov(r0, Operand(ExternalReference::the_hole_value_location())); | 4080 __ mov(r0, Operand(ExternalReference::the_hole_value_location())); |
| 4081 __ ldr(r0, MemOperand(r0, 0)); | 4081 __ ldr(r0, MemOperand(r0, 0)); |
| 4082 __ mov(r1, Operand(ExternalReference::pending_exception_address())); | 4082 __ mov(r1, Operand(ExternalReference(Top::k_pending_exception_address))); |
| 4083 __ ldr(r1, MemOperand(r1, 0)); | 4083 __ ldr(r1, MemOperand(r1, 0)); |
| 4084 __ cmp(r0, r1); | 4084 __ cmp(r0, r1); |
| 4085 __ b(eq, &runtime); | 4085 __ b(eq, &runtime); |
| 4086 __ bind(&failure); | 4086 __ bind(&failure); |
| 4087 // For failure and exception return null. | 4087 // For failure and exception return null. |
| 4088 __ mov(r0, Operand(Factory::null_value())); | 4088 __ mov(r0, Operand(Factory::null_value())); |
| 4089 __ add(sp, sp, Operand(4 * kPointerSize)); | 4089 __ add(sp, sp, Operand(4 * kPointerSize)); |
| 4090 __ Ret(); | 4090 __ Ret(); |
| 4091 | 4091 |
| 4092 // Process the result from the native regexp code. | 4092 // Process the result from the native regexp code. |
| (...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5696 __ pop(r1); | 5696 __ pop(r1); |
| 5697 __ Jump(r2); | 5697 __ Jump(r2); |
| 5698 } | 5698 } |
| 5699 | 5699 |
| 5700 | 5700 |
| 5701 #undef __ | 5701 #undef __ |
| 5702 | 5702 |
| 5703 } } // namespace v8::internal | 5703 } } // namespace v8::internal |
| 5704 | 5704 |
| 5705 #endif // V8_TARGET_ARCH_ARM | 5705 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |