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 11695006: Cleanup RelocInfo::NONE usage. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 12 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
OLDNEW
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 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 __ ucomisd(double_exponent, double_scratch); 2145 __ ucomisd(double_exponent, double_scratch);
2146 __ j(equal, &int_exponent); 2146 __ j(equal, &int_exponent);
2147 2147
2148 if (exponent_type_ == ON_STACK) { 2148 if (exponent_type_ == ON_STACK) {
2149 // Detect square root case. Crankshaft detects constant +/-0.5 at 2149 // Detect square root case. Crankshaft detects constant +/-0.5 at
2150 // compile time and uses DoMathPowHalf instead. We then skip this check 2150 // compile time and uses DoMathPowHalf instead. We then skip this check
2151 // for non-constant cases of +/-0.5 as these hardly occur. 2151 // for non-constant cases of +/-0.5 as these hardly occur.
2152 Label continue_sqrt, continue_rsqrt, not_plus_half; 2152 Label continue_sqrt, continue_rsqrt, not_plus_half;
2153 // Test for 0.5. 2153 // Test for 0.5.
2154 // Load double_scratch with 0.5. 2154 // Load double_scratch with 0.5.
2155 __ movq(scratch, V8_UINT64_C(0x3FE0000000000000), RelocInfo::NONE); 2155 __ movq(scratch, V8_UINT64_C(0x3FE0000000000000), RelocInfo::NONE64);
2156 __ movq(double_scratch, scratch); 2156 __ movq(double_scratch, scratch);
2157 // Already ruled out NaNs for exponent. 2157 // Already ruled out NaNs for exponent.
2158 __ ucomisd(double_scratch, double_exponent); 2158 __ ucomisd(double_scratch, double_exponent);
2159 __ j(not_equal, &not_plus_half, Label::kNear); 2159 __ j(not_equal, &not_plus_half, Label::kNear);
2160 2160
2161 // Calculates square root of base. Check for the special case of 2161 // Calculates square root of base. Check for the special case of
2162 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). 2162 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
2163 // According to IEEE-754, double-precision -Infinity has the highest 2163 // According to IEEE-754, double-precision -Infinity has the highest
2164 // 12 bits set and the lowest 52 bits cleared. 2164 // 12 bits set and the lowest 52 bits cleared.
2165 __ movq(scratch, V8_UINT64_C(0xFFF0000000000000), RelocInfo::NONE); 2165 __ movq(scratch, V8_UINT64_C(0xFFF0000000000000), RelocInfo::NONE64);
2166 __ movq(double_scratch, scratch); 2166 __ movq(double_scratch, scratch);
2167 __ ucomisd(double_scratch, double_base); 2167 __ ucomisd(double_scratch, double_base);
2168 // Comparing -Infinity with NaN results in "unordered", which sets the 2168 // Comparing -Infinity with NaN results in "unordered", which sets the
2169 // zero flag as if both were equal. However, it also sets the carry flag. 2169 // zero flag as if both were equal. However, it also sets the carry flag.
2170 __ j(not_equal, &continue_sqrt, Label::kNear); 2170 __ j(not_equal, &continue_sqrt, Label::kNear);
2171 __ j(carry, &continue_sqrt, Label::kNear); 2171 __ j(carry, &continue_sqrt, Label::kNear);
2172 2172
2173 // Set result to Infinity in the special case. 2173 // Set result to Infinity in the special case.
2174 __ xorps(double_result, double_result); 2174 __ xorps(double_result, double_result);
2175 __ subsd(double_result, double_scratch); 2175 __ subsd(double_result, double_scratch);
(...skipping 11 matching lines...) Expand all
2187 // Load double_scratch with -0.5 by substracting 1. 2187 // Load double_scratch with -0.5 by substracting 1.
2188 __ subsd(double_scratch, double_result); 2188 __ subsd(double_scratch, double_result);
2189 // Already ruled out NaNs for exponent. 2189 // Already ruled out NaNs for exponent.
2190 __ ucomisd(double_scratch, double_exponent); 2190 __ ucomisd(double_scratch, double_exponent);
2191 __ j(not_equal, &fast_power, Label::kNear); 2191 __ j(not_equal, &fast_power, Label::kNear);
2192 2192
2193 // Calculates reciprocal of square root of base. Check for the special 2193 // Calculates reciprocal of square root of base. Check for the special
2194 // case of Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). 2194 // case of Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
2195 // According to IEEE-754, double-precision -Infinity has the highest 2195 // According to IEEE-754, double-precision -Infinity has the highest
2196 // 12 bits set and the lowest 52 bits cleared. 2196 // 12 bits set and the lowest 52 bits cleared.
2197 __ movq(scratch, V8_UINT64_C(0xFFF0000000000000), RelocInfo::NONE); 2197 __ movq(scratch, V8_UINT64_C(0xFFF0000000000000), RelocInfo::NONE64);
2198 __ movq(double_scratch, scratch); 2198 __ movq(double_scratch, scratch);
2199 __ ucomisd(double_scratch, double_base); 2199 __ ucomisd(double_scratch, double_base);
2200 // Comparing -Infinity with NaN results in "unordered", which sets the 2200 // Comparing -Infinity with NaN results in "unordered", which sets the
2201 // zero flag as if both were equal. However, it also sets the carry flag. 2201 // zero flag as if both were equal. However, it also sets the carry flag.
2202 __ j(not_equal, &continue_rsqrt, Label::kNear); 2202 __ j(not_equal, &continue_rsqrt, Label::kNear);
2203 __ j(carry, &continue_rsqrt, Label::kNear); 2203 __ j(carry, &continue_rsqrt, Label::kNear);
2204 2204
2205 // Set result to 0 in the special case. 2205 // Set result to 0 in the special case.
2206 __ xorps(double_result, double_result); 2206 __ xorps(double_result, double_result);
2207 __ jmp(&done); 2207 __ jmp(&done);
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
4005 // Handling of failure. 4005 // Handling of failure.
4006 __ bind(&failure_returned); 4006 __ bind(&failure_returned);
4007 4007
4008 Label retry; 4008 Label retry;
4009 // If the returned exception is RETRY_AFTER_GC continue at retry label 4009 // If the returned exception is RETRY_AFTER_GC continue at retry label
4010 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); 4010 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0);
4011 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); 4011 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize));
4012 __ j(zero, &retry, Label::kNear); 4012 __ j(zero, &retry, Label::kNear);
4013 4013
4014 // Special handling of out of memory exceptions. 4014 // Special handling of out of memory exceptions.
4015 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE); 4015 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE64);
4016 __ cmpq(rax, kScratchRegister); 4016 __ cmpq(rax, kScratchRegister);
4017 __ j(equal, throw_out_of_memory_exception); 4017 __ j(equal, throw_out_of_memory_exception);
4018 4018
4019 // Retrieve the pending exception and clear the variable. 4019 // Retrieve the pending exception and clear the variable.
4020 ExternalReference pending_exception_address( 4020 ExternalReference pending_exception_address(
4021 Isolate::kPendingExceptionAddress, masm->isolate()); 4021 Isolate::kPendingExceptionAddress, masm->isolate());
4022 Operand pending_exception_operand = 4022 Operand pending_exception_operand =
4023 masm->ExternalOperand(pending_exception_address); 4023 masm->ExternalOperand(pending_exception_address);
4024 __ movq(rax, pending_exception_operand); 4024 __ movq(rax, pending_exception_operand);
4025 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); 4025 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
4085 // Do space-specific GC and retry runtime call. 4085 // Do space-specific GC and retry runtime call.
4086 GenerateCore(masm, 4086 GenerateCore(masm,
4087 &throw_normal_exception, 4087 &throw_normal_exception,
4088 &throw_termination_exception, 4088 &throw_termination_exception,
4089 &throw_out_of_memory_exception, 4089 &throw_out_of_memory_exception,
4090 true, 4090 true,
4091 false); 4091 false);
4092 4092
4093 // Do full GC and retry runtime call one final time. 4093 // Do full GC and retry runtime call one final time.
4094 Failure* failure = Failure::InternalError(); 4094 Failure* failure = Failure::InternalError();
4095 __ movq(rax, failure, RelocInfo::NONE); 4095 __ movq(rax, failure, RelocInfo::NONE64);
4096 GenerateCore(masm, 4096 GenerateCore(masm,
4097 &throw_normal_exception, 4097 &throw_normal_exception,
4098 &throw_termination_exception, 4098 &throw_termination_exception,
4099 &throw_out_of_memory_exception, 4099 &throw_out_of_memory_exception,
4100 true, 4100 true,
4101 true); 4101 true);
4102 4102
4103 __ bind(&throw_out_of_memory_exception); 4103 __ bind(&throw_out_of_memory_exception);
4104 // Set external caught exception to false. 4104 // Set external caught exception to false.
4105 Isolate* isolate = masm->isolate(); 4105 Isolate* isolate = masm->isolate();
4106 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, 4106 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress,
4107 isolate); 4107 isolate);
4108 __ Set(rax, static_cast<int64_t>(false)); 4108 __ Set(rax, static_cast<int64_t>(false));
4109 __ Store(external_caught, rax); 4109 __ Store(external_caught, rax);
4110 4110
4111 // Set pending exception and rax to out of memory exception. 4111 // Set pending exception and rax to out of memory exception.
4112 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, 4112 ExternalReference pending_exception(Isolate::kPendingExceptionAddress,
4113 isolate); 4113 isolate);
4114 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); 4114 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE64);
4115 __ Store(pending_exception, rax); 4115 __ Store(pending_exception, rax);
4116 // Fall through to the next label. 4116 // Fall through to the next label.
4117 4117
4118 __ bind(&throw_termination_exception); 4118 __ bind(&throw_termination_exception);
4119 __ ThrowUncatchable(rax); 4119 __ ThrowUncatchable(rax);
4120 4120
4121 __ bind(&throw_normal_exception); 4121 __ bind(&throw_normal_exception);
4122 __ Throw(rax); 4122 __ Throw(rax);
4123 } 4123 }
4124 4124
4125 4125
4126 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 4126 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
4127 Label invoke, handler_entry, exit; 4127 Label invoke, handler_entry, exit;
4128 Label not_outermost_js, not_outermost_js_2; 4128 Label not_outermost_js, not_outermost_js_2;
4129 { // NOLINT. Scope block confuses linter. 4129 { // NOLINT. Scope block confuses linter.
4130 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); 4130 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm);
4131 // Set up frame. 4131 // Set up frame.
4132 __ push(rbp); 4132 __ push(rbp);
4133 __ movq(rbp, rsp); 4133 __ movq(rbp, rsp);
4134 4134
4135 // Push the stack frame type marker twice. 4135 // Push the stack frame type marker twice.
4136 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; 4136 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
4137 // Scratch register is neither callee-save, nor an argument register on any 4137 // Scratch register is neither callee-save, nor an argument register on any
4138 // platform. It's free to use at this point. 4138 // platform. It's free to use at this point.
4139 // Cannot use smi-register for loading yet. 4139 // Cannot use smi-register for loading yet.
4140 __ movq(kScratchRegister, 4140 __ movq(kScratchRegister,
4141 reinterpret_cast<uint64_t>(Smi::FromInt(marker)), 4141 reinterpret_cast<uint64_t>(Smi::FromInt(marker)),
4142 RelocInfo::NONE); 4142 RelocInfo::NONE64);
4143 __ push(kScratchRegister); // context slot 4143 __ push(kScratchRegister); // context slot
4144 __ push(kScratchRegister); // function slot 4144 __ push(kScratchRegister); // function slot
4145 // Save callee-saved registers (X64/Win64 calling conventions). 4145 // Save callee-saved registers (X64/Win64 calling conventions).
4146 __ push(r12); 4146 __ push(r12);
4147 __ push(r13); 4147 __ push(r13);
4148 __ push(r14); 4148 __ push(r14);
4149 __ push(r15); 4149 __ push(r15);
4150 #ifdef _WIN64 4150 #ifdef _WIN64
4151 __ push(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI. 4151 __ push(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI.
4152 __ push(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI. 4152 __ push(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4187 // Jump to a faked try block that does the invoke, with a faked catch 4187 // Jump to a faked try block that does the invoke, with a faked catch
4188 // block that sets the pending exception. 4188 // block that sets the pending exception.
4189 __ jmp(&invoke); 4189 __ jmp(&invoke);
4190 __ bind(&handler_entry); 4190 __ bind(&handler_entry);
4191 handler_offset_ = handler_entry.pos(); 4191 handler_offset_ = handler_entry.pos();
4192 // Caught exception: Store result (exception) in the pending exception 4192 // Caught exception: Store result (exception) in the pending exception
4193 // field in the JSEnv and return a failure sentinel. 4193 // field in the JSEnv and return a failure sentinel.
4194 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, 4194 ExternalReference pending_exception(Isolate::kPendingExceptionAddress,
4195 isolate); 4195 isolate);
4196 __ Store(pending_exception, rax); 4196 __ Store(pending_exception, rax);
4197 __ movq(rax, Failure::Exception(), RelocInfo::NONE); 4197 __ movq(rax, Failure::Exception(), RelocInfo::NONE64);
4198 __ jmp(&exit); 4198 __ jmp(&exit);
4199 4199
4200 // Invoke: Link this frame into the handler chain. There's only one 4200 // Invoke: Link this frame into the handler chain. There's only one
4201 // handler block in this code object, so its index is 0. 4201 // handler block in this code object, so its index is 0.
4202 __ bind(&invoke); 4202 __ bind(&invoke);
4203 __ PushTryHandler(StackHandler::JS_ENTRY, 0); 4203 __ PushTryHandler(StackHandler::JS_ENTRY, 0);
4204 4204
4205 // Clear any pending exceptions. 4205 // Clear any pending exceptions.
4206 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex); 4206 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex);
4207 __ Store(pending_exception, rax); 4207 __ Store(pending_exception, rax);
(...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after
6458 // Calculate the function address to the first arg. 6458 // Calculate the function address to the first arg.
6459 #ifdef _WIN64 6459 #ifdef _WIN64
6460 __ movq(rcx, Operand(rdx, 0)); 6460 __ movq(rcx, Operand(rdx, 0));
6461 __ subq(rcx, Immediate(Assembler::kShortCallInstructionLength)); 6461 __ subq(rcx, Immediate(Assembler::kShortCallInstructionLength));
6462 #else 6462 #else
6463 __ movq(rdi, Operand(rsi, 0)); 6463 __ movq(rdi, Operand(rsi, 0));
6464 __ subq(rdi, Immediate(Assembler::kShortCallInstructionLength)); 6464 __ subq(rdi, Immediate(Assembler::kShortCallInstructionLength));
6465 #endif 6465 #endif
6466 6466
6467 // Call the entry hook function. 6467 // Call the entry hook function.
6468 __ movq(rax, &entry_hook_, RelocInfo::NONE); 6468 __ movq(rax, &entry_hook_, RelocInfo::NONE64);
6469 __ movq(rax, Operand(rax, 0)); 6469 __ movq(rax, Operand(rax, 0));
6470 6470
6471 AllowExternalCallThatCantCauseGC scope(masm); 6471 AllowExternalCallThatCantCauseGC scope(masm);
6472 6472
6473 const int kArgumentCount = 2; 6473 const int kArgumentCount = 2;
6474 __ PrepareCallCFunction(kArgumentCount); 6474 __ PrepareCallCFunction(kArgumentCount);
6475 __ CallCFunction(rax, kArgumentCount); 6475 __ CallCFunction(rax, kArgumentCount);
6476 6476
6477 // Restore volatile regs. 6477 // Restore volatile regs.
6478 #ifdef _WIN64 6478 #ifdef _WIN64
6479 __ pop(rcx); 6479 __ pop(rcx);
6480 #else 6480 #else
6481 __ pop(rsi); 6481 __ pop(rsi);
6482 __ pop(rdi); 6482 __ pop(rdi);
6483 __ pop(rcx); 6483 __ pop(rcx);
6484 #endif 6484 #endif
6485 6485
6486 __ Ret(); 6486 __ Ret();
6487 } 6487 }
6488 6488
6489 #undef __ 6489 #undef __
6490 6490
6491 } } // namespace v8::internal 6491 } } // namespace v8::internal
6492 6492
6493 #endif // V8_TARGET_ARCH_X64 6493 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698