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

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

Issue 6015011: Use the macro assembler Set instead of explicit xor for clearing registers. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: 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/x64/builtins-x64.cc ('k') | src/x64/debug-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Get the function from the stack. 98 // Get the function from the stack.
99 __ movq(rcx, Operand(rsp, 1 * kPointerSize)); 99 __ movq(rcx, Operand(rsp, 1 * kPointerSize));
100 100
101 // Setup the object header. 101 // Setup the object header.
102 __ LoadRoot(kScratchRegister, Heap::kContextMapRootIndex); 102 __ LoadRoot(kScratchRegister, Heap::kContextMapRootIndex);
103 __ movq(FieldOperand(rax, HeapObject::kMapOffset), kScratchRegister); 103 __ movq(FieldOperand(rax, HeapObject::kMapOffset), kScratchRegister);
104 __ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length)); 104 __ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length));
105 105
106 // Setup the fixed slots. 106 // Setup the fixed slots.
107 __ xor_(rbx, rbx); // Set to NULL. 107 __ Set(rbx, 0); // Set to NULL.
108 __ movq(Operand(rax, Context::SlotOffset(Context::CLOSURE_INDEX)), rcx); 108 __ movq(Operand(rax, Context::SlotOffset(Context::CLOSURE_INDEX)), rcx);
109 __ movq(Operand(rax, Context::SlotOffset(Context::FCONTEXT_INDEX)), rax); 109 __ movq(Operand(rax, Context::SlotOffset(Context::FCONTEXT_INDEX)), rax);
110 __ movq(Operand(rax, Context::SlotOffset(Context::PREVIOUS_INDEX)), rbx); 110 __ movq(Operand(rax, Context::SlotOffset(Context::PREVIOUS_INDEX)), rbx);
111 __ movq(Operand(rax, Context::SlotOffset(Context::EXTENSION_INDEX)), rbx); 111 __ movq(Operand(rax, Context::SlotOffset(Context::EXTENSION_INDEX)), rbx);
112 112
113 // Copy the global object from the surrounding context. 113 // Copy the global object from the surrounding context.
114 __ movq(rbx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); 114 __ movq(rbx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
115 __ movq(Operand(rax, Context::SlotOffset(Context::GLOBAL_INDEX)), rbx); 115 __ movq(Operand(rax, Context::SlotOffset(Context::GLOBAL_INDEX)), rbx);
116 116
117 // Initialize the rest of the slots to undefined. 117 // Initialize the rest of the slots to undefined.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 __ xorpd(xmm0, xmm0); 243 __ xorpd(xmm0, xmm0);
244 __ ucomisd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset)); 244 __ ucomisd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset));
245 __ j(zero, &false_result); 245 __ j(zero, &false_result);
246 // Fall through to |true_result|. 246 // Fall through to |true_result|.
247 247
248 // Return 1/0 for true/false in rax. 248 // Return 1/0 for true/false in rax.
249 __ bind(&true_result); 249 __ bind(&true_result);
250 __ movq(rax, Immediate(1)); 250 __ movq(rax, Immediate(1));
251 __ ret(1 * kPointerSize); 251 __ ret(1 * kPointerSize);
252 __ bind(&false_result); 252 __ bind(&false_result);
253 __ xor_(rax, rax); 253 __ Set(rax, 0);
254 __ ret(1 * kPointerSize); 254 __ ret(1 * kPointerSize);
255 } 255 }
256 256
257 257
258 const char* GenericBinaryOpStub::GetName() { 258 const char* GenericBinaryOpStub::GetName() {
259 if (name_ != NULL) return name_; 259 if (name_ != NULL) return name_;
260 const int kMaxNameLength = 100; 260 const int kMaxNameLength = 100;
261 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); 261 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength);
262 if (name_ == NULL) return "OOM"; 262 if (name_ == NULL) return "OOM";
263 const char* op_name = Token::Name(op_); 263 const char* op_name = Token::Name(op_);
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2565 __ movq(kScratchRegister, handler_address); 2565 __ movq(kScratchRegister, handler_address);
2566 __ movq(rsp, Operand(kScratchRegister, 0)); 2566 __ movq(rsp, Operand(kScratchRegister, 0));
2567 // get next in chain 2567 // get next in chain
2568 __ pop(rcx); 2568 __ pop(rcx);
2569 __ movq(Operand(kScratchRegister, 0), rcx); 2569 __ movq(Operand(kScratchRegister, 0), rcx);
2570 __ pop(rbp); // pop frame pointer 2570 __ pop(rbp); // pop frame pointer
2571 __ pop(rdx); // remove state 2571 __ pop(rdx); // remove state
2572 2572
2573 // Before returning we restore the context from the frame pointer if not NULL. 2573 // Before returning we restore the context from the frame pointer if not NULL.
2574 // The frame pointer is NULL in the exception handler of a JS entry frame. 2574 // The frame pointer is NULL in the exception handler of a JS entry frame.
2575 __ xor_(rsi, rsi); // tentatively set context pointer to NULL 2575 __ Set(rsi, 0); // Tentatively set context pointer to NULL
2576 NearLabel skip; 2576 NearLabel skip;
2577 __ cmpq(rbp, Immediate(0)); 2577 __ cmpq(rbp, Immediate(0));
2578 __ j(equal, &skip); 2578 __ j(equal, &skip);
2579 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2579 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2580 __ bind(&skip); 2580 __ bind(&skip);
2581 __ ret(0); 2581 __ ret(0);
2582 } 2582 }
2583 2583
2584 2584
2585 void CEntryStub::GenerateCore(MacroAssembler* masm, 2585 void CEntryStub::GenerateCore(MacroAssembler* masm,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2749 __ movq(rax, Immediate(false)); 2749 __ movq(rax, Immediate(false));
2750 __ store_rax(external_caught); 2750 __ store_rax(external_caught);
2751 2751
2752 // Set pending exception and rax to out of memory exception. 2752 // Set pending exception and rax to out of memory exception.
2753 ExternalReference pending_exception(Top::k_pending_exception_address); 2753 ExternalReference pending_exception(Top::k_pending_exception_address);
2754 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); 2754 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE);
2755 __ store_rax(pending_exception); 2755 __ store_rax(pending_exception);
2756 } 2756 }
2757 2757
2758 // Clear the context pointer. 2758 // Clear the context pointer.
2759 __ xor_(rsi, rsi); 2759 __ Set(rsi, 0);
2760 2760
2761 // Restore registers from handler. 2761 // Restore registers from handler.
2762 STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize == 2762 STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize ==
2763 StackHandlerConstants::kFPOffset); 2763 StackHandlerConstants::kFPOffset);
2764 __ pop(rbp); // FP 2764 __ pop(rbp); // FP
2765 STATIC_ASSERT(StackHandlerConstants::kFPOffset + kPointerSize == 2765 STATIC_ASSERT(StackHandlerConstants::kFPOffset + kPointerSize ==
2766 StackHandlerConstants::kStateOffset); 2766 StackHandlerConstants::kStateOffset);
2767 __ pop(rdx); // State 2767 __ pop(rdx); // State
2768 2768
2769 STATIC_ASSERT(StackHandlerConstants::kStateOffset + kPointerSize == 2769 STATIC_ASSERT(StackHandlerConstants::kStateOffset + kPointerSize ==
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 4101
4102 void ICCompareStub::GenerateMiss(MacroAssembler* masm) { 4102 void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
4103 UNIMPLEMENTED(); 4103 UNIMPLEMENTED();
4104 } 4104 }
4105 4105
4106 #undef __ 4106 #undef __
4107 4107
4108 } } // namespace v8::internal 4108 } } // namespace v8::internal
4109 4109
4110 #endif // V8_TARGET_ARCH_X64 4110 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/debug-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698