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

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

Issue 14146005: Track representations of fields (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test for tracking fields 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/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-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 // 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 code->set_stack_slots(GetStackSlotCount()); 89 code->set_stack_slots(GetStackSlotCount());
90 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 90 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
91 if (FLAG_weak_embedded_maps_in_optimized_code) { 91 if (FLAG_weak_embedded_maps_in_optimized_code) {
92 RegisterDependentCodeForEmbeddedMaps(code); 92 RegisterDependentCodeForEmbeddedMaps(code);
93 } 93 }
94 PopulateDeoptimizationData(code); 94 PopulateDeoptimizationData(code);
95 for (int i = 0 ; i < prototype_maps_.length(); i++) { 95 for (int i = 0 ; i < prototype_maps_.length(); i++) {
96 prototype_maps_.at(i)->AddDependentCode( 96 prototype_maps_.at(i)->AddDependentCode(
97 DependentCode::kPrototypeCheckGroup, code); 97 DependentCode::kPrototypeCheckGroup, code);
98 } 98 }
99 for (int i = 0 ; i < transition_maps_.length(); i++) {
100 transition_maps_.at(i)->AddDependentCode(
101 DependentCode::kTransitionGroup, code);
102 }
99 } 103 }
100 104
101 105
102 void LChunkBuilder::Abort(const char* reason) { 106 void LChunkBuilder::Abort(const char* reason) {
103 info()->set_bailout_reason(reason); 107 info()->set_bailout_reason(reason);
104 status_ = ABORTED; 108 status_ = ABORTED;
105 } 109 }
106 110
107 111
108 void LCodeGen::Comment(const char* format, ...) { 112 void LCodeGen::Comment(const char* format, ...) {
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 EMIT_REMEMBERED_SET, 2674 EMIT_REMEMBERED_SET,
2671 check_needed); 2675 check_needed);
2672 } 2676 }
2673 2677
2674 __ bind(&skip_assignment); 2678 __ bind(&skip_assignment);
2675 } 2679 }
2676 2680
2677 2681
2678 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 2682 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2679 Register object = ToRegister(instr->object()); 2683 Register object = ToRegister(instr->object());
2680 Register result = ToRegister(instr->result()); 2684 if (!FLAG_track_double_fields) {
2685 ASSERT(!instr->hydrogen()->representation().IsDouble());
2686 }
2687 Register temp = instr->hydrogen()->representation().IsDouble()
2688 ? ToRegister(instr->temp()) : ToRegister(instr->result());
2681 if (instr->hydrogen()->is_in_object()) { 2689 if (instr->hydrogen()->is_in_object()) {
2682 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); 2690 __ movq(temp, FieldOperand(object, instr->hydrogen()->offset()));
2683 } else { 2691 } else {
2684 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); 2692 __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset));
2685 __ movq(result, FieldOperand(result, instr->hydrogen()->offset())); 2693 __ movq(temp, FieldOperand(temp, instr->hydrogen()->offset()));
2694 }
2695
2696 if (instr->hydrogen()->representation().IsDouble()) {
2697 Label load_from_heap_number, done;
2698 XMMRegister result = ToDoubleRegister(instr->result());
2699 __ JumpIfNotSmi(temp, &load_from_heap_number);
2700 __ SmiToInteger32(temp, temp);
2701 __ cvtlsi2sd(result, temp);
2702 __ jmp(&done);
2703 __ bind(&load_from_heap_number);
2704 __ movsd(result, FieldOperand(temp, HeapNumber::kValueOffset));
2705 __ bind(&done);
2686 } 2706 }
2687 } 2707 }
2688 2708
2689 2709
2690 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, 2710 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
2691 Register object, 2711 Register object,
2692 Handle<Map> type, 2712 Handle<Map> type,
2693 Handle<String> name, 2713 Handle<String> name,
2694 LEnvironment* env) { 2714 LEnvironment* env) {
2695 LookupResult lookup(isolate()); 2715 LookupResult lookup(isolate());
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
3911 3931
3912 3932
3913 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { 3933 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) {
3914 Register result = ToRegister(instr->result()); 3934 Register result = ToRegister(instr->result());
3915 Register base = ToRegister(instr->base_object()); 3935 Register base = ToRegister(instr->base_object());
3916 __ lea(result, Operand(base, instr->offset())); 3936 __ lea(result, Operand(base, instr->offset()));
3917 } 3937 }
3918 3938
3919 3939
3920 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 3940 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3941 Representation representation = instr->representation();
3942
3921 Register object = ToRegister(instr->object()); 3943 Register object = ToRegister(instr->object());
3944
3922 int offset = instr->offset(); 3945 int offset = instr->offset();
3923 3946
3924 if (!instr->transition().is_null()) { 3947 if (FLAG_track_fields && representation.IsSmi()) {
3948 if (instr->value()->IsConstantOperand()) {
3949 LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
3950 if (!IsInteger32Constant(operand_value)) {
3951 DeoptimizeIf(no_condition, instr->environment());
3952 }
3953 } else {
3954 Register value = ToRegister(instr->value());
3955 __ Integer32ToSmi(value, value);
3956 }
3957 } else if (FLAG_track_double_fields && representation.IsDouble() &&
3958 !instr->hydrogen()->value()->type().IsSmi() &&
3959 !instr->hydrogen()->value()->type().IsHeapNumber()) {
3960 Register value = ToRegister(instr->value());
3961 Label do_store;
3962 __ JumpIfSmi(value, &do_store);
3963 Handle<Map> map(isolate()->factory()->heap_number_map());
3964 DoCheckMapCommon(value, map, REQUIRE_EXACT_MAP, instr);
3965 __ bind(&do_store);
3966 }
3967
3968 Handle<Map> transition = instr->transition();
3969 if (!transition.is_null()) {
3970 if (transition->CanBeDeprecated()) {
3971 transition_maps_.Add(transition, info()->zone());
3972 }
3925 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { 3973 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) {
3926 __ Move(FieldOperand(object, HeapObject::kMapOffset), 3974 __ Move(FieldOperand(object, HeapObject::kMapOffset), transition);
3927 instr->transition());
3928 } else { 3975 } else {
3929 Register temp = ToRegister(instr->temp()); 3976 Register temp = ToRegister(instr->temp());
3930 __ Move(kScratchRegister, instr->transition()); 3977 __ Move(kScratchRegister, transition);
3931 __ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister); 3978 __ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister);
3932 // Update the write barrier for the map field. 3979 // Update the write barrier for the map field.
3933 __ RecordWriteField(object, 3980 __ RecordWriteField(object,
3934 HeapObject::kMapOffset, 3981 HeapObject::kMapOffset,
3935 kScratchRegister, 3982 kScratchRegister,
3936 temp, 3983 temp,
3937 kSaveFPRegs, 3984 kSaveFPRegs,
3938 OMIT_REMEMBERED_SET, 3985 OMIT_REMEMBERED_SET,
3939 OMIT_SMI_CHECK); 3986 OMIT_SMI_CHECK);
3940 } 3987 }
(...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
5679 FixedArray::kHeaderSize - kPointerSize)); 5726 FixedArray::kHeaderSize - kPointerSize));
5680 __ bind(&done); 5727 __ bind(&done);
5681 } 5728 }
5682 5729
5683 5730
5684 #undef __ 5731 #undef __
5685 5732
5686 } } // namespace v8::internal 5733 } } // namespace v8::internal
5687 5734
5688 #endif // V8_TARGET_ARCH_X64 5735 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698