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

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

Issue 297763006: Improve write barriers in optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 6 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 | « no previous file | src/arm/macro-assembler-arm.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arm/lithium-codegen-arm.h" 7 #include "src/arm/lithium-codegen-arm.h"
8 #include "src/arm/lithium-gap-resolver-arm.h" 8 #include "src/arm/lithium-gap-resolver-arm.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/stub-cache.h" 10 #include "src/stub-cache.h"
(...skipping 4066 matching lines...) Expand 10 before | Expand all | Expand 10 after
4077 } 4077 }
4078 4078
4079 if (instr->hydrogen()->has_transition()) { 4079 if (instr->hydrogen()->has_transition()) {
4080 Handle<Map> transition = instr->hydrogen()->transition_map(); 4080 Handle<Map> transition = instr->hydrogen()->transition_map();
4081 AddDeprecationDependency(transition); 4081 AddDeprecationDependency(transition);
4082 __ mov(scratch, Operand(transition)); 4082 __ mov(scratch, Operand(transition));
4083 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); 4083 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
4084 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { 4084 if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
4085 Register temp = ToRegister(instr->temp()); 4085 Register temp = ToRegister(instr->temp());
4086 // Update the write barrier for the map field. 4086 // Update the write barrier for the map field.
4087 __ RecordWriteField(object, 4087 __ RecordWriteForMap(object,
4088 HeapObject::kMapOffset, 4088 scratch,
4089 scratch, 4089 temp,
4090 temp, 4090 GetLinkRegisterState(),
4091 GetLinkRegisterState(), 4091 kSaveFPRegs);
4092 kSaveFPRegs,
4093 OMIT_REMEMBERED_SET,
4094 OMIT_SMI_CHECK);
4095 } 4092 }
4096 } 4093 }
4097 4094
4098 // Do the store. 4095 // Do the store.
4099 Register value = ToRegister(instr->value()); 4096 Register value = ToRegister(instr->value());
4100 if (access.IsInobject()) { 4097 if (access.IsInobject()) {
4101 MemOperand operand = FieldMemOperand(object, offset); 4098 MemOperand operand = FieldMemOperand(object, offset);
4102 __ Store(value, operand, representation); 4099 __ Store(value, operand, representation);
4103 if (instr->hydrogen()->NeedsWriteBarrier()) { 4100 if (instr->hydrogen()->NeedsWriteBarrier()) {
4104 // Update the write barrier for the object for in-object properties. 4101 // Update the write barrier for the object for in-object properties.
4105 __ RecordWriteField(object, 4102 __ RecordWriteField(object,
4106 offset, 4103 offset,
4107 value, 4104 value,
4108 scratch, 4105 scratch,
4109 GetLinkRegisterState(), 4106 GetLinkRegisterState(),
4110 kSaveFPRegs, 4107 kSaveFPRegs,
4111 EMIT_REMEMBERED_SET, 4108 EMIT_REMEMBERED_SET,
4112 instr->hydrogen()->SmiCheckForWriteBarrier()); 4109 instr->hydrogen()->SmiCheckForWriteBarrier(),
4110 instr->hydrogen()->PointersToHereCheckForValue());
4113 } 4111 }
4114 } else { 4112 } else {
4115 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); 4113 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
4116 MemOperand operand = FieldMemOperand(scratch, offset); 4114 MemOperand operand = FieldMemOperand(scratch, offset);
4117 __ Store(value, operand, representation); 4115 __ Store(value, operand, representation);
4118 if (instr->hydrogen()->NeedsWriteBarrier()) { 4116 if (instr->hydrogen()->NeedsWriteBarrier()) {
4119 // Update the write barrier for the properties array. 4117 // Update the write barrier for the properties array.
4120 // object is used as a scratch register. 4118 // object is used as a scratch register.
4121 __ RecordWriteField(scratch, 4119 __ RecordWriteField(scratch,
4122 offset, 4120 offset,
4123 value, 4121 value,
4124 object, 4122 object,
4125 GetLinkRegisterState(), 4123 GetLinkRegisterState(),
4126 kSaveFPRegs, 4124 kSaveFPRegs,
4127 EMIT_REMEMBERED_SET, 4125 EMIT_REMEMBERED_SET,
4128 instr->hydrogen()->SmiCheckForWriteBarrier()); 4126 instr->hydrogen()->SmiCheckForWriteBarrier(),
4127 instr->hydrogen()->PointersToHereCheckForValue());
4129 } 4128 }
4130 } 4129 }
4131 } 4130 }
4132 4131
4133 4132
4134 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { 4133 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
4135 ASSERT(ToRegister(instr->context()).is(cp)); 4134 ASSERT(ToRegister(instr->context()).is(cp));
4136 ASSERT(ToRegister(instr->object()).is(r1)); 4135 ASSERT(ToRegister(instr->object()).is(r1));
4137 ASSERT(ToRegister(instr->value()).is(r0)); 4136 ASSERT(ToRegister(instr->value()).is(r0));
4138 4137
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
4328 instr->hydrogen()->value()->type().IsHeapObject() 4327 instr->hydrogen()->value()->type().IsHeapObject()
4329 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4328 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4330 // Compute address of modified element and store it into key register. 4329 // Compute address of modified element and store it into key register.
4331 __ add(key, store_base, Operand(offset)); 4330 __ add(key, store_base, Operand(offset));
4332 __ RecordWrite(elements, 4331 __ RecordWrite(elements,
4333 key, 4332 key,
4334 value, 4333 value,
4335 GetLinkRegisterState(), 4334 GetLinkRegisterState(),
4336 kSaveFPRegs, 4335 kSaveFPRegs,
4337 EMIT_REMEMBERED_SET, 4336 EMIT_REMEMBERED_SET,
4338 check_needed); 4337 check_needed,
4338 instr->hydrogen()->PointersToHereCheckForValue());
4339 } 4339 }
4340 } 4340 }
4341 4341
4342 4342
4343 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4343 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4344 // By cases: external, fast double 4344 // By cases: external, fast double
4345 if (instr->is_typed_elements()) { 4345 if (instr->is_typed_elements()) {
4346 DoStoreKeyedExternalArray(instr); 4346 DoStoreKeyedExternalArray(instr);
4347 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4347 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4348 DoStoreKeyedFixedDoubleArray(instr); 4348 DoStoreKeyedFixedDoubleArray(instr);
(...skipping 28 matching lines...) Expand all
4377 Label not_applicable; 4377 Label not_applicable;
4378 __ ldr(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset)); 4378 __ ldr(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset));
4379 __ cmp(scratch, Operand(from_map)); 4379 __ cmp(scratch, Operand(from_map));
4380 __ b(ne, &not_applicable); 4380 __ b(ne, &not_applicable);
4381 4381
4382 if (IsSimpleMapChangeTransition(from_kind, to_kind)) { 4382 if (IsSimpleMapChangeTransition(from_kind, to_kind)) {
4383 Register new_map_reg = ToRegister(instr->new_map_temp()); 4383 Register new_map_reg = ToRegister(instr->new_map_temp());
4384 __ mov(new_map_reg, Operand(to_map)); 4384 __ mov(new_map_reg, Operand(to_map));
4385 __ str(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); 4385 __ str(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset));
4386 // Write barrier. 4386 // Write barrier.
4387 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, 4387 __ RecordWriteForMap(object_reg,
4388 scratch, GetLinkRegisterState(), kDontSaveFPRegs); 4388 new_map_reg,
4389 scratch,
4390 GetLinkRegisterState(),
4391 kDontSaveFPRegs);
4389 } else { 4392 } else {
4390 ASSERT(ToRegister(instr->context()).is(cp)); 4393 ASSERT(ToRegister(instr->context()).is(cp));
4391 ASSERT(object_reg.is(r0)); 4394 ASSERT(object_reg.is(r0));
4392 PushSafepointRegistersScope scope( 4395 PushSafepointRegistersScope scope(
4393 this, Safepoint::kWithRegistersAndDoubles); 4396 this, Safepoint::kWithRegistersAndDoubles);
4394 __ Move(r1, to_map); 4397 __ Move(r1, to_map);
4395 bool is_js_array = from_map->instance_type() == JS_ARRAY_TYPE; 4398 bool is_js_array = from_map->instance_type() == JS_ARRAY_TYPE;
4396 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); 4399 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array);
4397 __ CallStub(&stub); 4400 __ CallStub(&stub);
4398 RecordSafepointWithRegistersAndDoubles( 4401 RecordSafepointWithRegistersAndDoubles(
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
5811 __ ldr(result, FieldMemOperand(scratch, 5814 __ ldr(result, FieldMemOperand(scratch,
5812 FixedArray::kHeaderSize - kPointerSize)); 5815 FixedArray::kHeaderSize - kPointerSize));
5813 __ bind(deferred->exit()); 5816 __ bind(deferred->exit());
5814 __ bind(&done); 5817 __ bind(&done);
5815 } 5818 }
5816 5819
5817 5820
5818 #undef __ 5821 #undef __
5819 5822
5820 } } // namespace v8::internal 5823 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698