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

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

Issue 14607009: MIPS: Use mutable heapnumbers to store doubles in fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/mips/ic-mips.cc ('k') | src/mips/lithium-mips.cc » ('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 2670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2681 kSaveFPRegs, 2681 kSaveFPRegs,
2682 EMIT_REMEMBERED_SET, 2682 EMIT_REMEMBERED_SET,
2683 check_needed); 2683 check_needed);
2684 } 2684 }
2685 2685
2686 __ bind(&skip_assignment); 2686 __ bind(&skip_assignment);
2687 } 2687 }
2688 2688
2689 2689
2690 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 2690 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2691 int offset = instr->hydrogen()->offset();
2691 Register object = ToRegister(instr->object()); 2692 Register object = ToRegister(instr->object());
2692 if (!FLAG_track_double_fields) { 2693 if (instr->hydrogen()->representation().IsDouble()) {
2693 ASSERT(!instr->hydrogen()->representation().IsDouble()); 2694 DoubleRegister result = ToDoubleRegister(instr->result());
2694 } 2695 __ ldc1(result, FieldMemOperand(object, offset));
2695 Register temp = instr->hydrogen()->representation().IsDouble() 2696 return;
2696 ? scratch0() : ToRegister(instr->result());
2697 if (instr->hydrogen()->is_in_object()) {
2698 __ lw(temp, FieldMemOperand(object, instr->hydrogen()->offset()));
2699 } else {
2700 __ lw(temp, FieldMemOperand(object, JSObject::kPropertiesOffset));
2701 __ lw(temp, FieldMemOperand(temp, instr->hydrogen()->offset()));
2702 } 2697 }
2703 2698
2704 if (instr->hydrogen()->representation().IsDouble()) { 2699 Register result = ToRegister(instr->result());
2705 Label load_from_heap_number, done; 2700 if (instr->hydrogen()->is_in_object()) {
2706 DoubleRegister result = ToDoubleRegister(instr->result()); 2701 __ lw(result, FieldMemOperand(object, offset));
2707 FPURegister flt_scratch = double_scratch0().low(); 2702 } else {
2708 __ JumpIfNotSmi(temp, &load_from_heap_number); 2703 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
2709 __ SmiUntag(temp); 2704 __ lw(result, FieldMemOperand(result, offset));
2710 __ mtc1(temp, flt_scratch);
2711 __ cvt_d_w(result, flt_scratch);
2712 __ Branch(&done);
2713 __ bind(&load_from_heap_number);
2714 __ ldc1(result, FieldMemOperand(temp, HeapNumber::kValueOffset));
2715 __ bind(&done);
2716 } 2705 }
2717 } 2706 }
2718 2707
2719 2708
2720 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, 2709 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
2721 Register object, 2710 Register object,
2722 Handle<Map> type, 2711 Handle<Map> type,
2723 Handle<String> name, 2712 Handle<String> name,
2724 LEnvironment* env) { 2713 LEnvironment* env) {
2725 LookupResult lookup(isolate()); 2714 LookupResult lookup(isolate());
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
3904 Register result = ToRegister(instr->result()); 3893 Register result = ToRegister(instr->result());
3905 Register base = ToRegister(instr->base_object()); 3894 Register base = ToRegister(instr->base_object());
3906 __ Addu(result, base, Operand(instr->offset())); 3895 __ Addu(result, base, Operand(instr->offset()));
3907 } 3896 }
3908 3897
3909 3898
3910 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 3899 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3911 Representation representation = instr->representation(); 3900 Representation representation = instr->representation();
3912 3901
3913 Register object = ToRegister(instr->object()); 3902 Register object = ToRegister(instr->object());
3914 Register value = ToRegister(instr->value());
3915 ASSERT(!object.is(value));
3916 Register scratch = scratch0(); 3903 Register scratch = scratch0();
3917 int offset = instr->offset(); 3904 int offset = instr->offset();
3918 3905
3906 Handle<Map> transition = instr->transition();
3907
3919 if (FLAG_track_fields && representation.IsSmi()) { 3908 if (FLAG_track_fields && representation.IsSmi()) {
3909 Register value = ToRegister(instr->value());
3920 __ SmiTagCheckOverflow(value, value, scratch); 3910 __ SmiTagCheckOverflow(value, value, scratch);
3921 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) { 3911 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) {
3922 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); 3912 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg));
3923 } 3913 }
3924 } else if (FLAG_track_double_fields && representation.IsDouble() && 3914 } else if (FLAG_track_double_fields && representation.IsDouble()) {
3925 !instr->hydrogen()->value()->type().IsSmi() && 3915 ASSERT(transition.is_null());
3926 !instr->hydrogen()->value()->type().IsHeapNumber()) { 3916 ASSERT(instr->is_in_object());
3927 Label do_store; 3917 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3928 __ JumpIfSmi(value, &do_store); 3918 DoubleRegister value = ToDoubleRegister(instr->value());
3929 Handle<Map> map(isolate()->factory()->heap_number_map()); 3919 __ sdc1(value, FieldMemOperand(object, offset));
3930 3920 return;
3931 __ lw(scratch, FieldMemOperand(value, HeapObject::kMapOffset));
3932 DoCheckMapCommon(scratch, map, REQUIRE_EXACT_MAP, instr->environment());
3933 __ bind(&do_store);
3934 } 3921 }
3935 3922
3936 Handle<Map> transition = instr->transition();
3937 if (!transition.is_null()) { 3923 if (!transition.is_null()) {
3938 if (transition->CanBeDeprecated()) { 3924 if (transition->CanBeDeprecated()) {
3939 transition_maps_.Add(transition, info()->zone()); 3925 transition_maps_.Add(transition, info()->zone());
3940 } 3926 }
3941 __ li(scratch, Operand(transition)); 3927 __ li(scratch, Operand(transition));
3942 __ sw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); 3928 __ sw(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
3943 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { 3929 if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
3944 Register temp = ToRegister(instr->temp()); 3930 Register temp = ToRegister(instr->temp());
3945 // Update the write barrier for the map field. 3931 // Update the write barrier for the map field.
3946 __ RecordWriteField(object, 3932 __ RecordWriteField(object,
3947 HeapObject::kMapOffset, 3933 HeapObject::kMapOffset,
3948 scratch, 3934 scratch,
3949 temp, 3935 temp,
3950 GetRAState(), 3936 GetRAState(),
3951 kSaveFPRegs, 3937 kSaveFPRegs,
3952 OMIT_REMEMBERED_SET, 3938 OMIT_REMEMBERED_SET,
3953 OMIT_SMI_CHECK); 3939 OMIT_SMI_CHECK);
3954 } 3940 }
3955 } 3941 }
3956 3942
3957 // Do the store. 3943 // Do the store.
3944 Register value = ToRegister(instr->value());
3945 ASSERT(!object.is(value));
3958 HType type = instr->hydrogen()->value()->type(); 3946 HType type = instr->hydrogen()->value()->type();
3959 SmiCheck check_needed = 3947 SmiCheck check_needed =
3960 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 3948 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
3961 if (instr->is_in_object()) { 3949 if (instr->is_in_object()) {
3962 __ sw(value, FieldMemOperand(object, offset)); 3950 __ sw(value, FieldMemOperand(object, offset));
3963 if (instr->hydrogen()->NeedsWriteBarrier()) { 3951 if (instr->hydrogen()->NeedsWriteBarrier()) {
3964 // Update the write barrier for the object for in-object properties. 3952 // Update the write barrier for the object for in-object properties.
3965 __ RecordWriteField(object, 3953 __ RecordWriteField(object,
3966 offset, 3954 offset,
3967 value, 3955 value,
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
5259 __ LoadHeapObject(a3, literals); 5247 __ LoadHeapObject(a3, literals);
5260 __ li(a2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); 5248 __ li(a2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
5261 __ li(a1, Operand(constant_properties)); 5249 __ li(a1, Operand(constant_properties));
5262 int flags = instr->hydrogen()->fast_elements() 5250 int flags = instr->hydrogen()->fast_elements()
5263 ? ObjectLiteral::kFastElements 5251 ? ObjectLiteral::kFastElements
5264 : ObjectLiteral::kNoFlags; 5252 : ObjectLiteral::kNoFlags;
5265 __ li(a0, Operand(Smi::FromInt(flags))); 5253 __ li(a0, Operand(Smi::FromInt(flags)));
5266 5254
5267 // Pick the right runtime function or stub to call. 5255 // Pick the right runtime function or stub to call.
5268 int properties_count = instr->hydrogen()->constant_properties_length() / 2; 5256 int properties_count = instr->hydrogen()->constant_properties_length() / 2;
5269 if (instr->hydrogen()->depth() > 1) { 5257 if ((FLAG_track_double_fields && instr->hydrogen()->may_store_doubles()) ||
5258 instr->hydrogen()->depth() > 1) {
5270 __ Push(a3, a2, a1, a0); 5259 __ Push(a3, a2, a1, a0);
5271 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 5260 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
5272 } else if (flags != ObjectLiteral::kFastElements || 5261 } else if (flags != ObjectLiteral::kFastElements ||
5273 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 5262 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
5274 __ Push(a3, a2, a1, a0); 5263 __ Push(a3, a2, a1, a0);
5275 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 5264 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
5276 } else { 5265 } else {
5277 FastCloneShallowObjectStub stub(properties_count); 5266 FastCloneShallowObjectStub stub(properties_count);
5278 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 5267 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5279 } 5268 }
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
5754 __ Subu(scratch, result, scratch); 5743 __ Subu(scratch, result, scratch);
5755 __ lw(result, FieldMemOperand(scratch, 5744 __ lw(result, FieldMemOperand(scratch,
5756 FixedArray::kHeaderSize - kPointerSize)); 5745 FixedArray::kHeaderSize - kPointerSize));
5757 __ bind(&done); 5746 __ bind(&done);
5758 } 5747 }
5759 5748
5760 5749
5761 #undef __ 5750 #undef __
5762 5751
5763 } } // namespace v8::internal 5752 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/ic-mips.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698