Reviewers: Lasse Reichstein,
Description:
Use the macro assembler Set instead of explicit xor for clearing registers.
Please review this at http://codereview.chromium.org/6015011/
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M src/ia32/builtins-ia32.cc
M src/ia32/code-stubs-ia32.cc
M src/ia32/debug-ia32.cc
M src/ia32/ic-ia32.cc
M src/ia32/regexp-macro-assembler-ia32.cc
M src/x64/assembler-x64.cc
M src/x64/builtins-x64.cc
M src/x64/code-stubs-x64.cc
M src/x64/debug-x64.cc
M src/x64/full-codegen-x64.cc
M src/x64/macro-assembler-x64.h
M src/x64/macro-assembler-x64.cc
M src/x64/regexp-macro-assembler-x64.cc
Index: src/ia32/builtins-ia32.cc
===================================================================
--- src/ia32/builtins-ia32.cc (revision 6129)
+++ src/ia32/builtins-ia32.cc (working copy)
@@ -399,7 +399,7 @@
static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
bool is_construct) {
// Clear the context before we push it when entering the JS frame.
- __ xor_(esi, Operand(esi)); // clear esi
+ __ Set(esi, Immediate(0));
// Enter an internal frame.
__ EnterInternalFrame();
@@ -421,7 +421,7 @@
// Copy arguments to the stack in a loop.
Label loop, entry;
- __ xor_(ecx, Operand(ecx)); // clear ecx
+ __ Set(ecx, Immediate(0));
__ jmp(&entry);
__ bind(&loop);
__ mov(edx, Operand(ebx, ecx, times_4, 0)); // push parameter from argv
@@ -644,7 +644,7 @@
__ bind(&non_function);
__ mov(Operand(esp, eax, times_4, 0), edi);
// Clear edi to indicate a non-function being called.
- __ xor_(edi, Operand(edi));
+ __ Set(edi, Immediate(0));
// 4. Shift arguments and return address one slot down on the stack
// (overwriting the original receiver). Adjust argument count to make
@@ -665,7 +665,7 @@
{ Label function;
__ test(edi, Operand(edi));
__ j(not_zero, &function, taken);
- __ xor_(ebx, Operand(ebx));
+ __ Set(ebx, Immediate(0));
__ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
__ jmp(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
RelocInfo::CODE_TARGET);
Index: src/ia32/code-stubs-ia32.cc
===================================================================
--- src/ia32/code-stubs-ia32.cc (revision 6129)
+++ src/ia32/code-stubs-ia32.cc (working copy)
@@ -104,7 +104,7 @@
Immediate(Smi::FromInt(length)));
// Setup the fixed slots.
- __ xor_(ebx, Operand(ebx)); // Set to NULL.
+ __ Set(ebx, Immediate(0)); // Set to NULL.
__ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx);
__ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax);
__ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx);
@@ -4303,7 +4303,7 @@
// that contains the exponent and high bit of the mantissa.
STATIC_ASSERT(((kQuietNaNHighBitsMask << 1) & 0x80000000u) != 0);
__ mov(edx, FieldOperand(edx, HeapNumber::kExponentOffset));
- __ xor_(eax, Operand(eax));
+ __ Set(eax, Immediate(0));
// Shift value and mask so kQuietNaNHighBitsMask applies to topmost
// bits.
__ add(edx, Operand(edx));
@@ -4433,7 +4433,7 @@
__ j(below, &below_label, not_taken);
__ j(above, &above_label, not_taken);
- __ xor_(eax, Operand(eax));
+ __ Set(eax, Immediate(0));
__ ret(0);
__ bind(&below_label);
@@ -4646,7 +4646,7 @@
// Before returning we restore the context from the frame pointer if
// not NULL. The frame pointer is NULL in the exception handler of
// a JS entry frame.
- __ xor_(esi, Operand(esi)); // Tentatively set context pointer to NULL.
+ __ Set(esi, Immediate(0)); // Tentatively set context pointer to NULL.
NearLabel skip;
__ cmp(ebp, 0);
__ j(equal, &skip, not_taken);
@@ -4799,7 +4799,7 @@
}
// Clear the context pointer.
- __ xor_(esi, Operand(esi));
+ __ Set(esi, Immediate(0));
// Restore fp from handler and discard handler state.
STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
Index: src/ia32/debug-ia32.cc
===================================================================
--- src/ia32/debug-ia32.cc (revision 6129)
+++ src/ia32/debug-ia32.cc (working copy)
@@ -125,7 +125,7 @@
#ifdef DEBUG
__ RecordComment("// Calling from debug break to runtime - come in -
over");
#endif
- __ Set(eax, Immediate(0)); // no arguments
+ __ Set(eax, Immediate(0)); // No arguments.
__ mov(ebx, Immediate(ExternalReference::debug_break()));
CEntryStub ceb(1);
Index: src/ia32/ic-ia32.cc
===================================================================
--- src/ia32/ic-ia32.cc (revision 6129)
+++ src/ia32/ic-ia32.cc (working copy)
@@ -1199,7 +1199,7 @@
break;
case kExternalShortArray:
case kExternalUnsignedShortArray:
- __ xor_(ecx, Operand(ecx));
+ __ Set(ecx, Immediate(0));
__ mov_w(Operand(edi, ebx, times_2, 0), ecx);
break;
case kExternalIntArray:
Index: src/ia32/regexp-macro-assembler-ia32.cc
===================================================================
--- src/ia32/regexp-macro-assembler-ia32.cc (revision 6129)
+++ src/ia32/regexp-macro-assembler-ia32.cc (working copy)
@@ -652,7 +652,7 @@
void RegExpMacroAssemblerIA32::Fail() {
ASSERT(FAILURE == 0); // Return value for failure is zero.
- __ xor_(eax, Operand(eax)); // zero eax.
+ __ Set(eax, Immediate(0));
__ jmp(&exit_label_);
}
Index: src/x64/assembler-x64.cc
===================================================================
--- src/x64/assembler-x64.cc (revision 6129)
+++ src/x64/assembler-x64.cc (working copy)
@@ -74,7 +74,7 @@
__ xor_(rax, rdx); // Different if CPUID is supported.
__ j(not_zero, &cpuid);
- // CPUID not supported. Clear the supported features in edx:eax.
+ // CPUID not supported. Clear the supported features in rax.
__ xor_(rax, rax);
__ jmp(&done);
Index: src/x64/builtins-x64.cc
===================================================================
--- src/x64/builtins-x64.cc (revision 6129)
+++ src/x64/builtins-x64.cc (working copy)
@@ -422,7 +422,7 @@
// [rsp+0x20] : argv
// Clear the context before we push it when entering the JS frame.
- __ xor_(rsi, rsi);
+ __ Set(rsi, 0);
__ EnterInternalFrame();
// Load the function context into rsi.
@@ -451,7 +451,7 @@
// rdi : function
// Clear the context before we push it when entering the JS frame.
- __ xor_(rsi, rsi);
+ __ Set(rsi, 0);
// Enter an internal frame.
__ EnterInternalFrame();
@@ -479,7 +479,7 @@
// Register rbx points to array of pointers to handle locations.
// Push the values of these handles.
Label loop, entry;
- __ xor_(rcx, rcx); // Set loop variable to 0.
+ __ Set(rcx, 0); // Set loop variable to 0.
__ jmp(&entry);
__ bind(&loop);
__ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0));
@@ -668,7 +668,7 @@
// become the receiver.
__ bind(&non_function);
__ movq(Operand(rsp, rax, times_pointer_size, 0), rdi);
- __ xor_(rdi, rdi);
+ __ Set(rdi, 0);
// 4. Shift arguments and return address one slot down on the stack
// (overwriting the original receiver). Adjust argument count to make
@@ -689,7 +689,7 @@
{ Label function;
__ testq(rdi, rdi);
__ j(not_zero, &function);
- __ xor_(rbx, rbx);
+ __ Set(rbx, 0);
__ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION);
__ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
RelocInfo::CODE_TARGET);
Index: src/x64/code-stubs-x64.cc
===================================================================
--- src/x64/code-stubs-x64.cc (revision 6129)
+++ src/x64/code-stubs-x64.cc (working copy)
@@ -104,7 +104,7 @@
__ Move(FieldOperand(rax, FixedArray::kLengthOffset),
Smi::FromInt(length));
// Setup the fixed slots.
- __ xor_(rbx, rbx); // Set to NULL.
+ __ Set(rbx, 0); // Set to NULL.
__ movq(Operand(rax, Context::SlotOffset(Context::CLOSURE_INDEX)), rcx);
__ movq(Operand(rax, Context::SlotOffset(Context::FCONTEXT_INDEX)), rax);
__ movq(Operand(rax, Context::SlotOffset(Context::PREVIOUS_INDEX)), rbx);
@@ -250,7 +250,7 @@
__ movq(rax, Immediate(1));
__ ret(1 * kPointerSize);
__ bind(&false_result);
- __ xor_(rax, rax);
+ __ Set(rax, 0);
__ ret(1 * kPointerSize);
}
@@ -2572,7 +2572,7 @@
// Before returning we restore the context from the frame pointer if not
NULL.
// The frame pointer is NULL in the exception handler of a JS entry
frame.
- __ xor_(rsi, rsi); // tentatively set context pointer to NULL
+ __ Set(rsi, 0); // Tentatively set context pointer to NULL
NearLabel skip;
__ cmpq(rbp, Immediate(0));
__ j(equal, &skip);
@@ -2756,7 +2756,7 @@
}
// Clear the context pointer.
- __ xor_(rsi, rsi);
+ __ Set(rsi, 0);
// Restore registers from handler.
STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize ==
Index: src/x64/debug-x64.cc
===================================================================
--- src/x64/debug-x64.cc (revision 6129)
+++ src/x64/debug-x64.cc (working copy)
@@ -80,7 +80,7 @@
#ifdef DEBUG
__ RecordComment("// Calling from debug break to runtime - come in -
over");
#endif
- __ xor_(rax, rax); // No arguments (argc == 0).
+ __ Set(rax, 0); // No arguments (argc == 0).
__ movq(rbx, ExternalReference::debug_break());
CEntryStub ceb(1);
Index: src/x64/full-codegen-x64.cc
===================================================================
--- src/x64/full-codegen-x64.cc (revision 6129)
+++ src/x64/full-codegen-x64.cc (working copy)
@@ -199,7 +199,7 @@
void FullCodeGenerator::ClearAccumulator() {
- __ xor_(rax, rax);
+ __ Set(rax, 0);
}
Index: src/x64/macro-assembler-x64.cc
===================================================================
--- src/x64/macro-assembler-x64.cc (revision 6129)
+++ src/x64/macro-assembler-x64.cc (working copy)
@@ -1110,7 +1110,7 @@
void MacroAssembler::SmiAndConstant(Register dst, Register src, Smi*
constant) {
if (constant->value() == 0) {
- xor_(dst, dst);
+ Set(dst, 0);
} else if (dst.is(src)) {
ASSERT(!dst.is(kScratchRegister));
Register constant_reg = GetSmiConstant(constant);
@@ -1605,7 +1605,7 @@
#ifdef ENABLE_DEBUGGER_SUPPORT
void MacroAssembler::DebugBreak() {
ASSERT(allow_stub_calls());
- xor_(rax, rax); // no arguments
+ Set(rax, 0); // No arguments.
movq(rbx, ExternalReference(Runtime::kDebugBreak));
CEntryStub ces(1);
Call(ces.GetCode(), RelocInfo::DEBUG_BREAK);
Index: src/x64/macro-assembler-x64.h
===================================================================
--- src/x64/macro-assembler-x64.h (revision 6129)
+++ src/x64/macro-assembler-x64.h (working copy)
@@ -1176,7 +1176,7 @@
jmp(on_not_smi_result);
bind(&zero_correct_result);
- xor_(dst, dst);
+ Set(dst, 0);
bind(&correct_result);
} else {
Index: src/x64/regexp-macro-assembler-x64.cc
===================================================================
--- src/x64/regexp-macro-assembler-x64.cc (revision 6129)
+++ src/x64/regexp-macro-assembler-x64.cc (working copy)
@@ -688,7 +688,7 @@
void RegExpMacroAssemblerX64::Fail() {
ASSERT(FAILURE == 0); // Return value for failure is zero.
- __ xor_(rax, rax); // zero rax.
+ __ Set(rax, 0);
__ jmp(&exit_label_);
}
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev