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

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

Issue 10544005: Optimize write barrier of map-only elements transitions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 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/assembler.cc ('k') | src/ia32/macro-assembler-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 3554 matching lines...) Expand 10 before | Expand all | Expand 10 after
3565 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { 3565 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
3566 Register object_reg = ToRegister(instr->object()); 3566 Register object_reg = ToRegister(instr->object());
3567 Register new_map_reg = ToRegister(instr->new_map_reg()); 3567 Register new_map_reg = ToRegister(instr->new_map_reg());
3568 3568
3569 Handle<Map> from_map = instr->original_map(); 3569 Handle<Map> from_map = instr->original_map();
3570 Handle<Map> to_map = instr->transitioned_map(); 3570 Handle<Map> to_map = instr->transitioned_map();
3571 ElementsKind from_kind = from_map->elements_kind(); 3571 ElementsKind from_kind = from_map->elements_kind();
3572 ElementsKind to_kind = to_map->elements_kind(); 3572 ElementsKind to_kind = to_map->elements_kind();
3573 3573
3574 Label not_applicable; 3574 Label not_applicable;
3575 bool is_simple_map_transition =
3576 IsSimpleMapChangeTransition(from_kind, to_kind);
3577 Label::Distance branch_distance =
3578 is_simple_map_transition ? Label::kNear : Label::kFar;
3575 __ cmp(FieldOperand(object_reg, HeapObject::kMapOffset), from_map); 3579 __ cmp(FieldOperand(object_reg, HeapObject::kMapOffset), from_map);
3576 __ j(not_equal, &not_applicable); 3580 __ j(not_equal, &not_applicable, branch_distance);
3577 __ mov(new_map_reg, to_map); 3581 if (is_simple_map_transition) {
3578 if (IsSimpleMapChangeTransition(from_kind, to_kind)) {
3579 Register object_reg = ToRegister(instr->object()); 3582 Register object_reg = ToRegister(instr->object());
3580 __ mov(FieldOperand(object_reg, HeapObject::kMapOffset), new_map_reg); 3583 Handle<Map> map = instr->hydrogen()->transitioned_map();
3584 __ mov(FieldOperand(object_reg, HeapObject::kMapOffset),
3585 Immediate(map));
3581 // Write barrier. 3586 // Write barrier.
3582 ASSERT_NE(instr->temp_reg(), NULL); 3587 ASSERT_NE(instr->temp_reg(), NULL);
3583 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, 3588 __ RecordWriteForMap(object_reg, to_map, new_map_reg,
3584 ToRegister(instr->temp_reg()), kDontSaveFPRegs); 3589 ToRegister(instr->temp_reg()),
3590 kDontSaveFPRegs);
3585 } else if (IsFastSmiElementsKind(from_kind) && 3591 } else if (IsFastSmiElementsKind(from_kind) &&
3586 IsFastDoubleElementsKind(to_kind)) { 3592 IsFastDoubleElementsKind(to_kind)) {
3593 __ mov(new_map_reg, to_map);
3587 Register fixed_object_reg = ToRegister(instr->temp_reg()); 3594 Register fixed_object_reg = ToRegister(instr->temp_reg());
3588 ASSERT(fixed_object_reg.is(edx)); 3595 ASSERT(fixed_object_reg.is(edx));
3589 ASSERT(new_map_reg.is(ebx)); 3596 ASSERT(new_map_reg.is(ebx));
3590 __ mov(fixed_object_reg, object_reg); 3597 __ mov(fixed_object_reg, object_reg);
3591 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(), 3598 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(),
3592 RelocInfo::CODE_TARGET, instr); 3599 RelocInfo::CODE_TARGET, instr);
3593 } else if (IsFastDoubleElementsKind(from_kind) && 3600 } else if (IsFastDoubleElementsKind(from_kind) &&
3594 IsFastObjectElementsKind(to_kind)) { 3601 IsFastObjectElementsKind(to_kind)) {
3602 __ mov(new_map_reg, to_map);
3595 Register fixed_object_reg = ToRegister(instr->temp_reg()); 3603 Register fixed_object_reg = ToRegister(instr->temp_reg());
3596 ASSERT(fixed_object_reg.is(edx)); 3604 ASSERT(fixed_object_reg.is(edx));
3597 ASSERT(new_map_reg.is(ebx)); 3605 ASSERT(new_map_reg.is(ebx));
3598 __ mov(fixed_object_reg, object_reg); 3606 __ mov(fixed_object_reg, object_reg);
3599 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(), 3607 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(),
3600 RelocInfo::CODE_TARGET, instr); 3608 RelocInfo::CODE_TARGET, instr);
3601 } else { 3609 } else {
3602 UNREACHABLE(); 3610 UNREACHABLE();
3603 } 3611 }
3604 __ bind(&not_applicable); 3612 __ bind(&not_applicable);
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
5095 FixedArray::kHeaderSize - kPointerSize)); 5103 FixedArray::kHeaderSize - kPointerSize));
5096 __ bind(&done); 5104 __ bind(&done);
5097 } 5105 }
5098 5106
5099 5107
5100 #undef __ 5108 #undef __
5101 5109
5102 } } // namespace v8::internal 5110 } } // namespace v8::internal
5103 5111
5104 #endif // V8_TARGET_ARCH_IA32 5112 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698