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

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

Issue 239923004: Allow merging of monomorphic accesses to tracked fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 8 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-check-elimination.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 6126 matching lines...) Expand 10 before | Expand all | Expand 10 after
6137 inline Portion portion() const { 6137 inline Portion portion() const {
6138 return PortionField::decode(value_); 6138 return PortionField::decode(value_);
6139 } 6139 }
6140 }; 6140 };
6141 6141
6142 6142
6143 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { 6143 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> {
6144 public: 6144 public:
6145 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*, 6145 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*,
6146 HObjectAccess); 6146 HObjectAccess);
6147 DECLARE_INSTRUCTION_FACTORY_P4(HLoadNamedField, HValue*, HValue*, 6147 static HLoadNamedField* New(Zone* zone, HValue* context,
6148 HObjectAccess, Handle<Map>); 6148 HValue* object, HValue* dependency,
6149 HObjectAccess access, SmallMapList* maps,
6150 CompilationInfo* info) {
6151 HLoadNamedField* load_named_field = HLoadNamedField::New(
6152 zone, context, object, dependency, access);
6153 for (int i = 0; i < maps->length(); ++i) {
6154 Handle<Map> map(maps->at(i));
6155 load_named_field->map_set_.Add(Unique<Map>(map), zone);
6156 if (map->CanTransition()) {
6157 Map::AddDependentCompilationInfo(
6158 map, DependentCode::kPrototypeCheckGroup, info);
6159 }
6160 }
6161 return load_named_field;
6162 }
6149 6163
6150 HValue* object() { return OperandAt(0); } 6164 HValue* object() { return OperandAt(0); }
6151 HValue* dependency() { 6165 HValue* dependency() {
6152 ASSERT(HasDependency()); 6166 ASSERT(HasDependency());
6153 return OperandAt(1); 6167 return OperandAt(1);
6154 } 6168 }
6155 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } 6169 bool HasDependency() const { return OperandAt(0) != OperandAt(1); }
6156 HObjectAccess access() const { return access_; } 6170 HObjectAccess access() const { return access_; }
6157 Representation field_representation() const { 6171 Representation field_representation() const {
6158 return access_.representation(); 6172 return access_.representation();
6159 } 6173 }
6160 6174
6161 Unique<Map> map() const { return map_; } 6175 UniqueSet<Map> map_set() const { return map_set_; }
6162 6176
6163 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 6177 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
6164 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6178 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6165 return !access().IsInobject() || access().offset() >= size; 6179 return !access().IsInobject() || access().offset() >= size;
6166 } 6180 }
6167 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6181 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6168 if (index == 0 && access().IsExternalMemory()) { 6182 if (index == 0 && access().IsExternalMemory()) {
6169 // object must be external in case of external memory access 6183 // object must be external in case of external memory access
6170 return Representation::External(); 6184 return Representation::External();
6171 } 6185 }
6172 return Representation::Tagged(); 6186 return Representation::Tagged();
6173 } 6187 }
6174 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 6188 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
6175 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6189 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6176 6190
6177 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) 6191 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField)
6178 6192
6179 protected: 6193 protected:
6180 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 6194 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
6181 HLoadNamedField* b = HLoadNamedField::cast(other); 6195 HLoadNamedField* b = HLoadNamedField::cast(other);
6182 return access_.Equals(b->access_) && map_ == b->map_; 6196 return access_.Equals(b->access_) && this->map_set_.Equals(&b->map_set_);
6183 } 6197 }
6184 6198
6185 private: 6199 private:
6186 HLoadNamedField(HValue* object, 6200 HLoadNamedField(HValue* object,
6187 HValue* dependency, 6201 HValue* dependency,
6188 HObjectAccess access, 6202 HObjectAccess access,
6189 Handle<Map> map = Handle<Map>::null()) 6203 Handle<Map> map = Handle<Map>::null())
6190 : access_(access), map_(map) { 6204 : access_(access) {
6191 ASSERT(object != NULL); 6205 ASSERT(object != NULL);
6192 SetOperandAt(0, object); 6206 SetOperandAt(0, object);
6193 SetOperandAt(1, dependency != NULL ? dependency : object); 6207 SetOperandAt(1, dependency != NULL ? dependency : object);
6194 6208
6195 Representation representation = access.representation(); 6209 Representation representation = access.representation();
6196 if (representation.IsInteger8() || 6210 if (representation.IsInteger8() ||
6197 representation.IsUInteger8() || 6211 representation.IsUInteger8() ||
6198 representation.IsInteger16() || 6212 representation.IsInteger16() ||
6199 representation.IsUInteger16()) { 6213 representation.IsUInteger16()) {
6200 set_representation(Representation::Integer32()); 6214 set_representation(Representation::Integer32());
(...skipping 13 matching lines...) Expand all
6214 set_representation(Representation::Tagged()); 6228 set_representation(Representation::Tagged());
6215 } else { 6229 } else {
6216 set_representation(Representation::Tagged()); 6230 set_representation(Representation::Tagged());
6217 } 6231 }
6218 access.SetGVNFlags(this, LOAD); 6232 access.SetGVNFlags(this, LOAD);
6219 } 6233 }
6220 6234
6221 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6235 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6222 6236
6223 HObjectAccess access_; 6237 HObjectAccess access_;
6224 Unique<Map> map_; 6238 UniqueSet<Map> map_set_;
6225 }; 6239 };
6226 6240
6227 6241
6228 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { 6242 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> {
6229 public: 6243 public:
6230 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, 6244 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
6231 Handle<Object>); 6245 Handle<Object>);
6232 6246
6233 HValue* context() { return OperandAt(0); } 6247 HValue* context() { return OperandAt(0); }
6234 HValue* object() { return OperandAt(1); } 6248 HValue* object() { return OperandAt(1); }
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
7547 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7561 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7548 }; 7562 };
7549 7563
7550 7564
7551 #undef DECLARE_INSTRUCTION 7565 #undef DECLARE_INSTRUCTION
7552 #undef DECLARE_CONCRETE_INSTRUCTION 7566 #undef DECLARE_CONCRETE_INSTRUCTION
7553 7567
7554 } } // namespace v8::internal 7568 } } // namespace v8::internal
7555 7569
7556 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7570 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-check-elimination.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698