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 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 NearLabel failure; | 2119 NearLabel failure; |
2120 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::FAILURE)); | 2120 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::FAILURE)); |
2121 __ j(equal, &failure); | 2121 __ j(equal, &failure); |
2122 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::EXCEPTION)); | 2122 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::EXCEPTION)); |
2123 // If not exception it can only be retry. Handle that in the runtime system. | 2123 // If not exception it can only be retry. Handle that in the runtime system. |
2124 __ j(not_equal, &runtime); | 2124 __ j(not_equal, &runtime); |
2125 // Result must now be exception. If there is no pending exception already a | 2125 // Result must now be exception. If there is no pending exception already a |
2126 // stack overflow (on the backtrack stack) was detected in RegExp code but | 2126 // stack overflow (on the backtrack stack) was detected in RegExp code but |
2127 // haven't created the exception yet. Handle that in the runtime system. | 2127 // haven't created the exception yet. Handle that in the runtime system. |
2128 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 2128 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
2129 __ movq(kScratchRegister, ExternalReference::pending_exception_address()); | 2129 ExternalReference pending_exception_address(Top::k_pending_exception_address); |
| 2130 __ movq(kScratchRegister, pending_exception_address); |
2130 __ Cmp(kScratchRegister, Factory::the_hole_value()); | 2131 __ Cmp(kScratchRegister, Factory::the_hole_value()); |
2131 __ j(equal, &runtime); | 2132 __ j(equal, &runtime); |
2132 __ bind(&failure); | 2133 __ bind(&failure); |
2133 // For failure and exception return null. | 2134 // For failure and exception return null. |
2134 __ Move(rax, Factory::null_value()); | 2135 __ Move(rax, Factory::null_value()); |
2135 __ ret(4 * kPointerSize); | 2136 __ ret(4 * kPointerSize); |
2136 | 2137 |
2137 // Load RegExp data. | 2138 // Load RegExp data. |
2138 __ bind(&success); | 2139 __ bind(&success); |
2139 __ movq(rax, Operand(rsp, kJSRegExpOffset)); | 2140 __ movq(rax, Operand(rsp, kJSRegExpOffset)); |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2877 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); | 2878 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); |
2878 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 2879 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
2879 __ j(zero, &retry); | 2880 __ j(zero, &retry); |
2880 | 2881 |
2881 // Special handling of out of memory exceptions. | 2882 // Special handling of out of memory exceptions. |
2882 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE); | 2883 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE); |
2883 __ cmpq(rax, kScratchRegister); | 2884 __ cmpq(rax, kScratchRegister); |
2884 __ j(equal, throw_out_of_memory_exception); | 2885 __ j(equal, throw_out_of_memory_exception); |
2885 | 2886 |
2886 // Retrieve the pending exception and clear the variable. | 2887 // Retrieve the pending exception and clear the variable. |
2887 __ movq(kScratchRegister, ExternalReference::pending_exception_address()); | 2888 ExternalReference pending_exception_address(Top::k_pending_exception_address); |
| 2889 __ movq(kScratchRegister, pending_exception_address); |
2888 __ movq(rax, Operand(kScratchRegister, 0)); | 2890 __ movq(rax, Operand(kScratchRegister, 0)); |
2889 __ movq(rdx, ExternalReference::the_hole_value_location()); | 2891 __ movq(rdx, ExternalReference::the_hole_value_location()); |
2890 __ movq(rdx, Operand(rdx, 0)); | 2892 __ movq(rdx, Operand(rdx, 0)); |
2891 __ movq(Operand(kScratchRegister, 0), rdx); | 2893 __ movq(Operand(kScratchRegister, 0), rdx); |
2892 | 2894 |
2893 // Special handling of termination exceptions which are uncatchable | 2895 // Special handling of termination exceptions which are uncatchable |
2894 // by javascript code. | 2896 // by javascript code. |
2895 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); | 2897 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); |
2896 __ j(equal, throw_termination_exception); | 2898 __ j(equal, throw_termination_exception); |
2897 | 2899 |
(...skipping 29 matching lines...) Expand all Loading... |
2927 __ movq(kScratchRegister, handler_address); | 2929 __ movq(kScratchRegister, handler_address); |
2928 __ pop(Operand(kScratchRegister, 0)); | 2930 __ pop(Operand(kScratchRegister, 0)); |
2929 | 2931 |
2930 if (type == OUT_OF_MEMORY) { | 2932 if (type == OUT_OF_MEMORY) { |
2931 // Set external caught exception to false. | 2933 // Set external caught exception to false. |
2932 ExternalReference external_caught(Top::k_external_caught_exception_address); | 2934 ExternalReference external_caught(Top::k_external_caught_exception_address); |
2933 __ movq(rax, Immediate(false)); | 2935 __ movq(rax, Immediate(false)); |
2934 __ store_rax(external_caught); | 2936 __ store_rax(external_caught); |
2935 | 2937 |
2936 // Set pending exception and rax to out of memory exception. | 2938 // Set pending exception and rax to out of memory exception. |
| 2939 ExternalReference pending_exception(Top::k_pending_exception_address); |
2937 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); | 2940 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); |
2938 __ store_rax(ExternalReference::pending_exception_address()); | 2941 __ store_rax(pending_exception); |
2939 } | 2942 } |
2940 | 2943 |
2941 // Clear the context pointer. | 2944 // Clear the context pointer. |
2942 __ Set(rsi, 0); | 2945 __ Set(rsi, 0); |
2943 | 2946 |
2944 // Restore registers from handler. | 2947 // Restore registers from handler. |
2945 STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize == | 2948 STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize == |
2946 StackHandlerConstants::kFPOffset); | 2949 StackHandlerConstants::kFPOffset); |
2947 __ pop(rbp); // FP | 2950 __ pop(rbp); // FP |
2948 STATIC_ASSERT(StackHandlerConstants::kFPOffset + kPointerSize == | 2951 STATIC_ASSERT(StackHandlerConstants::kFPOffset + kPointerSize == |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3081 __ movq(rax, rbp); | 3084 __ movq(rax, rbp); |
3082 __ store_rax(js_entry_sp); | 3085 __ store_rax(js_entry_sp); |
3083 __ bind(¬_outermost_js); | 3086 __ bind(¬_outermost_js); |
3084 #endif | 3087 #endif |
3085 | 3088 |
3086 // Call a faked try-block that does the invoke. | 3089 // Call a faked try-block that does the invoke. |
3087 __ call(&invoke); | 3090 __ call(&invoke); |
3088 | 3091 |
3089 // Caught exception: Store result (exception) in the pending | 3092 // Caught exception: Store result (exception) in the pending |
3090 // exception field in the JSEnv and return a failure sentinel. | 3093 // exception field in the JSEnv and return a failure sentinel. |
3091 __ store_rax(ExternalReference::pending_exception_address()); | 3094 ExternalReference pending_exception(Top::k_pending_exception_address); |
| 3095 __ store_rax(pending_exception); |
3092 __ movq(rax, Failure::Exception(), RelocInfo::NONE); | 3096 __ movq(rax, Failure::Exception(), RelocInfo::NONE); |
3093 __ jmp(&exit); | 3097 __ jmp(&exit); |
3094 | 3098 |
3095 // Invoke: Link this frame into the handler chain. | 3099 // Invoke: Link this frame into the handler chain. |
3096 __ bind(&invoke); | 3100 __ bind(&invoke); |
3097 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 3101 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
3098 | 3102 |
3099 // Clear any pending exceptions. | 3103 // Clear any pending exceptions. |
3100 __ load_rax(ExternalReference::the_hole_value_location()); | 3104 __ load_rax(ExternalReference::the_hole_value_location()); |
3101 __ store_rax(ExternalReference::pending_exception_address()); | 3105 __ store_rax(pending_exception); |
3102 | 3106 |
3103 // Fake a receiver (NULL). | 3107 // Fake a receiver (NULL). |
3104 __ push(Immediate(0)); // receiver | 3108 __ push(Immediate(0)); // receiver |
3105 | 3109 |
3106 // Invoke the function by calling through JS entry trampoline | 3110 // Invoke the function by calling through JS entry trampoline |
3107 // builtin and pop the faked function when we return. We load the address | 3111 // builtin and pop the faked function when we return. We load the address |
3108 // from an external reference instead of inlining the call target address | 3112 // from an external reference instead of inlining the call target address |
3109 // directly in the code, because the builtin stubs may not have been | 3113 // directly in the code, because the builtin stubs may not have been |
3110 // generated yet at the time this code is generated. | 3114 // generated yet at the time this code is generated. |
3111 if (is_construct) { | 3115 if (is_construct) { |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4386 | 4390 |
4387 // Do a tail call to the rewritten stub. | 4391 // Do a tail call to the rewritten stub. |
4388 __ jmp(rdi); | 4392 __ jmp(rdi); |
4389 } | 4393 } |
4390 | 4394 |
4391 #undef __ | 4395 #undef __ |
4392 | 4396 |
4393 } } // namespace v8::internal | 4397 } } // namespace v8::internal |
4394 | 4398 |
4395 #endif // V8_TARGET_ARCH_X64 | 4399 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |