From df25d21deea2f3ef437ecbb247b4858d20cca0da Mon Sep 17 00:00:00 2001 From: "titzer@chromium.org" Date: Mon, 24 Mar 2014 13:00:05 +0000 Subject: [PATCH] IA32: Rename MacroAssembler::Set() and MacroAssembler::SafeSet() to Move() and SafeMove(). R=mstarzinger@chromium.org BUG= Review URL: https://codereview.chromium.org/208073003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20192 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ia32/builtins-ia32.cc | 20 +++++------ src/ia32/code-stubs-ia32.cc | 60 ++++++++++++++++----------------- src/ia32/debug-ia32.cc | 4 +-- src/ia32/full-codegen-ia32.cc | 30 ++++++++--------- src/ia32/lithium-codegen-ia32.cc | 48 +++++++++++++------------- src/ia32/lithium-gap-resolver-ia32.cc | 4 +-- src/ia32/macro-assembler-ia32.cc | 43 ++++++++++------------- src/ia32/macro-assembler-ia32.h | 12 +++---- src/ia32/regexp-macro-assembler-ia32.cc | 2 +- src/ia32/stub-cache-ia32.cc | 2 +- 10 files changed, 107 insertions(+), 118 deletions(-) diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc index d4c656f..fda4e63 100644 --- a/src/ia32/builtins-ia32.cc +++ b/src/ia32/builtins-ia32.cc @@ -500,7 +500,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, ProfileEntryHookStub::MaybeCallEntryHook(masm); // Clear the context before we push it when entering the internal frame. - __ Set(esi, Immediate(0)); + __ Move(esi, Immediate(0)); { FrameScope scope(masm, StackFrame::INTERNAL); @@ -522,7 +522,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, // Copy arguments to the stack in a loop. Label loop, entry; - __ Set(ecx, Immediate(0)); + __ Move(ecx, Immediate(0)); __ jmp(&entry); __ bind(&loop); __ mov(edx, Operand(ebx, ecx, times_4, 0)); // push parameter from argv @@ -785,7 +785,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { // 3a. Patch the first argument if necessary when calling a function. Label shift_arguments; - __ Set(edx, Immediate(0)); // indicate regular JS_FUNCTION + __ Move(edx, Immediate(0)); // indicate regular JS_FUNCTION { Label convert_to_object, use_global_receiver, patch_receiver; // Change context eagerly in case we need the global receiver. __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); @@ -825,7 +825,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { __ push(ebx); __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); __ mov(ebx, eax); - __ Set(edx, Immediate(0)); // restore + __ Move(edx, Immediate(0)); // restore __ pop(eax); __ SmiUntag(eax); @@ -848,11 +848,11 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { // 3b. Check for function proxy. __ bind(&slow); - __ Set(edx, Immediate(1)); // indicate function proxy + __ Move(edx, Immediate(1)); // indicate function proxy __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); __ j(equal, &shift_arguments); __ bind(&non_function); - __ Set(edx, Immediate(2)); // indicate non-function + __ Move(edx, Immediate(2)); // indicate non-function // 3c. Patch the first argument when calling a non-function. The // CALL_NON_FUNCTION builtin expects the non-function callee as @@ -880,7 +880,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { { Label function, non_proxy; __ test(edx, edx); __ j(zero, &function); - __ Set(ebx, Immediate(0)); + __ Move(ebx, Immediate(0)); __ cmp(edx, Immediate(1)); __ j(not_equal, &non_proxy); @@ -1058,7 +1058,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { __ bind(&call_proxy); __ push(edi); // add function proxy as last argument __ inc(eax); - __ Set(ebx, Immediate(0)); + __ Move(ebx, Immediate(0)); __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); __ call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); @@ -1192,7 +1192,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { // Set properties and elements. Factory* factory = masm->isolate()->factory(); - __ Set(ecx, Immediate(factory->empty_fixed_array())); + __ Move(ecx, Immediate(factory->empty_fixed_array())); __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ecx); __ mov(FieldOperand(eax, JSObject::kElementsOffset), ecx); @@ -1233,7 +1233,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { // Load the empty string into ebx, remove the receiver from the // stack, and jump back to the case where the argument is a string. __ bind(&no_arguments); - __ Set(ebx, Immediate(factory->empty_string())); + __ Move(ebx, Immediate(factory->empty_string())); __ pop(ecx); __ lea(esp, Operand(esp, kPointerSize)); __ push(ecx); diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index 167319a..02af639 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -1542,7 +1542,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { __ j(above, &runtime); // Reset offset for possibly sliced string. - __ Set(edi, Immediate(0)); + __ Move(edi, Immediate(0)); __ mov(eax, Operand(esp, kSubjectOffset)); __ JumpIfSmi(eax, &runtime); __ mov(edx, eax); // Make a copy of the original subject string. @@ -1636,7 +1636,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { __ cmp(ebx, FieldOperand(edx, String::kLengthOffset)); __ j(above_equal, &runtime); __ mov(edx, FieldOperand(ecx, JSRegExp::kDataAsciiCodeOffset)); - __ Set(ecx, Immediate(1)); // Type is one byte. + __ Move(ecx, Immediate(1)); // Type is one byte. // (E) Carry on. String handling is done. __ bind(&check_code); @@ -1904,7 +1904,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { __ cmp(ebx, FieldOperand(edx, String::kLengthOffset)); __ j(above_equal, &runtime); __ mov(edx, FieldOperand(ecx, JSRegExp::kDataUC16CodeOffset)); - __ Set(ecx, Immediate(0)); // Type is two byte. + __ Move(ecx, Immediate(0)); // Type is two byte. __ jmp(&check_code); // Go to (E). // (10) Not a string or a short external string? If yes, bail out to runtime. @@ -2001,7 +2001,7 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { Label check_for_nan; __ cmp(edx, masm->isolate()->factory()->undefined_value()); __ j(not_equal, &check_for_nan, Label::kNear); - __ Set(eax, Immediate(Smi::FromInt(NegativeComparisonResult(cc)))); + __ Move(eax, Immediate(Smi::FromInt(NegativeComparisonResult(cc)))); __ ret(0); __ bind(&check_for_nan); } @@ -2016,7 +2016,7 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); __ j(above_equal, ¬_identical); } - __ Set(eax, Immediate(Smi::FromInt(EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(EQUAL))); __ ret(0); @@ -2130,7 +2130,7 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { __ j(below, &below_label, Label::kNear); __ j(above, &above_label, Label::kNear); - __ Set(eax, Immediate(0)); + __ Move(eax, Immediate(0)); __ ret(0); __ bind(&below_label); @@ -2222,7 +2222,7 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { __ j(zero, &return_unequal, Label::kNear); // The objects are both undetectable, so they both compare as the value // undefined, and are equal. - __ Set(eax, Immediate(EQUAL)); + __ Move(eax, Immediate(EQUAL)); __ bind(&return_unequal); // Return non-equal by returning the non-zero object pointer in eax, // or return equal if we fell through to here. @@ -2438,8 +2438,8 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { __ pop(ecx); __ push(edi); // put proxy as additional argument under return address __ push(ecx); - __ Set(eax, Immediate(argc_ + 1)); - __ Set(ebx, Immediate(0)); + __ Move(eax, Immediate(argc_ + 1)); + __ Move(ebx, Immediate(0)); __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); { Handle adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); @@ -2450,8 +2450,8 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { // of the original receiver from the call site). __ bind(&non_function); __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); - __ Set(eax, Immediate(argc_)); - __ Set(ebx, Immediate(0)); + __ Move(eax, Immediate(argc_)); + __ Move(ebx, Immediate(0)); __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); Handle adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); __ jmp(adaptor, RelocInfo::CODE_TARGET); @@ -2533,7 +2533,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) { __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); __ bind(&do_call); // Set expected number of arguments to zero (not changing eax). - __ Set(ebx, Immediate(0)); + __ Move(ebx, Immediate(0)); Handle arguments_adaptor = masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); @@ -2983,7 +2983,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) { } __ mov(Operand(scratch, kDeltaToMovImmediate), eax); if (!ReturnTrueFalseObject()) { - __ Set(eax, Immediate(0)); + __ Move(eax, Immediate(0)); } } __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); @@ -3003,7 +3003,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) { } __ mov(Operand(scratch, kDeltaToMovImmediate), eax); if (!ReturnTrueFalseObject()) { - __ Set(eax, Immediate(Smi::FromInt(1))); + __ Move(eax, Immediate(Smi::FromInt(1))); } } __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); @@ -3019,20 +3019,20 @@ void InstanceofStub::Generate(MacroAssembler* masm) { // Null is not instance of anything. __ cmp(object, factory->null_value()); __ j(not_equal, &object_not_null, Label::kNear); - __ Set(eax, Immediate(Smi::FromInt(1))); + __ Move(eax, Immediate(Smi::FromInt(1))); __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); __ bind(&object_not_null); // Smi values is not instance of anything. __ JumpIfNotSmi(object, &object_not_null_or_smi, Label::kNear); - __ Set(eax, Immediate(Smi::FromInt(1))); + __ Move(eax, Immediate(Smi::FromInt(1))); __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); __ bind(&object_not_null_or_smi); // String values is not instance of anything. Condition is_string = masm->IsObjectStringType(object, scratch, scratch); __ j(NegateCondition(is_string), &slow, Label::kNear); - __ Set(eax, Immediate(Smi::FromInt(1))); + __ Move(eax, Immediate(Smi::FromInt(1))); __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); // Slow-case: Go through the JavaScript implementation. @@ -3180,7 +3180,7 @@ void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { __ j(not_zero, &slow_case_); Factory* factory = masm->isolate()->factory(); - __ Set(result_, Immediate(factory->single_character_string_cache())); + __ Move(result_, Immediate(factory->single_character_string_cache())); STATIC_ASSERT(kSmiTag == 0); STATIC_ASSERT(kSmiTagSize == 1); STATIC_ASSERT(kSmiShiftSize == 0); @@ -3579,7 +3579,7 @@ void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm, __ cmp(length, FieldOperand(right, String::kLengthOffset)); __ j(equal, &check_zero_length, Label::kNear); __ bind(&strings_not_equal); - __ Set(eax, Immediate(Smi::FromInt(NOT_EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(NOT_EQUAL))); __ ret(0); // Check if the length is zero. @@ -3588,7 +3588,7 @@ void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm, STATIC_ASSERT(kSmiTag == 0); __ test(length, length); __ j(not_zero, &compare_chars, Label::kNear); - __ Set(eax, Immediate(Smi::FromInt(EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(EQUAL))); __ ret(0); // Compare characters. @@ -3597,7 +3597,7 @@ void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm, &strings_not_equal, Label::kNear); // Characters are equal. - __ Set(eax, Immediate(Smi::FromInt(EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(EQUAL))); __ ret(0); } @@ -3645,7 +3645,7 @@ void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm, // Result is EQUAL. STATIC_ASSERT(EQUAL == 0); STATIC_ASSERT(kSmiTag == 0); - __ Set(eax, Immediate(Smi::FromInt(EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(EQUAL))); __ ret(0); Label result_greater; @@ -3658,12 +3658,12 @@ void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm, __ bind(&result_less); // Result is LESS. - __ Set(eax, Immediate(Smi::FromInt(LESS))); + __ Move(eax, Immediate(Smi::FromInt(LESS))); __ ret(0); // Result is GREATER. __ bind(&result_greater); - __ Set(eax, Immediate(Smi::FromInt(GREATER))); + __ Move(eax, Immediate(Smi::FromInt(GREATER))); __ ret(0); } @@ -3714,7 +3714,7 @@ void StringCompareStub::Generate(MacroAssembler* masm) { __ j(not_equal, ¬_same, Label::kNear); STATIC_ASSERT(EQUAL == 0); STATIC_ASSERT(kSmiTag == 0); - __ Set(eax, Immediate(Smi::FromInt(EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(EQUAL))); __ IncrementCounter(masm->isolate()->counters()->string_compare_native(), 1); __ ret(2 * kPointerSize); @@ -4120,7 +4120,7 @@ void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) { __ j(not_equal, &done, Label::kNear); STATIC_ASSERT(EQUAL == 0); STATIC_ASSERT(kSmiTag == 0); - __ Set(eax, Immediate(Smi::FromInt(EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(EQUAL))); __ bind(&done); __ ret(0); @@ -4165,7 +4165,7 @@ void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) { __ j(not_equal, &done, Label::kNear); STATIC_ASSERT(EQUAL == 0); STATIC_ASSERT(kSmiTag == 0); - __ Set(eax, Immediate(Smi::FromInt(EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(EQUAL))); __ bind(&done); __ ret(0); @@ -4211,7 +4211,7 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) { __ j(not_equal, ¬_same, Label::kNear); STATIC_ASSERT(EQUAL == 0); STATIC_ASSERT(kSmiTag == 0); - __ Set(eax, Immediate(Smi::FromInt(EQUAL))); + __ Move(eax, Immediate(Smi::FromInt(EQUAL))); __ ret(0); // Handle not identical strings. @@ -5290,9 +5290,9 @@ void CallApiFunctionStub::Generate(MacroAssembler* masm) { // FunctionCallbackInfo::values_. __ mov(ApiParameterOperand(3), scratch); // FunctionCallbackInfo::length_. - __ Set(ApiParameterOperand(4), Immediate(argc)); + __ Move(ApiParameterOperand(4), Immediate(argc)); // FunctionCallbackInfo::is_construct_call_. - __ Set(ApiParameterOperand(5), Immediate(0)); + __ Move(ApiParameterOperand(5), Immediate(0)); // v8::InvocationCallback's argument. __ lea(scratch, ApiParameterOperand(2)); diff --git a/src/ia32/debug-ia32.cc b/src/ia32/debug-ia32.cc index 4c76f7d..42284ec 100644 --- a/src/ia32/debug-ia32.cc +++ b/src/ia32/debug-ia32.cc @@ -138,7 +138,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm, #ifdef DEBUG __ RecordComment("// Calling from debug break to runtime - come in - over"); #endif - __ Set(eax, Immediate(0)); // No arguments. + __ Move(eax, Immediate(0)); // No arguments. __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate()))); CEntryStub ceb(1); @@ -154,7 +154,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm, int r = JSCallerSavedCode(i); Register reg = { r }; if (FLAG_debug_code) { - __ Set(reg, Immediate(kDebugZapValue)); + __ Move(reg, Immediate(kDebugZapValue)); } bool taken = reg.code() == esi.code(); if ((object_regs & (1 << r)) != 0) { diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index 3b554ea..b05b888 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -342,7 +342,7 @@ void FullCodeGenerator::Generate() { void FullCodeGenerator::ClearAccumulator() { - __ Set(eax, Immediate(Smi::FromInt(0))); + __ Move(eax, Immediate(Smi::FromInt(0))); } @@ -501,9 +501,9 @@ void FullCodeGenerator::EffectContext::Plug(Handle lit) const { void FullCodeGenerator::AccumulatorValueContext::Plug( Handle lit) const { if (lit->IsSmi()) { - __ SafeSet(result_register(), Immediate(lit)); + __ SafeMove(result_register(), Immediate(lit)); } else { - __ Set(result_register(), Immediate(lit)); + __ Move(result_register(), Immediate(lit)); } } @@ -1150,7 +1150,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); __ j(above, &non_proxy); - __ Set(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy + __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy __ bind(&non_proxy); __ push(ebx); // Smi __ push(eax); // Array @@ -2863,7 +2863,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { SetSourcePosition(expr->position()); // Load function and argument count into edi and eax. - __ Set(eax, Immediate(arg_count)); + __ Move(eax, Immediate(arg_count)); __ mov(edi, Operand(esp, arg_count * kPointerSize)); // Record call targets in unoptimized code. @@ -3256,7 +3256,7 @@ void FullCodeGenerator::EmitArguments(CallRuntime* expr) { // parameter count in eax. VisitForAccumulatorValue(args->at(0)); __ mov(edx, eax); - __ Set(eax, Immediate(Smi::FromInt(info_->scope()->num_parameters()))); + __ Move(eax, Immediate(Smi::FromInt(info_->scope()->num_parameters()))); ArgumentsAccessStub stub(ArgumentsAccessStub::READ_ELEMENT); __ CallStub(&stub); context()->Plug(eax); @@ -3268,7 +3268,7 @@ void FullCodeGenerator::EmitArgumentsLength(CallRuntime* expr) { Label exit; // Get the number of formal parameters. - __ Set(eax, Immediate(Smi::FromInt(info_->scope()->num_parameters()))); + __ Move(eax, Immediate(Smi::FromInt(info_->scope()->num_parameters()))); // Check if the calling frame is an arguments adaptor frame. __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); @@ -3635,13 +3635,13 @@ void FullCodeGenerator::EmitStringCharCodeAt(CallRuntime* expr) { __ bind(&index_out_of_range); // When the index is out of range, the spec requires us to return // NaN. - __ Set(result, Immediate(isolate()->factory()->nan_value())); + __ Move(result, Immediate(isolate()->factory()->nan_value())); __ jmp(&done); __ bind(&need_conversion); // Move the undefined value into the result register, which will // trigger conversion. - __ Set(result, Immediate(isolate()->factory()->undefined_value())); + __ Move(result, Immediate(isolate()->factory()->undefined_value())); __ jmp(&done); NopRuntimeCallHelper call_helper; @@ -3683,13 +3683,13 @@ void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) { __ bind(&index_out_of_range); // When the index is out of range, the spec requires us to return // the empty string. - __ Set(result, Immediate(isolate()->factory()->empty_string())); + __ Move(result, Immediate(isolate()->factory()->empty_string())); __ jmp(&done); __ bind(&need_conversion); // Move smi zero into the result register, which will trigger // conversion. - __ Set(result, Immediate(Smi::FromInt(0))); + __ Move(result, Immediate(Smi::FromInt(0))); __ jmp(&done); NopRuntimeCallHelper call_helper; @@ -3940,8 +3940,8 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) { // Check that all array elements are sequential ASCII strings, and // accumulate the sum of their lengths, as a smi-encoded value. - __ Set(index, Immediate(0)); - __ Set(string_length, Immediate(0)); + __ Move(index, Immediate(0)); + __ Move(string_length, Immediate(0)); // Loop condition: while (index < length). // Live loop registers: index, array_length, string, // scratch, string_length, elements. @@ -4057,7 +4057,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) { __ mov_b(scratch, FieldOperand(string, SeqOneByteString::kHeaderSize)); __ mov_b(separator_operand, scratch); - __ Set(index, Immediate(0)); + __ Move(index, Immediate(0)); // Jump into the loop after the code that copies the separator, so the first // element is not preceded by a separator __ jmp(&loop_2_entry); @@ -4094,7 +4094,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) { // Long separator case (separator is more than one character). __ bind(&long_separator); - __ Set(index, Immediate(0)); + __ Move(index, Immediate(0)); // Jump into the loop after the code that copies the separator, so the first // element is not preceded by a separator __ jmp(&loop_3_entry); diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index f054dfe..f15b798 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -199,7 +199,7 @@ bool LCodeGen::GeneratePrologue() { if (support_aligned_spilled_doubles_ && dynamic_frame_alignment_) { // Move state of dynamic frame alignment into edx. - __ Set(edx, Immediate(kNoAlignmentPadding)); + __ Move(edx, Immediate(kNoAlignmentPadding)); Label do_not_pad, align_loop; STATIC_ASSERT(kDoubleSize == 2 * kPointerSize); @@ -346,7 +346,7 @@ void LCodeGen::GenerateOsrPrologue() { osr_pc_offset_ = masm()->pc_offset(); // Move state of dynamic frame alignment into edx. - __ Set(edx, Immediate(kNoAlignmentPadding)); + __ Move(edx, Immediate(kNoAlignmentPadding)); if (support_aligned_spilled_doubles_ && dynamic_frame_alignment_) { Label do_not_pad, align_loop; @@ -1464,7 +1464,7 @@ void LCodeGen::DoModI(LModI* instr) { DeoptimizeIf(equal, instr->environment()); } else { __ j(not_equal, &no_overflow_possible, Label::kNear); - __ Set(result_reg, Immediate(0)); + __ Move(result_reg, Immediate(0)); __ jmp(&done, Label::kNear); } __ bind(&no_overflow_possible); @@ -1926,12 +1926,12 @@ void LCodeGen::DoSubI(LSubI* instr) { void LCodeGen::DoConstantI(LConstantI* instr) { - __ Set(ToRegister(instr->result()), Immediate(instr->value())); + __ Move(ToRegister(instr->result()), Immediate(instr->value())); } void LCodeGen::DoConstantS(LConstantS* instr) { - __ Set(ToRegister(instr->result()), Immediate(instr->value())); + __ Move(ToRegister(instr->result()), Immediate(instr->value())); } @@ -1958,22 +1958,22 @@ void LCodeGen::DoConstantD(LConstantD* instr) { if (CpuFeatures::IsSupported(SSE4_1)) { CpuFeatureScope scope2(masm(), SSE4_1); if (lower != 0) { - __ Set(temp, Immediate(lower)); + __ Move(temp, Immediate(lower)); __ movd(res, Operand(temp)); - __ Set(temp, Immediate(upper)); + __ Move(temp, Immediate(upper)); __ pinsrd(res, Operand(temp), 1); } else { __ xorps(res, res); - __ Set(temp, Immediate(upper)); + __ Move(temp, Immediate(upper)); __ pinsrd(res, Operand(temp), 1); } } else { - __ Set(temp, Immediate(upper)); + __ Move(temp, Immediate(upper)); __ movd(res, Operand(temp)); __ psllq(res, 32); if (lower != 0) { XMMRegister xmm_scratch = double_scratch0(); - __ Set(temp, Immediate(lower)); + __ Move(temp, Immediate(lower)); __ movd(xmm_scratch, Operand(temp)); __ orps(res, xmm_scratch); } @@ -3972,7 +3972,7 @@ void LCodeGen::DoMathFloor(LMathFloor* instr) { __ movmskpd(output_reg, input_reg); __ test(output_reg, Immediate(1)); DeoptimizeIf(not_zero, instr->environment()); - __ Set(output_reg, Immediate(0)); + __ Move(output_reg, Immediate(0)); __ jmp(&done, Label::kNear); __ bind(&positive_sign); } @@ -4057,7 +4057,7 @@ void LCodeGen::DoMathRound(LMathRound* instr) { __ RecordComment("Minus zero"); DeoptimizeIf(not_zero, instr->environment()); } - __ Set(output_reg, Immediate(0)); + __ Move(output_reg, Immediate(0)); __ bind(&done); } @@ -4178,7 +4178,7 @@ void LCodeGen::DoMathClz32(LMathClz32* instr) { __ bsr(result, input); __ j(not_zero, ¬_zero_input); - __ Set(result, Immediate(63)); // 63^31 == 32 + __ Move(result, Immediate(63)); // 63^31 == 32 __ bind(¬_zero_input); __ xor_(result, Immediate(31)); // for x in [0..31], 31^x == 31-x. @@ -4238,7 +4238,7 @@ void LCodeGen::DoCallNew(LCallNew* instr) { // No cell in ebx for construct type feedback in optimized code __ mov(ebx, isolate()->factory()->undefined_value()); CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); - __ Set(eax, Immediate(instr->arity())); + __ Move(eax, Immediate(instr->arity())); CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); } @@ -4248,7 +4248,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { ASSERT(ToRegister(instr->constructor()).is(edi)); ASSERT(ToRegister(instr->result()).is(eax)); - __ Set(eax, Immediate(instr->arity())); + __ Move(eax, Immediate(instr->arity())); __ mov(ebx, isolate()->factory()->undefined_value()); ElementsKind kind = instr->hydrogen()->elements_kind(); AllocationSiteOverrideMode override_mode = @@ -4790,7 +4790,7 @@ void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) { // TODO(3095996): Get rid of this. For now, we need to make the // result register contain a valid pointer because it is already // contained in the register pointer map. - __ Set(result, Immediate(0)); + __ Move(result, Immediate(0)); PushSafepointRegistersScope scope(this); __ push(string); @@ -4839,7 +4839,7 @@ void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { __ cmp(char_code, String::kMaxOneByteCharCode); __ j(above, deferred->entry()); - __ Set(result, Immediate(factory()->single_character_string_cache())); + __ Move(result, Immediate(factory()->single_character_string_cache())); __ mov(result, FieldOperand(result, char_code, times_pointer_size, FixedArray::kHeaderSize)); @@ -4856,7 +4856,7 @@ void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) { // TODO(3095996): Get rid of this. For now, we need to make the // result register contain a valid pointer because it is already // contained in the register pointer map. - __ Set(result, Immediate(0)); + __ Move(result, Immediate(0)); PushSafepointRegistersScope scope(this); __ SmiTag(char_code); @@ -5021,7 +5021,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, // TODO(3095996): Put a valid pointer value in the stack slot where the // result register is stored, as this register is in the pointer map, but // contains an integer value. - __ Set(reg, Immediate(0)); + __ Move(reg, Immediate(0)); // Preserve the value of all registers. PushSafepointRegistersScope scope(this); @@ -5098,7 +5098,7 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { // result register contain a valid pointer because it is already // contained in the register pointer map. Register reg = ToRegister(instr->result()); - __ Set(reg, Immediate(0)); + __ Move(reg, Immediate(0)); PushSafepointRegistersScope scope(this); // NumberTagI and NumberTagD use the context from the frame, rather than @@ -5298,20 +5298,20 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { // for truncating conversions. __ cmp(input_reg, factory()->undefined_value()); __ j(not_equal, &check_bools, Label::kNear); - __ Set(input_reg, Immediate(0)); + __ Move(input_reg, Immediate(0)); __ jmp(done); __ bind(&check_bools); __ cmp(input_reg, factory()->true_value()); __ j(not_equal, &check_false, Label::kNear); - __ Set(input_reg, Immediate(1)); + __ Move(input_reg, Immediate(1)); __ jmp(done); __ bind(&check_false); __ cmp(input_reg, factory()->false_value()); __ RecordComment("Deferred TaggedToI: cannot truncate"); DeoptimizeIf(not_equal, instr->environment()); - __ Set(input_reg, Immediate(0)); + __ Move(input_reg, Immediate(0)); } else { Label bailout; XMMRegister scratch = (instr->temp() != NULL) @@ -5902,7 +5902,7 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { // TODO(3095996): Get rid of this. For now, we need to make the // result register contain a valid pointer because it is already // contained in the register pointer map. - __ Set(result, Immediate(Smi::FromInt(0))); + __ Move(result, Immediate(Smi::FromInt(0))); PushSafepointRegistersScope scope(this); if (instr->size()->IsRegister()) { diff --git a/src/ia32/lithium-gap-resolver-ia32.cc b/src/ia32/lithium-gap-resolver-ia32.cc index d621bd2..01821d9 100644 --- a/src/ia32/lithium-gap-resolver-ia32.cc +++ b/src/ia32/lithium-gap-resolver-ia32.cc @@ -309,7 +309,7 @@ void LGapResolver::EmitMove(int index) { Representation r = cgen_->IsSmi(constant_source) ? Representation::Smi() : Representation::Integer32(); if (cgen_->IsInteger32(constant_source)) { - __ Set(dst, cgen_->ToImmediate(constant_source, r)); + __ Move(dst, cgen_->ToImmediate(constant_source, r)); } else { __ LoadObject(dst, cgen_->ToHandle(constant_source)); } @@ -342,7 +342,7 @@ void LGapResolver::EmitMove(int index) { Representation r = cgen_->IsSmi(constant_source) ? Representation::Smi() : Representation::Integer32(); if (cgen_->IsInteger32(constant_source)) { - __ Set(dst, cgen_->ToImmediate(constant_source, r)); + __ Move(dst, cgen_->ToImmediate(constant_source, r)); } else { Register tmp = EnsureTempRegister(); __ LoadObject(tmp, cgen_->ToHandle(constant_source)); diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 83f9a9b..0235a13 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -226,10 +226,10 @@ void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, and_(result_reg, Immediate(255)); jmp(&done, Label::kNear); bind(&conv_failure); - Set(result_reg, Immediate(0)); + Move(result_reg, Immediate(0)); ucomisd(input_reg, scratch_reg); j(below, &done, Label::kNear); - Set(result_reg, Immediate(255)); + Move(result_reg, Immediate(255)); bind(&done); } @@ -715,7 +715,7 @@ void MacroAssembler::RecordWrite(Register object, #ifdef ENABLE_DEBUGGER_SUPPORT void MacroAssembler::DebugBreak() { - Set(eax, Immediate(0)); + Move(eax, Immediate(0)); mov(ebx, Immediate(ExternalReference(Runtime::kDebugBreak, isolate()))); CEntryStub ces(1); call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK); @@ -729,20 +729,6 @@ void MacroAssembler::Cvtsi2sd(XMMRegister dst, const Operand& src) { } -void MacroAssembler::Set(Register dst, const Immediate& x) { - if (x.is_zero()) { - xor_(dst, dst); // Shorter than mov. - } else { - mov(dst, x); - } -} - - -void MacroAssembler::Set(const Operand& dst, const Immediate& x) { - mov(dst, x); -} - - bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { static const int kMaxImmediateBits = 17; if (!RelocInfo::IsNone(x.rmode_)) return false; @@ -750,12 +736,12 @@ bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { } -void MacroAssembler::SafeSet(Register dst, const Immediate& x) { +void MacroAssembler::SafeMove(Register dst, const Immediate& x) { if (IsUnsafeImmediate(x) && jit_cookie() != 0) { - Set(dst, Immediate(x.x_ ^ jit_cookie())); + Move(dst, Immediate(x.x_ ^ jit_cookie())); xor_(dst, jit_cookie()); } else { - Set(dst, x); + Move(dst, x); } } @@ -2258,7 +2244,7 @@ void MacroAssembler::CallRuntime(const Runtime::Function* f, // arguments passed in because it is constant. At some point we // should remove this need and make the runtime routine entry code // smarter. - Set(eax, Immediate(num_arguments)); + Move(eax, Immediate(num_arguments)); mov(ebx, Immediate(ExternalReference(f, isolate()))); CEntryStub ces(1, CpuFeatures::IsSupported(SSE2) ? save_doubles : kDontSaveFPRegs); @@ -2283,7 +2269,7 @@ void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, // arguments passed in because it is constant. At some point we // should remove this need and make the runtime routine entry code // smarter. - Set(eax, Immediate(num_arguments)); + Move(eax, Immediate(num_arguments)); JumpToExternalReference(ext); } @@ -2847,15 +2833,20 @@ void MacroAssembler::Move(Register dst, Register src) { } -void MacroAssembler::Move(Register dst, Immediate imm) { - if (imm.is_zero()) { - xor_(dst, dst); +void MacroAssembler::Move(Register dst, const Immediate& x) { + if (x.is_zero()) { + xor_(dst, dst); // Shorter than mov of 32-bit immediate 0. } else { - mov(dst, imm); + mov(dst, x); } } +void MacroAssembler::Move(const Operand& dst, const Immediate& x) { + mov(dst, x); +} + + void MacroAssembler::Move(XMMRegister dst, double val) { // TODO(titzer): recognize double constants with ExternalReferences. CpuFeatureScope scope(this, SSE2); diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h index bd35743..698c81f 100644 --- a/src/ia32/macro-assembler-ia32.h +++ b/src/ia32/macro-assembler-ia32.h @@ -287,7 +287,7 @@ class MacroAssembler: public Assembler { if (object->IsHeapObject()) { LoadHeapObject(result, Handle::cast(object)); } else { - Set(result, Immediate(object)); + Move(result, Immediate(object)); } } @@ -350,9 +350,6 @@ class MacroAssembler: public Assembler { void GetBuiltinEntry(Register target, Builtins::JavaScript id); // Expression support - void Set(Register dst, const Immediate& x); - void Set(const Operand& dst, const Immediate& x); - // cvtsi2sd instruction only writes to the low 64-bit of dst register, which // hinders register renaming and makes dependence chains longer. So we use // xorps to clear the dst register before cvtsi2sd to solve this issue. @@ -361,7 +358,7 @@ class MacroAssembler: public Assembler { // Support for constant splitting. bool IsUnsafeImmediate(const Immediate& x); - void SafeSet(Register dst, const Immediate& x); + void SafeMove(Register dst, const Immediate& x); void SafePush(const Immediate& x); // Compare object type for heap object. @@ -847,8 +844,9 @@ class MacroAssembler: public Assembler { // Move if the registers are not identical. void Move(Register target, Register source); - // Move a constant into a register using the most efficient encoding. - void Move(Register dst, Immediate imm); + // Move a constant into a destination using the most efficient encoding. + void Move(Register dst, const Immediate& x); + void Move(const Operand& dst, const Immediate& x); // Move an immediate into an XMM register. void Move(XMMRegister dst, double val); diff --git a/src/ia32/regexp-macro-assembler-ia32.cc b/src/ia32/regexp-macro-assembler-ia32.cc index d371c45..255df32 100644 --- a/src/ia32/regexp-macro-assembler-ia32.cc +++ b/src/ia32/regexp-macro-assembler-ia32.cc @@ -632,7 +632,7 @@ bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type, void RegExpMacroAssemblerIA32::Fail() { STATIC_ASSERT(FAILURE == 0); // Return value for failure is zero. if (!global()) { - __ Set(eax, Immediate(FAILURE)); + __ Move(eax, Immediate(FAILURE)); } __ jmp(&exit_label_); } diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index 28f4028..1a745c7 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -283,7 +283,7 @@ void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype( __ j(not_equal, miss); // Load its initial map. The global functions all have initial maps. - __ Set(prototype, Immediate(Handle(function->initial_map()))); + __ Move(prototype, Immediate(Handle(function->initial_map()))); // Load the prototype from the initial map. __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); } -- 2.7.4