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

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

Issue 14850006: Use mutable heapnumbers to store doubles in fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported to ARM and x64 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/arm/lithium-arm.cc ('k') | src/arm/stub-cache-arm.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 3039 matching lines...) Expand 10 before | Expand all | Expand 10 after
3050 kSaveFPRegs, 3050 kSaveFPRegs,
3051 EMIT_REMEMBERED_SET, 3051 EMIT_REMEMBERED_SET,
3052 check_needed); 3052 check_needed);
3053 } 3053 }
3054 3054
3055 __ bind(&skip_assignment); 3055 __ bind(&skip_assignment);
3056 } 3056 }
3057 3057
3058 3058
3059 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 3059 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
3060 int offset = instr->hydrogen()->offset();
3060 Register object = ToRegister(instr->object()); 3061 Register object = ToRegister(instr->object());
3061 if (!FLAG_track_double_fields) { 3062 if (instr->hydrogen()->representation().IsDouble()) {
3062 ASSERT(!instr->hydrogen()->representation().IsDouble()); 3063 DwVfpRegister result = ToDoubleRegister(instr->result());
3063 } 3064 __ vldr(result, FieldMemOperand(object, offset));
3064 Register temp = instr->hydrogen()->representation().IsDouble() 3065 return;
3065 ? scratch0() : ToRegister(instr->result());
3066 if (instr->hydrogen()->is_in_object()) {
3067 __ ldr(temp, FieldMemOperand(object, instr->hydrogen()->offset()));
3068 } else {
3069 __ ldr(temp, FieldMemOperand(object, JSObject::kPropertiesOffset));
3070 __ ldr(temp, FieldMemOperand(temp, instr->hydrogen()->offset()));
3071 } 3066 }
3072 3067
3073 if (instr->hydrogen()->representation().IsDouble()) { 3068 Register result = ToRegister(instr->result());
3074 Label load_from_heap_number, done; 3069 if (instr->hydrogen()->is_in_object()) {
3075 DwVfpRegister result = ToDoubleRegister(instr->result()); 3070 __ ldr(result, FieldMemOperand(object, offset));
3076 SwVfpRegister flt_scratch = double_scratch0().low(); 3071 } else {
3077 __ JumpIfNotSmi(temp, &load_from_heap_number); 3072 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
3078 __ SmiUntag(temp); 3073 __ ldr(result, FieldMemOperand(result, offset));
3079 __ vmov(flt_scratch, temp);
3080 __ vcvt_f64_s32(result, flt_scratch);
3081 __ b(&done);
3082 __ bind(&load_from_heap_number);
3083 __ vldr(result, FieldMemOperand(temp, HeapNumber::kValueOffset));
3084 __ bind(&done);
3085 } 3074 }
3086 } 3075 }
3087 3076
3088 3077
3089 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, 3078 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
3090 Register object, 3079 Register object,
3091 Handle<Map> type, 3080 Handle<Map> type,
3092 Handle<String> name, 3081 Handle<String> name,
3093 LEnvironment* env) { 3082 LEnvironment* env) {
3094 LookupResult lookup(isolate()); 3083 LookupResult lookup(isolate());
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
4223 Register result = ToRegister(instr->result()); 4212 Register result = ToRegister(instr->result());
4224 Register base = ToRegister(instr->base_object()); 4213 Register base = ToRegister(instr->base_object());
4225 __ add(result, base, Operand(instr->offset())); 4214 __ add(result, base, Operand(instr->offset()));
4226 } 4215 }
4227 4216
4228 4217
4229 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 4218 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
4230 Representation representation = instr->representation(); 4219 Representation representation = instr->representation();
4231 4220
4232 Register object = ToRegister(instr->object()); 4221 Register object = ToRegister(instr->object());
4233 Register value = ToRegister(instr->value());
4234 ASSERT(!object.is(value));
4235 Register scratch = scratch0(); 4222 Register scratch = scratch0();
4236 int offset = instr->offset(); 4223 int offset = instr->offset();
4237 4224
4225 Handle<Map> transition = instr->transition();
4226
4238 if (FLAG_track_fields && representation.IsSmi()) { 4227 if (FLAG_track_fields && representation.IsSmi()) {
4228 Register value = ToRegister(instr->value());
4239 __ SmiTag(value, value, SetCC); 4229 __ SmiTag(value, value, SetCC);
4240 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) { 4230 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) {
4241 DeoptimizeIf(vs, instr->environment()); 4231 DeoptimizeIf(vs, instr->environment());
4242 } 4232 }
4243 } else if (FLAG_track_double_fields && representation.IsDouble() && 4233 } else if (FLAG_track_double_fields && representation.IsDouble()) {
4244 !instr->hydrogen()->value()->type().IsSmi() && 4234 ASSERT(transition.is_null());
4245 !instr->hydrogen()->value()->type().IsHeapNumber()) { 4235 ASSERT(instr->is_in_object());
4246 Label do_store; 4236 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
4247 __ JumpIfSmi(value, &do_store); 4237 DwVfpRegister value = ToDoubleRegister(instr->value());
4248 Handle<Map> map(isolate()->factory()->heap_number_map()); 4238 __ vstr(value, FieldMemOperand(object, offset));
4249 4239 return;
4250 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset));
4251 DoCheckMapCommon(scratch, map, REQUIRE_EXACT_MAP, instr->environment());
4252 __ bind(&do_store);
4253 } 4240 }
4254 4241
4255 Handle<Map> transition = instr->transition();
4256 if (!transition.is_null()) { 4242 if (!transition.is_null()) {
4257 if (transition->CanBeDeprecated()) { 4243 if (transition->CanBeDeprecated()) {
4258 transition_maps_.Add(transition, info()->zone()); 4244 transition_maps_.Add(transition, info()->zone());
4259 } 4245 }
4260 __ mov(scratch, Operand(transition)); 4246 __ mov(scratch, Operand(transition));
4261 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); 4247 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
4262 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { 4248 if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
4263 Register temp = ToRegister(instr->temp()); 4249 Register temp = ToRegister(instr->temp());
4264 // Update the write barrier for the map field. 4250 // Update the write barrier for the map field.
4265 __ RecordWriteField(object, 4251 __ RecordWriteField(object,
4266 HeapObject::kMapOffset, 4252 HeapObject::kMapOffset,
4267 scratch, 4253 scratch,
4268 temp, 4254 temp,
4269 GetLinkRegisterState(), 4255 GetLinkRegisterState(),
4270 kSaveFPRegs, 4256 kSaveFPRegs,
4271 OMIT_REMEMBERED_SET, 4257 OMIT_REMEMBERED_SET,
4272 OMIT_SMI_CHECK); 4258 OMIT_SMI_CHECK);
4273 } 4259 }
4274 } 4260 }
4275 4261
4276 // Do the store. 4262 // Do the store.
4263 Register value = ToRegister(instr->value());
4264 ASSERT(!object.is(value));
4277 HType type = instr->hydrogen()->value()->type(); 4265 HType type = instr->hydrogen()->value()->type();
4278 SmiCheck check_needed = 4266 SmiCheck check_needed =
4279 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4267 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4280 if (instr->is_in_object()) { 4268 if (instr->is_in_object()) {
4281 __ str(value, FieldMemOperand(object, offset)); 4269 __ str(value, FieldMemOperand(object, offset));
4282 if (instr->hydrogen()->NeedsWriteBarrier()) { 4270 if (instr->hydrogen()->NeedsWriteBarrier()) {
4283 // Update the write barrier for the object for in-object properties. 4271 // Update the write barrier for the object for in-object properties.
4284 __ RecordWriteField(object, 4272 __ RecordWriteField(object,
4285 offset, 4273 offset,
4286 value, 4274 value,
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
5555 __ LoadHeapObject(r3, literals); 5543 __ LoadHeapObject(r3, literals);
5556 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); 5544 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
5557 __ mov(r1, Operand(constant_properties)); 5545 __ mov(r1, Operand(constant_properties));
5558 int flags = instr->hydrogen()->fast_elements() 5546 int flags = instr->hydrogen()->fast_elements()
5559 ? ObjectLiteral::kFastElements 5547 ? ObjectLiteral::kFastElements
5560 : ObjectLiteral::kNoFlags; 5548 : ObjectLiteral::kNoFlags;
5561 __ mov(r0, Operand(Smi::FromInt(flags))); 5549 __ mov(r0, Operand(Smi::FromInt(flags)));
5562 5550
5563 // Pick the right runtime function or stub to call. 5551 // Pick the right runtime function or stub to call.
5564 int properties_count = instr->hydrogen()->constant_properties_length() / 2; 5552 int properties_count = instr->hydrogen()->constant_properties_length() / 2;
5565 if (instr->hydrogen()->depth() > 1) { 5553 if ((FLAG_track_double_fields && instr->hydrogen()->may_store_doubles()) ||
5554 instr->hydrogen()->depth() > 1) {
5566 __ Push(r3, r2, r1, r0); 5555 __ Push(r3, r2, r1, r0);
5567 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 5556 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
5568 } else if (flags != ObjectLiteral::kFastElements || 5557 } else if (flags != ObjectLiteral::kFastElements ||
5569 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 5558 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
5570 __ Push(r3, r2, r1, r0); 5559 __ Push(r3, r2, r1, r0);
5571 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 5560 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
5572 } else { 5561 } else {
5573 FastCloneShallowObjectStub stub(properties_count); 5562 FastCloneShallowObjectStub stub(properties_count);
5574 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 5563 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
5575 } 5564 }
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
6009 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 5998 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
6010 __ ldr(result, FieldMemOperand(scratch, 5999 __ ldr(result, FieldMemOperand(scratch,
6011 FixedArray::kHeaderSize - kPointerSize)); 6000 FixedArray::kHeaderSize - kPointerSize));
6012 __ bind(&done); 6001 __ bind(&done);
6013 } 6002 }
6014 6003
6015 6004
6016 #undef __ 6005 #undef __
6017 6006
6018 } } // namespace v8::internal 6007 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698