Commit 04bf6c5c authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Use the macro assembler Set instead of explicit xor for clearing registers.

Review URL: http://codereview.chromium.org/6015011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6135 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent cdf948c3
...@@ -399,7 +399,7 @@ void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { ...@@ -399,7 +399,7 @@ void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
bool is_construct) { bool is_construct) {
// Clear the context before we push it when entering the JS frame. // 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. // Enter an internal frame.
__ EnterInternalFrame(); __ EnterInternalFrame();
...@@ -421,7 +421,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, ...@@ -421,7 +421,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
// Copy arguments to the stack in a loop. // Copy arguments to the stack in a loop.
Label loop, entry; Label loop, entry;
__ xor_(ecx, Operand(ecx)); // clear ecx __ Set(ecx, Immediate(0));
__ jmp(&entry); __ jmp(&entry);
__ bind(&loop); __ bind(&loop);
__ mov(edx, Operand(ebx, ecx, times_4, 0)); // push parameter from argv __ mov(edx, Operand(ebx, ecx, times_4, 0)); // push parameter from argv
...@@ -644,7 +644,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { ...@@ -644,7 +644,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
__ bind(&non_function); __ bind(&non_function);
__ mov(Operand(esp, eax, times_4, 0), edi); __ mov(Operand(esp, eax, times_4, 0), edi);
// Clear edi to indicate a non-function being called. // 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 // 4. Shift arguments and return address one slot down on the stack
// (overwriting the original receiver). Adjust argument count to make // (overwriting the original receiver). Adjust argument count to make
...@@ -665,7 +665,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { ...@@ -665,7 +665,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
{ Label function; { Label function;
__ test(edi, Operand(edi)); __ test(edi, Operand(edi));
__ j(not_zero, &function, taken); __ j(not_zero, &function, taken);
__ xor_(ebx, Operand(ebx)); __ Set(ebx, Immediate(0));
__ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
__ jmp(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), __ jmp(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
......
...@@ -104,7 +104,7 @@ void FastNewContextStub::Generate(MacroAssembler* masm) { ...@@ -104,7 +104,7 @@ void FastNewContextStub::Generate(MacroAssembler* masm) {
Immediate(Smi::FromInt(length))); Immediate(Smi::FromInt(length)));
// Setup the fixed slots. // 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::CLOSURE_INDEX)), ecx);
__ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax); __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax);
__ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx); __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx);
...@@ -4303,7 +4303,7 @@ void CompareStub::Generate(MacroAssembler* masm) { ...@@ -4303,7 +4303,7 @@ void CompareStub::Generate(MacroAssembler* masm) {
// that contains the exponent and high bit of the mantissa. // that contains the exponent and high bit of the mantissa.
STATIC_ASSERT(((kQuietNaNHighBitsMask << 1) & 0x80000000u) != 0); STATIC_ASSERT(((kQuietNaNHighBitsMask << 1) & 0x80000000u) != 0);
__ mov(edx, FieldOperand(edx, HeapNumber::kExponentOffset)); __ mov(edx, FieldOperand(edx, HeapNumber::kExponentOffset));
__ xor_(eax, Operand(eax)); __ Set(eax, Immediate(0));
// Shift value and mask so kQuietNaNHighBitsMask applies to topmost // Shift value and mask so kQuietNaNHighBitsMask applies to topmost
// bits. // bits.
__ add(edx, Operand(edx)); __ add(edx, Operand(edx));
...@@ -4433,7 +4433,7 @@ void CompareStub::Generate(MacroAssembler* masm) { ...@@ -4433,7 +4433,7 @@ void CompareStub::Generate(MacroAssembler* masm) {
__ j(below, &below_label, not_taken); __ j(below, &below_label, not_taken);
__ j(above, &above_label, not_taken); __ j(above, &above_label, not_taken);
__ xor_(eax, Operand(eax)); __ Set(eax, Immediate(0));
__ ret(0); __ ret(0);
__ bind(&below_label); __ bind(&below_label);
...@@ -4646,7 +4646,7 @@ void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { ...@@ -4646,7 +4646,7 @@ void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
// Before returning we restore the context from the frame pointer if // Before returning we restore the context from the frame pointer if
// not NULL. The frame pointer is NULL in the exception handler of // not NULL. The frame pointer is NULL in the exception handler of
// a JS entry frame. // 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; NearLabel skip;
__ cmp(ebp, 0); __ cmp(ebp, 0);
__ j(equal, &skip, not_taken); __ j(equal, &skip, not_taken);
...@@ -4799,7 +4799,7 @@ void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm, ...@@ -4799,7 +4799,7 @@ void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm,
} }
// Clear the context pointer. // Clear the context pointer.
__ xor_(esi, Operand(esi)); __ Set(esi, Immediate(0));
// Restore fp from handler and discard handler state. // Restore fp from handler and discard handler state.
STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
......
...@@ -125,7 +125,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm, ...@@ -125,7 +125,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
#ifdef DEBUG #ifdef DEBUG
__ RecordComment("// Calling from debug break to runtime - come in - over"); __ RecordComment("// Calling from debug break to runtime - come in - over");
#endif #endif
__ Set(eax, Immediate(0)); // no arguments __ Set(eax, Immediate(0)); // No arguments.
__ mov(ebx, Immediate(ExternalReference::debug_break())); __ mov(ebx, Immediate(ExternalReference::debug_break()));
CEntryStub ceb(1); CEntryStub ceb(1);
......
...@@ -1199,7 +1199,7 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, ...@@ -1199,7 +1199,7 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm,
break; break;
case kExternalShortArray: case kExternalShortArray:
case kExternalUnsignedShortArray: case kExternalUnsignedShortArray:
__ xor_(ecx, Operand(ecx)); __ Set(ecx, Immediate(0));
__ mov_w(Operand(edi, ebx, times_2, 0), ecx); __ mov_w(Operand(edi, ebx, times_2, 0), ecx);
break; break;
case kExternalIntArray: case kExternalIntArray:
......
...@@ -652,7 +652,7 @@ bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type, ...@@ -652,7 +652,7 @@ bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type,
void RegExpMacroAssemblerIA32::Fail() { void RegExpMacroAssemblerIA32::Fail() {
ASSERT(FAILURE == 0); // Return value for failure is zero. ASSERT(FAILURE == 0); // Return value for failure is zero.
__ xor_(eax, Operand(eax)); // zero eax. __ Set(eax, Immediate(0));
__ jmp(&exit_label_); __ jmp(&exit_label_);
} }
......
...@@ -74,7 +74,7 @@ void CpuFeatures::Probe(bool portable) { ...@@ -74,7 +74,7 @@ void CpuFeatures::Probe(bool portable) {
__ xor_(rax, rdx); // Different if CPUID is supported. __ xor_(rax, rdx); // Different if CPUID is supported.
__ j(not_zero, &cpuid); __ 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); __ xor_(rax, rax);
__ jmp(&done); __ jmp(&done);
......
...@@ -422,7 +422,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, ...@@ -422,7 +422,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
// [rsp+0x20] : argv // [rsp+0x20] : argv
// Clear the context before we push it when entering the JS frame. // Clear the context before we push it when entering the JS frame.
__ xor_(rsi, rsi); __ Set(rsi, 0);
__ EnterInternalFrame(); __ EnterInternalFrame();
// Load the function context into rsi. // Load the function context into rsi.
...@@ -451,7 +451,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, ...@@ -451,7 +451,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
// rdi : function // rdi : function
// Clear the context before we push it when entering the JS frame. // Clear the context before we push it when entering the JS frame.
__ xor_(rsi, rsi); __ Set(rsi, 0);
// Enter an internal frame. // Enter an internal frame.
__ EnterInternalFrame(); __ EnterInternalFrame();
...@@ -479,7 +479,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, ...@@ -479,7 +479,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
// Register rbx points to array of pointers to handle locations. // Register rbx points to array of pointers to handle locations.
// Push the values of these handles. // Push the values of these handles.
Label loop, entry; Label loop, entry;
__ xor_(rcx, rcx); // Set loop variable to 0. __ Set(rcx, 0); // Set loop variable to 0.
__ jmp(&entry); __ jmp(&entry);
__ bind(&loop); __ bind(&loop);
__ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0)); __ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0));
...@@ -668,7 +668,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { ...@@ -668,7 +668,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
// become the receiver. // become the receiver.
__ bind(&non_function); __ bind(&non_function);
__ movq(Operand(rsp, rax, times_pointer_size, 0), rdi); __ 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 // 4. Shift arguments and return address one slot down on the stack
// (overwriting the original receiver). Adjust argument count to make // (overwriting the original receiver). Adjust argument count to make
...@@ -689,7 +689,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { ...@@ -689,7 +689,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
{ Label function; { Label function;
__ testq(rdi, rdi); __ testq(rdi, rdi);
__ j(not_zero, &function); __ j(not_zero, &function);
__ xor_(rbx, rbx); __ Set(rbx, 0);
__ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION); __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION);
__ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
......
...@@ -104,7 +104,7 @@ void FastNewContextStub::Generate(MacroAssembler* masm) { ...@@ -104,7 +104,7 @@ void FastNewContextStub::Generate(MacroAssembler* masm) {
__ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length)); __ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length));
// Setup the fixed slots. // 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::CLOSURE_INDEX)), rcx);
__ movq(Operand(rax, Context::SlotOffset(Context::FCONTEXT_INDEX)), rax); __ movq(Operand(rax, Context::SlotOffset(Context::FCONTEXT_INDEX)), rax);
__ movq(Operand(rax, Context::SlotOffset(Context::PREVIOUS_INDEX)), rbx); __ movq(Operand(rax, Context::SlotOffset(Context::PREVIOUS_INDEX)), rbx);
...@@ -250,7 +250,7 @@ void ToBooleanStub::Generate(MacroAssembler* masm) { ...@@ -250,7 +250,7 @@ void ToBooleanStub::Generate(MacroAssembler* masm) {
__ movq(rax, Immediate(1)); __ movq(rax, Immediate(1));
__ ret(1 * kPointerSize); __ ret(1 * kPointerSize);
__ bind(&false_result); __ bind(&false_result);
__ xor_(rax, rax); __ Set(rax, 0);
__ ret(1 * kPointerSize); __ ret(1 * kPointerSize);
} }
...@@ -2572,7 +2572,7 @@ void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { ...@@ -2572,7 +2572,7 @@ void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
// Before returning we restore the context from the frame pointer if not NULL. // 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. // 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; NearLabel skip;
__ cmpq(rbp, Immediate(0)); __ cmpq(rbp, Immediate(0));
__ j(equal, &skip); __ j(equal, &skip);
...@@ -2756,7 +2756,7 @@ void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm, ...@@ -2756,7 +2756,7 @@ void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm,
} }
// Clear the context pointer. // Clear the context pointer.
__ xor_(rsi, rsi); __ Set(rsi, 0);
// Restore registers from handler. // Restore registers from handler.
STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize == STATIC_ASSERT(StackHandlerConstants::kNextOffset + kPointerSize ==
......
...@@ -80,7 +80,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm, ...@@ -80,7 +80,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
#ifdef DEBUG #ifdef DEBUG
__ RecordComment("// Calling from debug break to runtime - come in - over"); __ RecordComment("// Calling from debug break to runtime - come in - over");
#endif #endif
__ xor_(rax, rax); // No arguments (argc == 0). __ Set(rax, 0); // No arguments (argc == 0).
__ movq(rbx, ExternalReference::debug_break()); __ movq(rbx, ExternalReference::debug_break());
CEntryStub ceb(1); CEntryStub ceb(1);
......
...@@ -199,7 +199,7 @@ void FullCodeGenerator::Generate(CompilationInfo* info) { ...@@ -199,7 +199,7 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
void FullCodeGenerator::ClearAccumulator() { void FullCodeGenerator::ClearAccumulator() {
__ xor_(rax, rax); __ Set(rax, 0);
} }
......
...@@ -1110,7 +1110,7 @@ void MacroAssembler::SmiAnd(Register dst, Register src1, Register src2) { ...@@ -1110,7 +1110,7 @@ void MacroAssembler::SmiAnd(Register dst, Register src1, Register src2) {
void MacroAssembler::SmiAndConstant(Register dst, Register src, Smi* constant) { void MacroAssembler::SmiAndConstant(Register dst, Register src, Smi* constant) {
if (constant->value() == 0) { if (constant->value() == 0) {
xor_(dst, dst); Set(dst, 0);
} else if (dst.is(src)) { } else if (dst.is(src)) {
ASSERT(!dst.is(kScratchRegister)); ASSERT(!dst.is(kScratchRegister));
Register constant_reg = GetSmiConstant(constant); Register constant_reg = GetSmiConstant(constant);
...@@ -1605,7 +1605,7 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value) { ...@@ -1605,7 +1605,7 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value) {
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT
void MacroAssembler::DebugBreak() { void MacroAssembler::DebugBreak() {
ASSERT(allow_stub_calls()); ASSERT(allow_stub_calls());
xor_(rax, rax); // no arguments Set(rax, 0); // No arguments.
movq(rbx, ExternalReference(Runtime::kDebugBreak)); movq(rbx, ExternalReference(Runtime::kDebugBreak));
CEntryStub ces(1); CEntryStub ces(1);
Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); Call(ces.GetCode(), RelocInfo::DEBUG_BREAK);
......
...@@ -1176,7 +1176,7 @@ void MacroAssembler::SmiMul(Register dst, ...@@ -1176,7 +1176,7 @@ void MacroAssembler::SmiMul(Register dst,
jmp(on_not_smi_result); jmp(on_not_smi_result);
bind(&zero_correct_result); bind(&zero_correct_result);
xor_(dst, dst); Set(dst, 0);
bind(&correct_result); bind(&correct_result);
} else { } else {
......
...@@ -688,7 +688,7 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type, ...@@ -688,7 +688,7 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type,
void RegExpMacroAssemblerX64::Fail() { void RegExpMacroAssemblerX64::Fail() {
ASSERT(FAILURE == 0); // Return value for failure is zero. ASSERT(FAILURE == 0); // Return value for failure is zero.
__ xor_(rax, rax); // zero rax. __ Set(rax, 0);
__ jmp(&exit_label_); __ jmp(&exit_label_);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment