diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index 20c56226e8..f9ac84d34c 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -1129,7 +1129,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { Handle(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), isolate())); RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); - __ LoadHeapObject(rbx, cell); + __ Move(rbx, cell); __ Move(FieldOperand(rbx, Cell::kValueOffset), Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker)); diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index c82ef8d81b..a305e65932 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -1556,8 +1556,7 @@ void LCodeGen::DoConstantE(LConstantE* instr) { void LCodeGen::DoConstantT(LConstantT* instr) { Handle value = instr->value(isolate()); - AllowDeferredHandleDereference smi_check; - __ LoadObject(ToRegister(instr->result()), value); + __ Move(ToRegister(instr->result()), value); } @@ -2129,7 +2128,7 @@ void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) { if (instr->right()->IsConstantOperand()) { Handle right = ToHandle(LConstantOperand::cast(instr->right())); - __ CmpObject(left, right); + __ Cmp(left, right); } else { Register right = ToRegister(instr->right()); __ cmpq(left, right); @@ -2497,7 +2496,7 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, InstanceofStub stub(flags); __ push(ToRegister(instr->value())); - __ PushHeapObject(instr->function()); + __ Push(instr->function()); static const int kAdditionalDelta = 10; int delta = @@ -3208,7 +3207,7 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) { void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { __ push(rsi); // The context is the first argument. - __ PushHeapObject(instr->hydrogen()->pairs()); + __ Push(instr->hydrogen()->pairs()); __ Push(Smi::FromInt(instr->hydrogen()->flags())); CallRuntime(Runtime::kDeclareGlobals, 3, instr); } @@ -3242,7 +3241,7 @@ void LCodeGen::CallKnownFunction(Handle function, if (can_invoke_directly) { if (rdi_state == RDI_UNINITIALIZED) { - __ LoadHeapObject(rdi, function); + __ Move(rdi, function); } // Change context. @@ -4838,8 +4837,7 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { void LCodeGen::DoCheckValue(LCheckValue* instr) { Register reg = ToRegister(instr->value()); - Handle object = instr->hydrogen()->object().handle(); - __ CmpHeapObject(reg, object); + __ Cmp(reg, instr->hydrogen()->object().handle()); DeoptimizeIf(not_equal, instr->environment()); } @@ -5066,7 +5064,7 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { // rax = regexp literal clone. int literal_offset = FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index()); - __ LoadHeapObject(rcx, instr->hydrogen()->literals()); + __ Move(rcx, instr->hydrogen()->literals()); __ movq(rbx, FieldOperand(rcx, literal_offset)); __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); __ j(not_equal, &materialized, Label::kNear); @@ -5137,13 +5135,7 @@ void LCodeGen::DoTypeof(LTypeof* instr) { void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { ASSERT(!operand->IsDoubleRegister()); if (operand->IsConstantOperand()) { - Handle object = ToHandle(LConstantOperand::cast(operand)); - AllowDeferredHandleDereference smi_check; - if (object->IsSmi()) { - __ Push(Handle::cast(object)); - } else { - __ PushHeapObject(Handle::cast(object)); - } + __ Push(ToHandle(LConstantOperand::cast(operand))); } else if (operand->IsRegister()) { __ push(ToRegister(operand)); } else { diff --git a/src/x64/lithium-gap-resolver-x64.cc b/src/x64/lithium-gap-resolver-x64.cc index 71db17c931..6d07db6cda 100644 --- a/src/x64/lithium-gap-resolver-x64.cc +++ b/src/x64/lithium-gap-resolver-x64.cc @@ -200,7 +200,7 @@ void LGapResolver::EmitMove(int index) { } else if (cgen_->IsInteger32Constant(constant_source)) { __ movl(dst, Immediate(cgen_->ToInteger32(constant_source))); } else { - __ LoadObject(dst, cgen_->ToHandle(constant_source)); + __ Move(dst, cgen_->ToHandle(constant_source)); } } else if (destination->IsDoubleRegister()) { double v = cgen_->ToDouble(constant_source); @@ -222,7 +222,7 @@ void LGapResolver::EmitMove(int index) { // value. __ movq(dst, Immediate(cgen_->ToInteger32(constant_source))); } else { - __ LoadObject(kScratchRegister, cgen_->ToHandle(constant_source)); + __ Move(kScratchRegister, cgen_->ToHandle(constant_source)); __ movq(dst, kScratchRegister); } } diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 9dcb9d1689..98d07fe2a8 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -2492,8 +2492,7 @@ void MacroAssembler::Move(Register dst, Handle source) { if (source->IsSmi()) { Move(dst, Smi::cast(*source)); } else { - ASSERT(source->IsHeapObject()); - movq(dst, source, RelocInfo::EMBEDDED_OBJECT); + MoveHeapObject(dst, source); } } @@ -2503,8 +2502,7 @@ void MacroAssembler::Move(const Operand& dst, Handle source) { if (source->IsSmi()) { Move(dst, Smi::cast(*source)); } else { - ASSERT(source->IsHeapObject()); - movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); + MoveHeapObject(kScratchRegister, source); movq(dst, kScratchRegister); } } @@ -2515,8 +2513,7 @@ void MacroAssembler::Cmp(Register dst, Handle source) { if (source->IsSmi()) { Cmp(dst, Smi::cast(*source)); } else { - ASSERT(source->IsHeapObject()); - movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); + MoveHeapObject(kScratchRegister, source); cmpq(dst, kScratchRegister); } } @@ -2527,8 +2524,7 @@ void MacroAssembler::Cmp(const Operand& dst, Handle source) { if (source->IsSmi()) { Cmp(dst, Smi::cast(*source)); } else { - ASSERT(source->IsHeapObject()); - movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); + MoveHeapObject(kScratchRegister, source); cmpq(dst, kScratchRegister); } } @@ -2539,47 +2535,22 @@ void MacroAssembler::Push(Handle source) { if (source->IsSmi()) { Push(Smi::cast(*source)); } else { - ASSERT(source->IsHeapObject()); - movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); + MoveHeapObject(kScratchRegister, source); push(kScratchRegister); } } -void MacroAssembler::LoadHeapObject(Register result, - Handle object) { +void MacroAssembler::MoveHeapObject(Register result, + Handle object) { AllowDeferredHandleDereference using_raw_address; + ASSERT(object->IsHeapObject()); if (isolate()->heap()->InNewSpace(*object)) { Handle cell = isolate()->factory()->NewCell(object); movq(result, cell, RelocInfo::CELL); movq(result, Operand(result, 0)); } else { - Move(result, object); - } -} - - -void MacroAssembler::CmpHeapObject(Register reg, Handle object) { - AllowDeferredHandleDereference using_raw_address; - if (isolate()->heap()->InNewSpace(*object)) { - Handle cell = isolate()->factory()->NewCell(object); - movq(kScratchRegister, cell, RelocInfo::CELL); - cmpq(reg, Operand(kScratchRegister, 0)); - } else { - Cmp(reg, object); - } -} - - -void MacroAssembler::PushHeapObject(Handle object) { - AllowDeferredHandleDereference using_raw_address; - if (isolate()->heap()->InNewSpace(*object)) { - Handle cell = isolate()->factory()->NewCell(object); - movq(kScratchRegister, cell, RelocInfo::CELL); - movq(kScratchRegister, Operand(kScratchRegister, 0)); - push(kScratchRegister); - } else { - Push(object); + movq(result, object, RelocInfo::EMBEDDED_OBJECT); } } @@ -3591,7 +3562,7 @@ void MacroAssembler::InvokeFunction(Handle function, ASSERT(flag == JUMP_FUNCTION || has_frame()); // Get the function and setup the context. - LoadHeapObject(rdi, function); + Move(rdi, function); movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); // We call indirectly through the code field in the function to diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index d1c2434362..238513a1a5 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -812,27 +812,7 @@ class MacroAssembler: public Assembler { // Load a heap object and handle the case of new-space objects by // indirecting via a global cell. - void LoadHeapObject(Register result, Handle object); - void CmpHeapObject(Register reg, Handle object); - void PushHeapObject(Handle object); - - void LoadObject(Register result, Handle object) { - AllowDeferredHandleDereference heap_object_check; - if (object->IsHeapObject()) { - LoadHeapObject(result, Handle::cast(object)); - } else { - Move(result, object); - } - } - - void CmpObject(Register reg, Handle object) { - AllowDeferredHandleDereference heap_object_check; - if (object->IsHeapObject()) { - CmpHeapObject(reg, Handle::cast(object)); - } else { - Cmp(reg, object); - } - } + void MoveHeapObject(Register result, Handle object); // Load a global cell into a register. void LoadGlobalCell(Register dst, Handle cell); diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index 94650fd49a..5c31133db4 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -464,7 +464,7 @@ static void GenerateFastApiCall(MacroAssembler* masm, // Get the function and setup the context. Handle function = optimization.constant_function(); - __ LoadHeapObject(rdi, function); + __ Move(rdi, function); __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); // Construct the FunctionCallbackInfo on the stack. __ movq(args.GetArgumentOperand(offset - FCA::kCalleeIndex), rdi); @@ -834,7 +834,7 @@ void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, if (details.type() == CONSTANT) { Handle constant(descriptors->GetValue(descriptor), masm->isolate()); - __ CmpObject(value_reg, constant); + __ Cmp(value_reg, constant); __ j(not_equal, miss_label); } else if (FLAG_track_fields && representation.IsSmi()) { __ JumpIfNotSmi(value_reg, miss_label); @@ -1411,7 +1411,7 @@ void LoadStubCompiler::GenerateLoadCallback( void LoadStubCompiler::GenerateLoadConstant(Handle value) { // Return the constant value. - __ LoadObject(rax, value); + __ Move(rax, value); __ ret(0); }