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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 443873002: Hydrogenize (and share) StoreField except heapobject (for now). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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/field-index.h ('k') | src/ic.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 // 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_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic-inl.h" 10 #include "src/ic-inl.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // but may be destroyed if store is successful. 572 // but may be destroyed if store is successful.
573 void NamedStoreHandlerCompiler::GenerateStoreField( 573 void NamedStoreHandlerCompiler::GenerateStoreField(
574 Handle<JSObject> object, LookupResult* lookup, Register receiver_reg, 574 Handle<JSObject> object, LookupResult* lookup, Register receiver_reg,
575 Register name_reg, Register value_reg, Register scratch1, Register scratch2, 575 Register name_reg, Register value_reg, Register scratch1, Register scratch2,
576 Label* miss_label) { 576 Label* miss_label) {
577 // Stub never generated for objects that require access checks. 577 // Stub never generated for objects that require access checks.
578 DCHECK(!object->IsAccessCheckNeeded()); 578 DCHECK(!object->IsAccessCheckNeeded());
579 DCHECK(!object->IsJSGlobalProxy()); 579 DCHECK(!object->IsJSGlobalProxy());
580 580
581 FieldIndex index = lookup->GetFieldIndex(); 581 FieldIndex index = lookup->GetFieldIndex();
582 582 DCHECK(lookup->representation().IsHeapObject());
583 Representation representation = lookup->representation(); 583 __ JumpIfSmi(value_reg, miss_label);
584 DCHECK(!representation.IsNone()); 584 HeapType* field_type = lookup->GetFieldType();
585 if (representation.IsSmi()) { 585 HeapType::Iterator<Map> it = field_type->Classes();
586 __ JumpIfNotSmi(value_reg, miss_label); 586 if (!it.Done()) {
587 } else if (representation.IsHeapObject()) { 587 Label do_store;
588 __ JumpIfSmi(value_reg, miss_label); 588 while (true) {
589 HeapType* field_type = lookup->GetFieldType(); 589 __ CompareMap(value_reg, it.Current());
590 HeapType::Iterator<Map> it = field_type->Classes(); 590 it.Advance();
591 if (!it.Done()) { 591 if (it.Done()) {
592 Label do_store; 592 __ j(not_equal, miss_label);
593 while (true) { 593 break;
594 __ CompareMap(value_reg, it.Current());
595 it.Advance();
596 if (it.Done()) {
597 __ j(not_equal, miss_label);
598 break;
599 }
600 __ j(equal, &do_store, Label::kNear);
601 } 594 }
602 __ bind(&do_store); 595 __ j(equal, &do_store, Label::kNear);
603 } 596 }
604 } else if (representation.IsDouble()) {
605 // Load the double storage.
606 if (index.is_inobject()) {
607 __ mov(scratch1, FieldOperand(receiver_reg, index.offset()));
608 } else {
609 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset));
610 __ mov(scratch1, FieldOperand(scratch1, index.offset()));
611 }
612
613 // Store the value into the storage.
614 Label do_store, heap_number;
615 __ JumpIfNotSmi(value_reg, &heap_number);
616 __ SmiUntag(value_reg);
617 __ Cvtsi2sd(xmm0, value_reg);
618 __ SmiTag(value_reg);
619 __ jmp(&do_store);
620 __ bind(&heap_number);
621 __ CheckMap(value_reg, isolate()->factory()->heap_number_map(), miss_label,
622 DONT_DO_SMI_CHECK);
623 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset));
624 __ bind(&do_store); 597 __ bind(&do_store);
625 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0);
626 // Return the value (register eax).
627 DCHECK(value_reg.is(eax));
628 __ ret(0);
629 return;
630 } 598 }
631 599
632 DCHECK(!representation.IsDouble());
633 // TODO(verwaest): Share this code as a code stub.
634 SmiCheck smi_check = representation.IsTagged()
635 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
636 if (index.is_inobject()) { 600 if (index.is_inobject()) {
637 // Set the property straight into the object. 601 // Set the property straight into the object.
638 __ mov(FieldOperand(receiver_reg, index.offset()), value_reg); 602 __ mov(FieldOperand(receiver_reg, index.offset()), value_reg);
639 603
640 if (!representation.IsSmi()) { 604 // Update the write barrier for the array address.
641 // Update the write barrier for the array address. 605 // Pass the value being stored in the now unused name_reg.
642 // Pass the value being stored in the now unused name_reg. 606 __ mov(name_reg, value_reg);
643 __ mov(name_reg, value_reg); 607 __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1,
644 __ RecordWriteField(receiver_reg, 608 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
645 index.offset(),
646 name_reg,
647 scratch1,
648 kDontSaveFPRegs,
649 EMIT_REMEMBERED_SET,
650 smi_check);
651 }
652 } else { 609 } else {
653 // Write to the properties array. 610 // Write to the properties array.
654 // Get the properties array (optimistically). 611 // Get the properties array (optimistically).
655 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); 612 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset));
656 __ mov(FieldOperand(scratch1, index.offset()), value_reg); 613 __ mov(FieldOperand(scratch1, index.offset()), value_reg);
657 614
658 if (!representation.IsSmi()) { 615 // Update the write barrier for the array address.
659 // Update the write barrier for the array address. 616 // Pass the value being stored in the now unused name_reg.
660 // Pass the value being stored in the now unused name_reg. 617 __ mov(name_reg, value_reg);
661 __ mov(name_reg, value_reg); 618 __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg,
662 __ RecordWriteField(scratch1, 619 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
663 index.offset(),
664 name_reg,
665 receiver_reg,
666 kDontSaveFPRegs,
667 EMIT_REMEMBERED_SET,
668 smi_check);
669 }
670 } 620 }
671 621
672 // Return the value (register eax). 622 // Return the value (register eax).
673 DCHECK(value_reg.is(eax)); 623 DCHECK(value_reg.is(eax));
674 __ ret(0); 624 __ ret(0);
675 } 625 }
676 626
677 627
678 Register PropertyHandlerCompiler::CheckPrototypes( 628 Register PropertyHandlerCompiler::CheckPrototypes(
679 Register object_reg, Register holder_reg, Register scratch1, 629 Register object_reg, Register holder_reg, Register scratch1,
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 // ----------------------------------- 1226 // -----------------------------------
1277 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 1227 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
1278 } 1228 }
1279 1229
1280 1230
1281 #undef __ 1231 #undef __
1282 1232
1283 } } // namespace v8::internal 1233 } } // namespace v8::internal
1284 1234
1285 #endif // V8_TARGET_ARCH_IA32 1235 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/field-index.h ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698