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

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

Issue 112913002: Split up HLoadNamedField and HStoreNamedField. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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-escape-analysis.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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 #define GVN_TRACKED_FLAG_LIST(V) \ 194 #define GVN_TRACKED_FLAG_LIST(V) \
195 V(Maps) \ 195 V(Maps) \
196 V(NewSpacePromotion) 196 V(NewSpacePromotion)
197 197
198 #define GVN_UNTRACKED_FLAG_LIST(V) \ 198 #define GVN_UNTRACKED_FLAG_LIST(V) \
199 V(ArrayElements) \ 199 V(ArrayElements) \
200 V(ArrayLengths) \ 200 V(ArrayLengths) \
201 V(StringLengths) \ 201 V(StringLengths) \
202 V(BackingStoreFields) \ 202 V(BackingStoreFields) \
203 V(BackingStore) \
203 V(Calls) \ 204 V(Calls) \
204 V(ContextSlots) \ 205 V(ContextSlots) \
205 V(DoubleArrayElements) \ 206 V(DoubleArrayElements) \
206 V(DoubleFields) \ 207 V(DoubleFields) \
207 V(ElementsKind) \ 208 V(ElementsKind) \
208 V(ElementsPointer) \ 209 V(ElementsPointer) \
209 V(GlobalVars) \ 210 V(GlobalVars) \
210 V(InobjectFields) \ 211 V(InobjectFields) \
211 V(OsrEntries) \ 212 V(OsrEntries) \
212 V(ExternalMemory) \ 213 V(ExternalMemory) \
(...skipping 5855 matching lines...) Expand 10 before | Expand all | Expand 10 after
6068 6069
6069 // Create an access to an in-object property in a JSArray. 6070 // Create an access to an in-object property in a JSArray.
6070 static HObjectAccess ForJSArrayOffset(int offset); 6071 static HObjectAccess ForJSArrayOffset(int offset);
6071 6072
6072 static HObjectAccess ForContextSlot(int index); 6073 static HObjectAccess ForContextSlot(int index);
6073 6074
6074 // Create an access to the backing store of an object. 6075 // Create an access to the backing store of an object.
6075 static HObjectAccess ForBackingStoreOffset(int offset, 6076 static HObjectAccess ForBackingStoreOffset(int offset,
6076 Representation representation = Representation::Tagged()); 6077 Representation representation = Representation::Tagged());
6077 6078
6079 static HObjectAccess ForBackingStore();
6080
6078 // Create an access to a resolved field (in-object or backing store). 6081 // Create an access to a resolved field (in-object or backing store).
6079 static HObjectAccess ForField(Handle<Map> map, 6082 static HObjectAccess ForField(Handle<Map> map,
6080 LookupResult *lookup, Handle<String> name = Handle<String>::null()); 6083 LookupResult *lookup, Handle<String> name = Handle<String>::null());
6081 6084
6082 // Create an access for the payload of a Cell or JSGlobalPropertyCell. 6085 // Create an access for the payload of a Cell or JSGlobalPropertyCell.
6083 static HObjectAccess ForCellPayload(Isolate* isolate); 6086 static HObjectAccess ForCellPayload(Isolate* isolate);
6084 6087
6085 static HObjectAccess ForJSTypedArrayLength() { 6088 static HObjectAccess ForJSTypedArrayLength() {
6086 return HObjectAccess::ForJSObjectOffset(JSTypedArray::kLengthOffset); 6089 return HObjectAccess::ForJSObjectOffset(JSTypedArray::kLengthOffset);
6087 } 6090 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
6129 void SetGVNFlags(HValue *instr, bool is_store); 6132 void SetGVNFlags(HValue *instr, bool is_store);
6130 6133
6131 private: 6134 private:
6132 // internal use only; different parts of an object or array 6135 // internal use only; different parts of an object or array
6133 enum Portion { 6136 enum Portion {
6134 kMaps, // map of an object 6137 kMaps, // map of an object
6135 kArrayLengths, // the length of an array 6138 kArrayLengths, // the length of an array
6136 kStringLengths, // the length of a string 6139 kStringLengths, // the length of a string
6137 kElementsPointer, // elements pointer 6140 kElementsPointer, // elements pointer
6138 kBackingStore, // some field in the backing store 6141 kBackingStore, // some field in the backing store
6142 kBackingStorePointer, // the backing store itself
6139 kDouble, // some double field 6143 kDouble, // some double field
6140 kInobject, // some other in-object field 6144 kInobject, // some other in-object field
6141 kExternalMemory // some field in external memory 6145 kExternalMemory // some field in external memory
6142 }; 6146 };
6143 6147
6144 HObjectAccess(Portion portion, int offset, 6148 HObjectAccess(Portion portion, int offset,
6145 Representation representation = Representation::Tagged(), 6149 Representation representation = Representation::Tagged(),
6146 Handle<String> name = Handle<String>::null()) 6150 Handle<String> name = Handle<String>::null())
6147 : value_(PortionField::encode(portion) | 6151 : value_(PortionField::encode(portion) |
6148 RepresentationField::encode(representation.kind()) | 6152 RepresentationField::encode(representation.kind()) |
6149 OffsetField::encode(offset)), 6153 OffsetField::encode(offset)),
6150 name_(name) { 6154 name_(name) {
6151 // assert that the fields decode correctly 6155 // assert that the fields decode correctly
6152 ASSERT(this->offset() == offset); 6156 ASSERT(this->offset() == offset);
6153 ASSERT(this->portion() == portion); 6157 ASSERT(this->portion() == portion);
6154 ASSERT(RepresentationField::decode(value_) == representation.kind()); 6158 ASSERT(RepresentationField::decode(value_) == representation.kind());
6155 } 6159 }
6156 6160
6157 class PortionField : public BitField<Portion, 0, 3> {}; 6161 class PortionField : public BitField<Portion, 0, 4> {};
6158 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; 6162 class RepresentationField : public BitField<Representation::Kind, 4, 4> {};
6159 class OffsetField : public BitField<int, 7, 25> {}; 6163 class OffsetField : public BitField<int, 8, 24> {};
6160 6164
6161 uint32_t value_; // encodes portion, representation, and offset 6165 uint32_t value_; // encodes portion, representation, and offset
6162 Handle<String> name_; 6166 Handle<String> name_;
6163 6167
6164 friend class HLoadNamedField; 6168 friend class HLoadNamedField;
6165 friend class HStoreNamedField; 6169 friend class HStoreNamedField;
6166 6170
6167 inline Portion portion() const { 6171 inline Portion portion() const {
6168 return PortionField::decode(value_); 6172 return PortionField::decode(value_);
6169 } 6173 }
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
6505 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { 6509 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
6506 set_representation(Representation::Tagged()); 6510 set_representation(Representation::Tagged());
6507 SetOperandAt(0, obj); 6511 SetOperandAt(0, obj);
6508 SetOperandAt(1, key); 6512 SetOperandAt(1, key);
6509 SetOperandAt(2, context); 6513 SetOperandAt(2, context);
6510 SetAllSideEffects(); 6514 SetAllSideEffects();
6511 } 6515 }
6512 }; 6516 };
6513 6517
6514 6518
6515 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { 6519 class HStoreNamedField V8_FINAL : public HTemplateInstruction<2> {
6516 public: 6520 public:
6517 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, 6521 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*,
6518 HObjectAccess, HValue*); 6522 HObjectAccess, HValue*);
6519 6523
6520 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 6524 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
6521 6525
6522 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { 6526 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE {
6523 return index == 1; 6527 return index == 1;
6524 } 6528 }
6525 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6529 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
(...skipping 26 matching lines...) Expand all
6552 } 6556 }
6553 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6557 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6554 6558
6555 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } 6559 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; }
6556 bool IsSkipWriteBarrier() const { 6560 bool IsSkipWriteBarrier() const {
6557 return write_barrier_mode_ == SKIP_WRITE_BARRIER; 6561 return write_barrier_mode_ == SKIP_WRITE_BARRIER;
6558 } 6562 }
6559 6563
6560 HValue* object() const { return OperandAt(0); } 6564 HValue* object() const { return OperandAt(0); }
6561 HValue* value() const { return OperandAt(1); } 6565 HValue* value() const { return OperandAt(1); }
6562 HValue* transition() const { return OperandAt(2); }
6563 6566
6564 HObjectAccess access() const { return access_; } 6567 HObjectAccess access() const { return access_; }
6565 HValue* new_space_dominator() const { return new_space_dominator_; } 6568 HValue* new_space_dominator() const { return new_space_dominator_; }
6566 bool has_transition() const { return has_transition_; } 6569 bool has_transition() const { return has_transition_; }
6567 6570
6568 Handle<Map> transition_map() const { 6571 void SetTransition(Handle<Map> map, CompilationInfo* info) {
6569 if (has_transition()) {
6570 return Handle<Map>::cast(
6571 HConstant::cast(transition())->handle(Isolate::Current()));
6572 } else {
6573 return Handle<Map>();
6574 }
6575 }
6576
6577 void SetTransition(HConstant* map_constant, CompilationInfo* info) {
6578 ASSERT(!has_transition()); // Only set once. 6572 ASSERT(!has_transition()); // Only set once.
6579 Handle<Map> map = Handle<Map>::cast(map_constant->handle(info->isolate()));
6580 if (map->CanBeDeprecated()) { 6573 if (map->CanBeDeprecated()) {
6581 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); 6574 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info);
6582 } 6575 }
6583 SetOperandAt(2, map_constant);
6584 has_transition_ = true; 6576 has_transition_ = true;
6585 } 6577 }
6586 6578
6587 bool NeedsWriteBarrier() { 6579 bool NeedsWriteBarrier() {
6588 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || 6580 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) ||
6589 !has_transition()); 6581 !has_transition());
6590 if (IsSkipWriteBarrier()) return false; 6582 if (IsSkipWriteBarrier()) return false;
6591 if (field_representation().IsDouble()) return false; 6583 if (field_representation().IsDouble()) return false;
6592 if (field_representation().IsSmi()) return false; 6584 if (field_representation().IsSmi()) return false;
6593 if (field_representation().IsInteger32()) return false; 6585 if (field_representation().IsInteger32()) return false;
6594 if (field_representation().IsExternal()) return false; 6586 if (field_representation().IsExternal()) return false;
6595 return StoringValueNeedsWriteBarrier(value()) && 6587 return StoringValueNeedsWriteBarrier(value()) &&
6596 ReceiverObjectNeedsWriteBarrier(object(), value(), 6588 ReceiverObjectNeedsWriteBarrier(object(), value(),
6597 new_space_dominator()); 6589 new_space_dominator());
6598 } 6590 }
6599 6591
6600 bool NeedsWriteBarrierForMap() {
6601 if (IsSkipWriteBarrier()) return false;
6602 return ReceiverObjectNeedsWriteBarrier(object(), transition(),
6603 new_space_dominator());
6604 }
6605
6606 Representation field_representation() const { 6592 Representation field_representation() const {
6607 return access_.representation(); 6593 return access_.representation();
6608 } 6594 }
6609 6595
6610 void UpdateValue(HValue* value) { 6596 void UpdateValue(HValue* value) {
6611 SetOperandAt(1, value); 6597 SetOperandAt(1, value);
6612 } 6598 }
6613 6599
6614 private: 6600 private:
6615 HStoreNamedField(HValue* obj, 6601 HStoreNamedField(HValue* obj,
6616 HObjectAccess access, 6602 HObjectAccess access,
6617 HValue* val) 6603 HValue* val)
6618 : access_(access), 6604 : access_(access),
6619 new_space_dominator_(NULL), 6605 new_space_dominator_(NULL),
6620 write_barrier_mode_(UPDATE_WRITE_BARRIER), 6606 write_barrier_mode_(UPDATE_WRITE_BARRIER),
6621 has_transition_(false) { 6607 has_transition_(false) {
6622 SetOperandAt(0, obj); 6608 SetOperandAt(0, obj);
6623 SetOperandAt(1, val); 6609 SetOperandAt(1, val);
6624 SetOperandAt(2, obj);
6625 access.SetGVNFlags(this, true); 6610 access.SetGVNFlags(this, true);
6626 } 6611 }
6627 6612
6628 HObjectAccess access_; 6613 HObjectAccess access_;
6629 HValue* new_space_dominator_; 6614 HValue* new_space_dominator_;
6630 WriteBarrierMode write_barrier_mode_ : 1; 6615 WriteBarrierMode write_barrier_mode_ : 1;
6631 bool has_transition_ : 1; 6616 bool has_transition_ : 1;
6632 }; 6617 };
6633 6618
6634 6619
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
7493 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7478 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7494 }; 7479 };
7495 7480
7496 7481
7497 #undef DECLARE_INSTRUCTION 7482 #undef DECLARE_INSTRUCTION
7498 #undef DECLARE_CONCRETE_INSTRUCTION 7483 #undef DECLARE_CONCRETE_INSTRUCTION
7499 7484
7500 } } // namespace v8::internal 7485 } } // namespace v8::internal
7501 7486
7502 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7487 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-escape-analysis.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698