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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 149133004: A64: Synchronize with r17807. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 bool LCodeGen::IsInteger32(LConstantOperand* op) const { 774 bool LCodeGen::IsInteger32(LConstantOperand* op) const {
775 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); 775 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32();
776 } 776 }
777 777
778 778
779 bool LCodeGen::IsSmi(LConstantOperand* op) const { 779 bool LCodeGen::IsSmi(LConstantOperand* op) const {
780 return chunk_->LookupLiteralRepresentation(op).IsSmi(); 780 return chunk_->LookupLiteralRepresentation(op).IsSmi();
781 } 781 }
782 782
783 783
784 static int ArgumentsOffsetWithoutFrame(int index) {
785 ASSERT(index < 0);
786 return -(index + 1) * kPointerSize + kPCOnStackSize;
787 }
788
789
784 Operand LCodeGen::ToOperand(LOperand* op) const { 790 Operand LCodeGen::ToOperand(LOperand* op) const {
785 if (op->IsRegister()) return Operand(ToRegister(op)); 791 if (op->IsRegister()) return Operand(ToRegister(op));
786 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op)); 792 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op));
787 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); 793 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
788 return Operand(ebp, StackSlotOffset(op->index())); 794 if (NeedsEagerFrame()) {
795 return Operand(ebp, StackSlotOffset(op->index()));
796 } else {
797 // Retrieve parameter without eager stack-frame relative to the
798 // stack-pointer.
799 return Operand(esp, ArgumentsOffsetWithoutFrame(op->index()));
800 }
789 } 801 }
790 802
791 803
792 Operand LCodeGen::HighOperand(LOperand* op) { 804 Operand LCodeGen::HighOperand(LOperand* op) {
793 ASSERT(op->IsDoubleStackSlot()); 805 ASSERT(op->IsDoubleStackSlot());
794 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); 806 if (NeedsEagerFrame()) {
807 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize);
808 } else {
809 // Retrieve parameter without eager stack-frame relative to the
810 // stack-pointer.
811 return Operand(
812 esp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize);
813 }
795 } 814 }
796 815
797 816
798 void LCodeGen::WriteTranslation(LEnvironment* environment, 817 void LCodeGen::WriteTranslation(LEnvironment* environment,
799 Translation* translation) { 818 Translation* translation) {
800 if (environment == NULL) return; 819 if (environment == NULL) return;
801 820
802 // The translation includes one command per value in the environment. 821 // The translation includes one command per value in the environment.
803 int translation_size = environment->translation_size(); 822 int translation_size = environment->translation_size();
804 // The output frame height does not include the parameters. 823 // The output frame height does not include the parameters.
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 __ fstp_d(MemOperand(esp, 0)); 2682 __ fstp_d(MemOperand(esp, 0));
2664 } 2683 }
2665 2684
2666 __ add(esp, Immediate(kDoubleSize)); 2685 __ add(esp, Immediate(kDoubleSize));
2667 int offset = sizeof(kHoleNanUpper32); 2686 int offset = sizeof(kHoleNanUpper32);
2668 __ cmp(MemOperand(esp, -offset), Immediate(kHoleNanUpper32)); 2687 __ cmp(MemOperand(esp, -offset), Immediate(kHoleNanUpper32));
2669 EmitBranch(instr, equal); 2688 EmitBranch(instr, equal);
2670 } 2689 }
2671 2690
2672 2691
2692 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
2693 Representation rep = instr->hydrogen()->value()->representation();
2694 ASSERT(!rep.IsInteger32());
2695 Register scratch = ToRegister(instr->temp());
2696
2697 if (rep.IsDouble()) {
2698 CpuFeatureScope use_sse2(masm(), SSE2);
2699 XMMRegister value = ToDoubleRegister(instr->value());
2700 XMMRegister xmm_scratch = double_scratch0();
2701 __ xorps(xmm_scratch, xmm_scratch);
2702 __ ucomisd(xmm_scratch, value);
2703 EmitFalseBranch(instr, not_equal);
2704 __ movmskpd(scratch, value);
2705 __ test(scratch, Immediate(1));
2706 EmitBranch(instr, not_zero);
2707 } else {
2708 Register value = ToRegister(instr->value());
2709 Handle<Map> map = masm()->isolate()->factory()->heap_number_map();
2710 __ CheckMap(value, map, instr->FalseLabel(chunk()), DO_SMI_CHECK);
2711 __ cmp(FieldOperand(value, HeapNumber::kExponentOffset),
2712 Immediate(0x80000000));
2713 EmitFalseBranch(instr, not_equal);
2714 __ cmp(FieldOperand(value, HeapNumber::kMantissaOffset),
2715 Immediate(0x00000000));
2716 EmitBranch(instr, equal);
2717 }
2718 }
2719
2720
2673 Condition LCodeGen::EmitIsObject(Register input, 2721 Condition LCodeGen::EmitIsObject(Register input,
2674 Register temp1, 2722 Register temp1,
2675 Label* is_not_object, 2723 Label* is_not_object,
2676 Label* is_object) { 2724 Label* is_object) {
2677 __ JumpIfSmi(input, is_not_object); 2725 __ JumpIfSmi(input, is_not_object);
2678 2726
2679 __ cmp(input, isolate()->factory()->null_value()); 2727 __ cmp(input, isolate()->factory()->null_value());
2680 __ j(equal, is_object); 2728 __ j(equal, is_object);
2681 2729
2682 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset)); 2730 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset));
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
4340 } 4388 }
4341 4389
4342 4390
4343 void LCodeGen::DoCallFunction(LCallFunction* instr) { 4391 void LCodeGen::DoCallFunction(LCallFunction* instr) {
4344 ASSERT(ToRegister(instr->context()).is(esi)); 4392 ASSERT(ToRegister(instr->context()).is(esi));
4345 ASSERT(ToRegister(instr->function()).is(edi)); 4393 ASSERT(ToRegister(instr->function()).is(edi));
4346 ASSERT(ToRegister(instr->result()).is(eax)); 4394 ASSERT(ToRegister(instr->result()).is(eax));
4347 4395
4348 int arity = instr->arity(); 4396 int arity = instr->arity();
4349 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); 4397 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS);
4350 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 4398 if (instr->hydrogen()->IsTailCall()) {
4399 if (NeedsEagerFrame()) __ leave();
4400 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET);
4401 } else {
4402 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4403 }
4351 } 4404 }
4352 4405
4353 4406
4354 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { 4407 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
4355 ASSERT(ToRegister(instr->context()).is(esi)); 4408 ASSERT(ToRegister(instr->context()).is(esi));
4356 ASSERT(ToRegister(instr->result()).is(eax)); 4409 ASSERT(ToRegister(instr->result()).is(eax));
4357 4410
4358 int arity = instr->arity(); 4411 int arity = instr->arity();
4359 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; 4412 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT;
4360 Handle<Code> ic = 4413 Handle<Code> ic =
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
6009 if (instr->size()->IsRegister()) { 6062 if (instr->size()->IsRegister()) {
6010 Register size = ToRegister(instr->size()); 6063 Register size = ToRegister(instr->size());
6011 ASSERT(!size.is(result)); 6064 ASSERT(!size.is(result));
6012 __ SmiTag(ToRegister(instr->size())); 6065 __ SmiTag(ToRegister(instr->size()));
6013 __ push(size); 6066 __ push(size);
6014 } else { 6067 } else {
6015 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 6068 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
6016 __ push(Immediate(Smi::FromInt(size))); 6069 __ push(Immediate(Smi::FromInt(size)));
6017 } 6070 }
6018 6071
6072 int flags = AllocateDoubleAlignFlag::encode(
6073 instr->hydrogen()->MustAllocateDoubleAligned());
6019 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { 6074 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
6020 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation()); 6075 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
6021 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); 6076 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
6022 CallRuntimeFromDeferred( 6077 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE);
6023 Runtime::kAllocateInOldPointerSpace, 1, instr, instr->context());
6024 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { 6078 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
6025 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); 6079 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
6026 CallRuntimeFromDeferred( 6080 flags = AllocateTargetSpace::update(flags, OLD_DATA_SPACE);
6027 Runtime::kAllocateInOldDataSpace, 1, instr, instr->context());
6028 } else { 6081 } else {
6029 CallRuntimeFromDeferred( 6082 flags = AllocateTargetSpace::update(flags, NEW_SPACE);
6030 Runtime::kAllocateInNewSpace, 1, instr, instr->context());
6031 } 6083 }
6084 __ push(Immediate(Smi::FromInt(flags)));
6085
6086 CallRuntimeFromDeferred(
6087 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
6032 __ StoreToSafepointRegisterSlot(result, eax); 6088 __ StoreToSafepointRegisterSlot(result, eax);
6033 } 6089 }
6034 6090
6035 6091
6036 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { 6092 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
6037 ASSERT(ToRegister(instr->value()).is(eax)); 6093 ASSERT(ToRegister(instr->value()).is(eax));
6038 __ push(eax); 6094 __ push(eax);
6039 CallRuntime(Runtime::kToFastProperties, 1, instr); 6095 CallRuntime(Runtime::kToFastProperties, 1, instr);
6040 } 6096 }
6041 6097
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
6448 FixedArray::kHeaderSize - kPointerSize)); 6504 FixedArray::kHeaderSize - kPointerSize));
6449 __ bind(&done); 6505 __ bind(&done);
6450 } 6506 }
6451 6507
6452 6508
6453 #undef __ 6509 #undef __
6454 6510
6455 } } // namespace v8::internal 6511 } } // namespace v8::internal
6456 6512
6457 #endif // V8_TARGET_ARCH_IA32 6513 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698