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

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

Issue 167303005: Track field types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments 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*,
6148 HObjectAccess, Handle<Map>);
6147 6149
6148 HValue* object() { return OperandAt(0); } 6150 HValue* object() { return OperandAt(0); }
6149 HValue* dependency() { 6151 HValue* dependency() {
6150 ASSERT(HasDependency()); 6152 ASSERT(HasDependency());
6151 return OperandAt(1); 6153 return OperandAt(1);
6152 } 6154 }
6153 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } 6155 bool HasDependency() const { return OperandAt(0) != OperandAt(1); }
6154 HObjectAccess access() const { return access_; } 6156 HObjectAccess access() const { return access_; }
6155 Representation field_representation() const { 6157 Representation field_representation() const {
6156 return access_.representation(); 6158 return access_.representation();
6157 } 6159 }
6158 6160
6161 Unique<Map> map() const { return map_; }
6162
6159 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 6163 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
6160 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6164 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6161 return !access().IsInobject() || access().offset() >= size; 6165 return !access().IsInobject() || access().offset() >= size;
6162 } 6166 }
6163 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6167 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6164 if (index == 0 && access().IsExternalMemory()) { 6168 if (index == 0 && access().IsExternalMemory()) {
6165 // object must be external in case of external memory access 6169 // object must be external in case of external memory access
6166 return Representation::External(); 6170 return Representation::External();
6167 } 6171 }
6168 return Representation::Tagged(); 6172 return Representation::Tagged();
6169 } 6173 }
6170 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 6174 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
6171 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6175 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6172 6176
6173 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) 6177 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField)
6174 6178
6175 protected: 6179 protected:
6176 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 6180 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
6177 HLoadNamedField* b = HLoadNamedField::cast(other); 6181 HLoadNamedField* b = HLoadNamedField::cast(other);
6178 return access_.Equals(b->access_); 6182 return access_.Equals(b->access_) && map_ == b->map_;
6179 } 6183 }
6180 6184
6181 private: 6185 private:
6182 HLoadNamedField(HValue* object, 6186 HLoadNamedField(HValue* object,
6183 HValue* dependency, 6187 HValue* dependency,
6184 HObjectAccess access) : access_(access) { 6188 HObjectAccess access,
6189 Handle<Map> map = Handle<Map>::null())
6190 : access_(access), map_(map) {
6185 ASSERT(object != NULL); 6191 ASSERT(object != NULL);
6186 SetOperandAt(0, object); 6192 SetOperandAt(0, object);
6187 SetOperandAt(1, dependency != NULL ? dependency : object); 6193 SetOperandAt(1, dependency != NULL ? dependency : object);
6188 6194
6189 Representation representation = access.representation(); 6195 Representation representation = access.representation();
6190 if (representation.IsInteger8() || 6196 if (representation.IsInteger8() ||
6191 representation.IsUInteger8() || 6197 representation.IsUInteger8() ||
6192 representation.IsInteger16() || 6198 representation.IsInteger16() ||
6193 representation.IsUInteger16()) { 6199 representation.IsUInteger16()) {
6194 set_representation(Representation::Integer32()); 6200 set_representation(Representation::Integer32());
(...skipping 13 matching lines...) Expand all
6208 set_representation(Representation::Tagged()); 6214 set_representation(Representation::Tagged());
6209 } else { 6215 } else {
6210 set_representation(Representation::Tagged()); 6216 set_representation(Representation::Tagged());
6211 } 6217 }
6212 access.SetGVNFlags(this, LOAD); 6218 access.SetGVNFlags(this, LOAD);
6213 } 6219 }
6214 6220
6215 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6221 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6216 6222
6217 HObjectAccess access_; 6223 HObjectAccess access_;
6224 Unique<Map> map_;
6218 }; 6225 };
6219 6226
6220 6227
6221 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { 6228 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> {
6222 public: 6229 public:
6223 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, 6230 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
6224 Handle<Object>); 6231 Handle<Object>);
6225 6232
6226 HValue* context() { return OperandAt(0); } 6233 HValue* context() { return OperandAt(0); }
6227 HValue* object() { return OperandAt(1); } 6234 HValue* object() { return OperandAt(1); }
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
7539 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7546 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7540 }; 7547 };
7541 7548
7542 7549
7543 #undef DECLARE_INSTRUCTION 7550 #undef DECLARE_INSTRUCTION
7544 #undef DECLARE_CONCRETE_INSTRUCTION 7551 #undef DECLARE_CONCRETE_INSTRUCTION
7545 7552
7546 } } // namespace v8::internal 7553 } } // namespace v8::internal
7547 7554
7548 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7555 #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