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

Side by Side Diff: src/x64/lithium-codegen-x64.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 | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/macro-assembler-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/x64/lithium-codegen-x64.h" 9 #include "src/x64/lithium-codegen-x64.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 4006 matching lines...) Expand 10 before | Expand all | Expand 10 after
4017 if (hinstr->has_transition()) { 4017 if (hinstr->has_transition()) {
4018 Handle<Map> transition = hinstr->transition_map(); 4018 Handle<Map> transition = hinstr->transition_map();
4019 AddDeprecationDependency(transition); 4019 AddDeprecationDependency(transition);
4020 if (!hinstr->NeedsWriteBarrierForMap()) { 4020 if (!hinstr->NeedsWriteBarrierForMap()) {
4021 __ Move(FieldOperand(object, HeapObject::kMapOffset), transition); 4021 __ Move(FieldOperand(object, HeapObject::kMapOffset), transition);
4022 } else { 4022 } else {
4023 Register temp = ToRegister(instr->temp()); 4023 Register temp = ToRegister(instr->temp());
4024 __ Move(kScratchRegister, transition); 4024 __ Move(kScratchRegister, transition);
4025 __ movp(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister); 4025 __ movp(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister);
4026 // Update the write barrier for the map field. 4026 // Update the write barrier for the map field.
4027 __ RecordWriteField(object, 4027 __ RecordWriteForMap(object,
4028 HeapObject::kMapOffset, 4028 kScratchRegister,
4029 kScratchRegister, 4029 temp,
4030 temp, 4030 kSaveFPRegs);
4031 kSaveFPRegs,
4032 OMIT_REMEMBERED_SET,
4033 OMIT_SMI_CHECK);
4034 } 4031 }
4035 } 4032 }
4036 4033
4037 // Do the store. 4034 // Do the store.
4038 Register write_register = object; 4035 Register write_register = object;
4039 if (!access.IsInobject()) { 4036 if (!access.IsInobject()) {
4040 write_register = ToRegister(instr->temp()); 4037 write_register = ToRegister(instr->temp());
4041 __ movp(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); 4038 __ movp(write_register, FieldOperand(object, JSObject::kPropertiesOffset));
4042 } 4039 }
4043 4040
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4083 if (hinstr->NeedsWriteBarrier()) { 4080 if (hinstr->NeedsWriteBarrier()) {
4084 Register value = ToRegister(instr->value()); 4081 Register value = ToRegister(instr->value());
4085 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; 4082 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object;
4086 // Update the write barrier for the object for in-object properties. 4083 // Update the write barrier for the object for in-object properties.
4087 __ RecordWriteField(write_register, 4084 __ RecordWriteField(write_register,
4088 offset, 4085 offset,
4089 value, 4086 value,
4090 temp, 4087 temp,
4091 kSaveFPRegs, 4088 kSaveFPRegs,
4092 EMIT_REMEMBERED_SET, 4089 EMIT_REMEMBERED_SET,
4093 hinstr->SmiCheckForWriteBarrier()); 4090 hinstr->SmiCheckForWriteBarrier(),
4091 hinstr->PointersToHereCheckForValue());
4094 } 4092 }
4095 } 4093 }
4096 4094
4097 4095
4098 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { 4096 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
4099 ASSERT(ToRegister(instr->context()).is(rsi)); 4097 ASSERT(ToRegister(instr->context()).is(rsi));
4100 ASSERT(ToRegister(instr->object()).is(rdx)); 4098 ASSERT(ToRegister(instr->object()).is(rdx));
4101 ASSERT(ToRegister(instr->value()).is(rax)); 4099 ASSERT(ToRegister(instr->value()).is(rax));
4102 4100
4103 __ Move(rcx, instr->hydrogen()->name()); 4101 __ Move(rcx, instr->hydrogen()->name());
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4308 SmiCheck check_needed = hinstr->value()->type().IsHeapObject() 4306 SmiCheck check_needed = hinstr->value()->type().IsHeapObject()
4309 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4307 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4310 // Compute address of modified element and store it into key register. 4308 // Compute address of modified element and store it into key register.
4311 Register key_reg(ToRegister(key)); 4309 Register key_reg(ToRegister(key));
4312 __ leap(key_reg, operand); 4310 __ leap(key_reg, operand);
4313 __ RecordWrite(elements, 4311 __ RecordWrite(elements,
4314 key_reg, 4312 key_reg,
4315 value, 4313 value,
4316 kSaveFPRegs, 4314 kSaveFPRegs,
4317 EMIT_REMEMBERED_SET, 4315 EMIT_REMEMBERED_SET,
4318 check_needed); 4316 check_needed,
4317 hinstr->PointersToHereCheckForValue());
4319 } 4318 }
4320 } 4319 }
4321 4320
4322 4321
4323 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4322 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4324 if (instr->is_typed_elements()) { 4323 if (instr->is_typed_elements()) {
4325 DoStoreKeyedExternalArray(instr); 4324 DoStoreKeyedExternalArray(instr);
4326 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4325 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4327 DoStoreKeyedFixedDoubleArray(instr); 4326 DoStoreKeyedFixedDoubleArray(instr);
4328 } else { 4327 } else {
(...skipping 24 matching lines...) Expand all
4353 ElementsKind to_kind = instr->to_kind(); 4352 ElementsKind to_kind = instr->to_kind();
4354 4353
4355 Label not_applicable; 4354 Label not_applicable;
4356 __ Cmp(FieldOperand(object_reg, HeapObject::kMapOffset), from_map); 4355 __ Cmp(FieldOperand(object_reg, HeapObject::kMapOffset), from_map);
4357 __ j(not_equal, &not_applicable); 4356 __ j(not_equal, &not_applicable);
4358 if (IsSimpleMapChangeTransition(from_kind, to_kind)) { 4357 if (IsSimpleMapChangeTransition(from_kind, to_kind)) {
4359 Register new_map_reg = ToRegister(instr->new_map_temp()); 4358 Register new_map_reg = ToRegister(instr->new_map_temp());
4360 __ Move(new_map_reg, to_map, RelocInfo::EMBEDDED_OBJECT); 4359 __ Move(new_map_reg, to_map, RelocInfo::EMBEDDED_OBJECT);
4361 __ movp(FieldOperand(object_reg, HeapObject::kMapOffset), new_map_reg); 4360 __ movp(FieldOperand(object_reg, HeapObject::kMapOffset), new_map_reg);
4362 // Write barrier. 4361 // Write barrier.
4363 ASSERT_NE(instr->temp(), NULL); 4362 __ RecordWriteForMap(object_reg, new_map_reg, ToRegister(instr->temp()),
4364 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, 4363 kDontSaveFPRegs);
4365 ToRegister(instr->temp()), kDontSaveFPRegs);
4366 } else { 4364 } else {
4367 ASSERT(object_reg.is(rax)); 4365 ASSERT(object_reg.is(rax));
4368 ASSERT(ToRegister(instr->context()).is(rsi)); 4366 ASSERT(ToRegister(instr->context()).is(rsi));
4369 PushSafepointRegistersScope scope(this); 4367 PushSafepointRegistersScope scope(this);
4370 __ Move(rbx, to_map); 4368 __ Move(rbx, to_map);
4371 bool is_js_array = from_map->instance_type() == JS_ARRAY_TYPE; 4369 bool is_js_array = from_map->instance_type() == JS_ARRAY_TYPE;
4372 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); 4370 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array);
4373 __ CallStub(&stub); 4371 __ CallStub(&stub);
4374 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0); 4372 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0);
4375 } 4373 }
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
5685 __ bind(deferred->exit()); 5683 __ bind(deferred->exit());
5686 __ bind(&done); 5684 __ bind(&done);
5687 } 5685 }
5688 5686
5689 5687
5690 #undef __ 5688 #undef __
5691 5689
5692 } } // namespace v8::internal 5690 } } // namespace v8::internal
5693 5691
5694 #endif // V8_TARGET_ARCH_X64 5692 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698