Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 6335016: Unification: introduce ExternalReference::pending_exception_address(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing Mads' concerns Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/top.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ExternalReference pending_exception_address(Top::k_pending_exception_address); 2129 __ movq(kScratchRegister, ExternalReference::pending_exception_address());
2130 __ movq(kScratchRegister, pending_exception_address);
2131 __ Cmp(kScratchRegister, Factory::the_hole_value()); 2130 __ Cmp(kScratchRegister, Factory::the_hole_value());
2132 __ j(equal, &runtime); 2131 __ j(equal, &runtime);
2133 __ bind(&failure); 2132 __ bind(&failure);
2134 // For failure and exception return null. 2133 // For failure and exception return null.
2135 __ Move(rax, Factory::null_value()); 2134 __ Move(rax, Factory::null_value());
2136 __ ret(4 * kPointerSize); 2135 __ ret(4 * kPointerSize);
2137 2136
2138 // Load RegExp data. 2137 // Load RegExp data.
2139 __ bind(&success); 2138 __ bind(&success);
2140 __ movq(rax, Operand(rsp, kJSRegExpOffset)); 2139 __ movq(rax, Operand(rsp, kJSRegExpOffset));
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); 2877 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0);
2879 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); 2878 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize));
2880 __ j(zero, &retry); 2879 __ j(zero, &retry);
2881 2880
2882 // Special handling of out of memory exceptions. 2881 // Special handling of out of memory exceptions.
2883 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE); 2882 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE);
2884 __ cmpq(rax, kScratchRegister); 2883 __ cmpq(rax, kScratchRegister);
2885 __ j(equal, throw_out_of_memory_exception); 2884 __ j(equal, throw_out_of_memory_exception);
2886 2885
2887 // Retrieve the pending exception and clear the variable. 2886 // Retrieve the pending exception and clear the variable.
2888 ExternalReference pending_exception_address(Top::k_pending_exception_address); 2887 __ movq(kScratchRegister, ExternalReference::pending_exception_address());
2889 __ movq(kScratchRegister, pending_exception_address);
2890 __ movq(rax, Operand(kScratchRegister, 0)); 2888 __ movq(rax, Operand(kScratchRegister, 0));
2891 __ movq(rdx, ExternalReference::the_hole_value_location()); 2889 __ movq(rdx, ExternalReference::the_hole_value_location());
2892 __ movq(rdx, Operand(rdx, 0)); 2890 __ movq(rdx, Operand(rdx, 0));
2893 __ movq(Operand(kScratchRegister, 0), rdx); 2891 __ movq(Operand(kScratchRegister, 0), rdx);
2894 2892
2895 // Special handling of termination exceptions which are uncatchable 2893 // Special handling of termination exceptions which are uncatchable
2896 // by javascript code. 2894 // by javascript code.
2897 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); 2895 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex);
2898 __ j(equal, throw_termination_exception); 2896 __ j(equal, throw_termination_exception);
2899 2897
(...skipping 29 matching lines...) Expand all
2929 __ movq(kScratchRegister, handler_address); 2927 __ movq(kScratchRegister, handler_address);
2930 __ pop(Operand(kScratchRegister, 0)); 2928 __ pop(Operand(kScratchRegister, 0));
2931 2929
2932 if (type == OUT_OF_MEMORY) { 2930 if (type == OUT_OF_MEMORY) {
2933 // Set external caught exception to false. 2931 // Set external caught exception to false.
2934 ExternalReference external_caught(Top::k_external_caught_exception_address); 2932 ExternalReference external_caught(Top::k_external_caught_exception_address);
2935 __ movq(rax, Immediate(false)); 2933 __ movq(rax, Immediate(false));
2936 __ store_rax(external_caught); 2934 __ store_rax(external_caught);
2937 2935
2938 // Set pending exception and rax to out of memory exception. 2936 // Set pending exception and rax to out of memory exception.
2939 ExternalReference pending_exception(Top::k_pending_exception_address);
2940 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); 2937 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE);
2941 __ store_rax(pending_exception); 2938 __ store_rax(ExternalReference::pending_exception_address());
2942 } 2939 }
2943 2940
2944 // Clear the context pointer. 2941 // Clear the context pointer.
2945 __ Set(rsi, 0); 2942 __ Set(rsi, 0);
2946 2943
2947 // Restore registers from handler. 2944 // Restore registers from handler.
2948 STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize == 2945 STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize ==
2949 StackHandlerConstants::kFPOffset); 2946 StackHandlerConstants::kFPOffset);
2950 __ pop(rbp); // FP 2947 __ pop(rbp); // FP
2951 STATIC_ASSERT(StackHandlerConstants::kFPOffset + kPointerSize == 2948 STATIC_ASSERT(StackHandlerConstants::kFPOffset + kPointerSize ==
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3084 __ movq(rax, rbp); 3081 __ movq(rax, rbp);
3085 __ store_rax(js_entry_sp); 3082 __ store_rax(js_entry_sp);
3086 __ bind(&not_outermost_js); 3083 __ bind(&not_outermost_js);
3087 #endif 3084 #endif
3088 3085
3089 // Call a faked try-block that does the invoke. 3086 // Call a faked try-block that does the invoke.
3090 __ call(&invoke); 3087 __ call(&invoke);
3091 3088
3092 // Caught exception: Store result (exception) in the pending 3089 // Caught exception: Store result (exception) in the pending
3093 // exception field in the JSEnv and return a failure sentinel. 3090 // exception field in the JSEnv and return a failure sentinel.
3094 ExternalReference pending_exception(Top::k_pending_exception_address); 3091 __ store_rax(ExternalReference::pending_exception_address());
3095 __ store_rax(pending_exception);
3096 __ movq(rax, Failure::Exception(), RelocInfo::NONE); 3092 __ movq(rax, Failure::Exception(), RelocInfo::NONE);
3097 __ jmp(&exit); 3093 __ jmp(&exit);
3098 3094
3099 // Invoke: Link this frame into the handler chain. 3095 // Invoke: Link this frame into the handler chain.
3100 __ bind(&invoke); 3096 __ bind(&invoke);
3101 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); 3097 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER);
3102 3098
3103 // Clear any pending exceptions. 3099 // Clear any pending exceptions.
3104 __ load_rax(ExternalReference::the_hole_value_location()); 3100 __ load_rax(ExternalReference::the_hole_value_location());
3105 __ store_rax(pending_exception); 3101 __ store_rax(ExternalReference::pending_exception_address());
3106 3102
3107 // Fake a receiver (NULL). 3103 // Fake a receiver (NULL).
3108 __ push(Immediate(0)); // receiver 3104 __ push(Immediate(0)); // receiver
3109 3105
3110 // Invoke the function by calling through JS entry trampoline 3106 // Invoke the function by calling through JS entry trampoline
3111 // builtin and pop the faked function when we return. We load the address 3107 // builtin and pop the faked function when we return. We load the address
3112 // from an external reference instead of inlining the call target address 3108 // from an external reference instead of inlining the call target address
3113 // directly in the code, because the builtin stubs may not have been 3109 // directly in the code, because the builtin stubs may not have been
3114 // generated yet at the time this code is generated. 3110 // generated yet at the time this code is generated.
3115 if (is_construct) { 3111 if (is_construct) {
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
4390 4386
4391 // Do a tail call to the rewritten stub. 4387 // Do a tail call to the rewritten stub.
4392 __ jmp(rdi); 4388 __ jmp(rdi);
4393 } 4389 }
4394 4390
4395 #undef __ 4391 #undef __
4396 4392
4397 } } // namespace v8::internal 4393 } } // namespace v8::internal
4398 4394
4399 #endif // V8_TARGET_ARCH_X64 4395 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/top.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698