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

Side by Side Diff: src/hydrogen-instructions.h

Issue 14850006: Use mutable heapnumbers to store doubles in fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported to ARM and x64 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/hydrogen.cc ('k') | src/hydrogen-instructions.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 // 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 V(WrapReceiver) 199 V(WrapReceiver)
200 200
201 #define GVN_TRACKED_FLAG_LIST(V) \ 201 #define GVN_TRACKED_FLAG_LIST(V) \
202 V(Maps) \ 202 V(Maps) \
203 V(NewSpacePromotion) 203 V(NewSpacePromotion)
204 204
205 #define GVN_UNTRACKED_FLAG_LIST(V) \ 205 #define GVN_UNTRACKED_FLAG_LIST(V) \
206 V(Calls) \ 206 V(Calls) \
207 V(InobjectFields) \ 207 V(InobjectFields) \
208 V(BackingStoreFields) \ 208 V(BackingStoreFields) \
209 V(DoubleFields) \
209 V(ElementsKind) \ 210 V(ElementsKind) \
210 V(ElementsPointer) \ 211 V(ElementsPointer) \
211 V(ArrayElements) \ 212 V(ArrayElements) \
212 V(DoubleArrayElements) \ 213 V(DoubleArrayElements) \
213 V(SpecializedArrayElements) \ 214 V(SpecializedArrayElements) \
214 V(GlobalVars) \ 215 V(GlobalVars) \
215 V(ArrayLengths) \ 216 V(ArrayLengths) \
216 V(ContextSlots) \ 217 V(ContextSlots) \
217 V(OsrEntries) 218 V(OsrEntries)
218 219
(...skipping 4981 matching lines...) Expand 10 before | Expand all | Expand 10 after
5200 5201
5201 if (FLAG_track_fields && field_representation.IsSmi()) { 5202 if (FLAG_track_fields && field_representation.IsSmi()) {
5202 set_type(HType::Smi()); 5203 set_type(HType::Smi());
5203 set_representation(Representation::Tagged()); 5204 set_representation(Representation::Tagged());
5204 } else if (FLAG_track_double_fields && field_representation.IsDouble()) { 5205 } else if (FLAG_track_double_fields && field_representation.IsDouble()) {
5205 set_representation(field_representation); 5206 set_representation(field_representation);
5206 } else { 5207 } else {
5207 set_representation(Representation::Tagged()); 5208 set_representation(Representation::Tagged());
5208 } 5209 }
5209 SetFlag(kUseGVN); 5210 SetFlag(kUseGVN);
5210 SetGVNFlag(kDependsOnMaps); 5211 if (FLAG_track_double_fields && representation().IsDouble()) {
5211 if (is_in_object) { 5212 ASSERT(is_in_object);
5213 ASSERT(offset == HeapNumber::kValueOffset);
5214 SetGVNFlag(kDependsOnDoubleFields);
5215 } else if (is_in_object) {
5212 SetGVNFlag(kDependsOnInobjectFields); 5216 SetGVNFlag(kDependsOnInobjectFields);
5217 SetGVNFlag(kDependsOnMaps);
5213 } else { 5218 } else {
5214 SetGVNFlag(kDependsOnBackingStoreFields); 5219 SetGVNFlag(kDependsOnBackingStoreFields);
5220 SetGVNFlag(kDependsOnMaps);
5215 } 5221 }
5216 } 5222 }
5217 5223
5218 static HLoadNamedField* NewArrayLength(Zone* zone, HValue* object, 5224 static HLoadNamedField* NewArrayLength(Zone* zone, HValue* object,
5219 HValue* typecheck, 5225 HValue* typecheck,
5220 HType type = HType::Tagged()) { 5226 HType type = HType::Tagged()) {
5221 Representation representation = 5227 Representation representation =
5222 type.IsSmi() ? Representation::Smi() : Representation::Tagged(); 5228 type.IsSmi() ? Representation::Smi() : Representation::Tagged();
5223 HLoadNamedField* result = new(zone) HLoadNamedField( 5229 HLoadNamedField* result = new(zone) HLoadNamedField(
5224 object, true, representation, JSArray::kLengthOffset, typecheck); 5230 object, true, representation, JSArray::kLengthOffset, typecheck);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
5544 5550
5545 virtual HValue* Canonicalize(); 5551 virtual HValue* Canonicalize();
5546 5552
5547 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) 5553 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
5548 }; 5554 };
5549 5555
5550 5556
5551 class HStoreNamedField: public HTemplateInstruction<2> { 5557 class HStoreNamedField: public HTemplateInstruction<2> {
5552 public: 5558 public:
5553 HStoreNamedField(HValue* obj, 5559 HStoreNamedField(HValue* obj,
5554 Handle<String> name, 5560 Handle<Name> name,
5555 HValue* val, 5561 HValue* val,
5556 bool in_object, 5562 bool in_object,
5557 Representation field_representation, 5563 Representation field_representation,
5558 int offset) 5564 int offset)
5559 : name_(name), 5565 : name_(name),
5560 is_in_object_(in_object), 5566 is_in_object_(in_object),
5561 field_representation_(field_representation), 5567 field_representation_(field_representation),
5562 offset_(offset), 5568 offset_(offset),
5563 transition_unique_id_(), 5569 transition_unique_id_(),
5564 new_space_dominator_(NULL) { 5570 new_space_dominator_(NULL) {
5565 SetOperandAt(0, obj); 5571 SetOperandAt(0, obj);
5566 SetOperandAt(1, val); 5572 SetOperandAt(1, val);
5567 SetFlag(kTrackSideEffectDominators); 5573 SetFlag(kTrackSideEffectDominators);
5568 SetGVNFlag(kDependsOnNewSpacePromotion); 5574 if (FLAG_track_double_fields && field_representation.IsDouble()) {
5569 if (is_in_object_) { 5575 SetGVNFlag(kChangesDoubleFields);
5576 } else if (is_in_object_) {
5570 SetGVNFlag(kChangesInobjectFields); 5577 SetGVNFlag(kChangesInobjectFields);
5578 SetGVNFlag(kDependsOnNewSpacePromotion);
5571 } else { 5579 } else {
5572 SetGVNFlag(kChangesBackingStoreFields); 5580 SetGVNFlag(kChangesBackingStoreFields);
5581 SetGVNFlag(kDependsOnNewSpacePromotion);
5573 } 5582 }
5574 } 5583 }
5575 5584
5576 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 5585 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
5577 5586
5578 virtual Representation RequiredInputRepresentation(int index) { 5587 virtual Representation RequiredInputRepresentation(int index) {
5579 if (FLAG_track_fields && index == 1 && field_representation_.IsSmi()) { 5588 if (FLAG_track_double_fields &&
5589 index == 1 && field_representation_.IsDouble()) {
5590 return field_representation_;
5591 } else if (FLAG_track_fields &&
5592 index == 1 && field_representation_.IsSmi()) {
5580 return Representation::Integer32(); 5593 return Representation::Integer32();
5581 } 5594 }
5582 return Representation::Tagged(); 5595 return Representation::Tagged();
5583 } 5596 }
5584 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { 5597 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) {
5585 ASSERT(side_effect == kChangesNewSpacePromotion); 5598 ASSERT(side_effect == kChangesNewSpacePromotion);
5586 new_space_dominator_ = dominator; 5599 new_space_dominator_ = dominator;
5587 } 5600 }
5588 virtual void PrintDataTo(StringStream* stream); 5601 virtual void PrintDataTo(StringStream* stream);
5589 5602
5590 HValue* object() { return OperandAt(0); } 5603 HValue* object() { return OperandAt(0); }
5591 HValue* value() { return OperandAt(1); } 5604 HValue* value() { return OperandAt(1); }
5592 5605
5593 Handle<String> name() const { return name_; } 5606 Handle<Name> name() const { return name_; }
5594 bool is_in_object() const { return is_in_object_; } 5607 bool is_in_object() const { return is_in_object_; }
5595 int offset() const { return offset_; } 5608 int offset() const { return offset_; }
5596 Handle<Map> transition() const { return transition_; } 5609 Handle<Map> transition() const { return transition_; }
5597 UniqueValueId transition_unique_id() const { return transition_unique_id_; } 5610 UniqueValueId transition_unique_id() const { return transition_unique_id_; }
5598 void set_transition(Handle<Map> map) { transition_ = map; } 5611 void set_transition(Handle<Map> map) { transition_ = map; }
5599 HValue* new_space_dominator() const { return new_space_dominator_; } 5612 HValue* new_space_dominator() const { return new_space_dominator_; }
5600 5613
5601 bool NeedsWriteBarrier() { 5614 bool NeedsWriteBarrier() {
5615 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) ||
5616 transition_.is_null());
5602 return (!FLAG_track_fields || !field_representation_.IsSmi()) && 5617 return (!FLAG_track_fields || !field_representation_.IsSmi()) &&
5618 // If there is a transition, a new storage object needs to be allocated.
5619 !(FLAG_track_double_fields && field_representation_.IsDouble()) &&
5603 StoringValueNeedsWriteBarrier(value()) && 5620 StoringValueNeedsWriteBarrier(value()) &&
5604 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); 5621 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
5605 } 5622 }
5606 5623
5607 bool NeedsWriteBarrierForMap() { 5624 bool NeedsWriteBarrierForMap() {
5608 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); 5625 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
5609 } 5626 }
5610 5627
5611 virtual void FinalizeUniqueValueId() { 5628 virtual void FinalizeUniqueValueId() {
5612 transition_unique_id_ = UniqueValueId(transition_); 5629 transition_unique_id_ = UniqueValueId(transition_);
5613 } 5630 }
5614 5631
5615 Representation field_representation() const { 5632 Representation field_representation() const {
5616 return field_representation_; 5633 return field_representation_;
5617 } 5634 }
5618 5635
5619 private: 5636 private:
5620 Handle<String> name_; 5637 Handle<Name> name_;
5621 bool is_in_object_; 5638 bool is_in_object_;
5622 Representation field_representation_; 5639 Representation field_representation_;
5623 int offset_; 5640 int offset_;
5624 Handle<Map> transition_; 5641 Handle<Map> transition_;
5625 UniqueValueId transition_unique_id_; 5642 UniqueValueId transition_unique_id_;
5626 HValue* new_space_dominator_; 5643 HValue* new_space_dominator_;
5627 }; 5644 };
5628 5645
5629 5646
5630 class HStoreNamedGeneric: public HTemplateInstruction<3> { 5647 class HStoreNamedGeneric: public HTemplateInstruction<3> {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
6099 6116
6100 6117
6101 class HObjectLiteral: public HMaterializedLiteral<1> { 6118 class HObjectLiteral: public HMaterializedLiteral<1> {
6102 public: 6119 public:
6103 HObjectLiteral(HValue* context, 6120 HObjectLiteral(HValue* context,
6104 Handle<FixedArray> constant_properties, 6121 Handle<FixedArray> constant_properties,
6105 Handle<FixedArray> literals, 6122 Handle<FixedArray> literals,
6106 bool fast_elements, 6123 bool fast_elements,
6107 int literal_index, 6124 int literal_index,
6108 int depth, 6125 int depth,
6126 bool may_store_doubles,
6109 bool has_function) 6127 bool has_function)
6110 : HMaterializedLiteral<1>(literal_index, depth), 6128 : HMaterializedLiteral<1>(literal_index, depth),
6111 constant_properties_(constant_properties), 6129 constant_properties_(constant_properties),
6112 constant_properties_length_(constant_properties->length()), 6130 constant_properties_length_(constant_properties->length()),
6113 literals_(literals), 6131 literals_(literals),
6114 fast_elements_(fast_elements), 6132 fast_elements_(fast_elements),
6133 may_store_doubles_(may_store_doubles),
6115 has_function_(has_function) { 6134 has_function_(has_function) {
6116 SetOperandAt(0, context); 6135 SetOperandAt(0, context);
6117 SetGVNFlag(kChangesNewSpacePromotion); 6136 SetGVNFlag(kChangesNewSpacePromotion);
6118 } 6137 }
6119 6138
6120 HValue* context() { return OperandAt(0); } 6139 HValue* context() { return OperandAt(0); }
6121 Handle<FixedArray> constant_properties() const { 6140 Handle<FixedArray> constant_properties() const {
6122 return constant_properties_; 6141 return constant_properties_;
6123 } 6142 }
6124 int constant_properties_length() const { 6143 int constant_properties_length() const {
6125 return constant_properties_length_; 6144 return constant_properties_length_;
6126 } 6145 }
6127 Handle<FixedArray> literals() const { return literals_; } 6146 Handle<FixedArray> literals() const { return literals_; }
6128 bool fast_elements() const { return fast_elements_; } 6147 bool fast_elements() const { return fast_elements_; }
6148 bool may_store_doubles() const { return may_store_doubles_; }
6129 bool has_function() const { return has_function_; } 6149 bool has_function() const { return has_function_; }
6130 6150
6131 virtual Representation RequiredInputRepresentation(int index) { 6151 virtual Representation RequiredInputRepresentation(int index) {
6132 return Representation::Tagged(); 6152 return Representation::Tagged();
6133 } 6153 }
6134 virtual HType CalculateInferredType(); 6154 virtual HType CalculateInferredType();
6135 6155
6136 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) 6156 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral)
6137 6157
6138 private: 6158 private:
6139 Handle<FixedArray> constant_properties_; 6159 Handle<FixedArray> constant_properties_;
6140 int constant_properties_length_; 6160 int constant_properties_length_;
6141 Handle<FixedArray> literals_; 6161 Handle<FixedArray> literals_;
6142 bool fast_elements_ : 1; 6162 bool fast_elements_ : 1;
6163 bool may_store_doubles_ : 1;
6143 bool has_function_ : 1; 6164 bool has_function_ : 1;
6144 }; 6165 };
6145 6166
6146 6167
6147 class HRegExpLiteral: public HMaterializedLiteral<1> { 6168 class HRegExpLiteral: public HMaterializedLiteral<1> {
6148 public: 6169 public:
6149 HRegExpLiteral(HValue* context, 6170 HRegExpLiteral(HValue* context,
6150 Handle<FixedArray> literals, 6171 Handle<FixedArray> literals,
6151 Handle<String> pattern, 6172 Handle<String> pattern,
6152 Handle<String> flags, 6173 Handle<String> flags,
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
6522 virtual bool IsDeletable() const { return true; } 6543 virtual bool IsDeletable() const { return true; }
6523 }; 6544 };
6524 6545
6525 6546
6526 #undef DECLARE_INSTRUCTION 6547 #undef DECLARE_INSTRUCTION
6527 #undef DECLARE_CONCRETE_INSTRUCTION 6548 #undef DECLARE_CONCRETE_INSTRUCTION
6528 6549
6529 } } // namespace v8::internal 6550 } } // namespace v8::internal
6530 6551
6531 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6552 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698