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

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: Support transitions in LookupResult. Created 6 years, 9 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
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 6102 matching lines...) Expand 10 before | Expand all | Expand 10 after
6113 inline Portion portion() const { 6113 inline Portion portion() const {
6114 return PortionField::decode(value_); 6114 return PortionField::decode(value_);
6115 } 6115 }
6116 }; 6116 };
6117 6117
6118 6118
6119 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { 6119 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> {
6120 public: 6120 public:
6121 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*, 6121 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*,
6122 HObjectAccess); 6122 HObjectAccess);
6123 DECLARE_INSTRUCTION_FACTORY_P4(HLoadNamedField, HValue*, HValue*,
6124 HObjectAccess, Handle<Map>);
6123 6125
6124 HValue* object() { return OperandAt(0); } 6126 HValue* object() { return OperandAt(0); }
6125 HValue* dependency() { 6127 HValue* dependency() {
6126 ASSERT(HasDependency()); 6128 ASSERT(HasDependency());
6127 return OperandAt(1); 6129 return OperandAt(1);
6128 } 6130 }
6129 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } 6131 bool HasDependency() const { return OperandAt(0) != OperandAt(1); }
6130 HObjectAccess access() const { return access_; } 6132 HObjectAccess access() const { return access_; }
6131 Representation field_representation() const { 6133 Representation field_representation() const {
6132 return access_.representation(); 6134 return access_.representation();
6133 } 6135 }
6134 6136
6137 Unique<Map> map() const { return map_; }
6138
6135 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 6139 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
6136 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6140 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6137 return !access().IsInobject() || access().offset() >= size; 6141 return !access().IsInobject() || access().offset() >= size;
6138 } 6142 }
6139 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6143 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6140 if (index == 0 && access().IsExternalMemory()) { 6144 if (index == 0 && access().IsExternalMemory()) {
6141 // object must be external in case of external memory access 6145 // object must be external in case of external memory access
6142 return Representation::External(); 6146 return Representation::External();
6143 } 6147 }
6144 return Representation::Tagged(); 6148 return Representation::Tagged();
6145 } 6149 }
6146 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 6150 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
6147 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6151 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6148 6152
6149 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) 6153 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField)
6150 6154
6151 protected: 6155 protected:
6152 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 6156 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
6153 HLoadNamedField* b = HLoadNamedField::cast(other); 6157 HLoadNamedField* b = HLoadNamedField::cast(other);
6154 return access_.Equals(b->access_); 6158 return access_.Equals(b->access_) && map_ == b->map_;
6155 } 6159 }
6156 6160
6157 private: 6161 private:
6158 HLoadNamedField(HValue* object, 6162 HLoadNamedField(HValue* object,
6159 HValue* dependency, 6163 HValue* dependency,
6160 HObjectAccess access) : access_(access) { 6164 HObjectAccess access,
6165 Handle<Map> map = Handle<Map>::null())
6166 : access_(access), map_(map) {
6161 ASSERT(object != NULL); 6167 ASSERT(object != NULL);
6162 SetOperandAt(0, object); 6168 SetOperandAt(0, object);
6163 SetOperandAt(1, dependency != NULL ? dependency : object); 6169 SetOperandAt(1, dependency != NULL ? dependency : object);
6164 6170
6165 Representation representation = access.representation(); 6171 Representation representation = access.representation();
6166 if (representation.IsInteger8() || 6172 if (representation.IsInteger8() ||
6167 representation.IsUInteger8() || 6173 representation.IsUInteger8() ||
6168 representation.IsInteger16() || 6174 representation.IsInteger16() ||
6169 representation.IsUInteger16()) { 6175 representation.IsUInteger16()) {
6170 set_representation(Representation::Integer32()); 6176 set_representation(Representation::Integer32());
(...skipping 13 matching lines...) Expand all
6184 set_representation(Representation::Tagged()); 6190 set_representation(Representation::Tagged());
6185 } else { 6191 } else {
6186 set_representation(Representation::Tagged()); 6192 set_representation(Representation::Tagged());
6187 } 6193 }
6188 access.SetGVNFlags(this, LOAD); 6194 access.SetGVNFlags(this, LOAD);
6189 } 6195 }
6190 6196
6191 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6197 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6192 6198
6193 HObjectAccess access_; 6199 HObjectAccess access_;
6200 Unique<Map> map_;
6194 }; 6201 };
6195 6202
6196 6203
6197 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { 6204 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> {
6198 public: 6205 public:
6199 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, 6206 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
6200 Handle<Object>); 6207 Handle<Object>);
6201 6208
6202 HValue* context() { return OperandAt(0); } 6209 HValue* context() { return OperandAt(0); }
6203 HValue* object() { return OperandAt(1); } 6210 HValue* object() { return OperandAt(1); }
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
7514 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7521 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7515 }; 7522 };
7516 7523
7517 7524
7518 #undef DECLARE_INSTRUCTION 7525 #undef DECLARE_INSTRUCTION
7519 #undef DECLARE_CONCRETE_INSTRUCTION 7526 #undef DECLARE_CONCRETE_INSTRUCTION
7520 7527
7521 } } // namespace v8::internal 7528 } } // namespace v8::internal
7522 7529
7523 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7530 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698