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

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

Issue 61623004: Add signed/unsigned 8-bit and 16-bit Representations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review feedback and prepare to land Created 7 years, 1 month 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/globals.h ('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 5836 matching lines...) Expand 10 before | Expand all | Expand 10 after
5847 return HObjectAccess(kInobject, JSFunction::kContextOffset); 5847 return HObjectAccess(kInobject, JSFunction::kContextOffset);
5848 } 5848 }
5849 5849
5850 static HObjectAccess ForMap() { 5850 static HObjectAccess ForMap() {
5851 return HObjectAccess(kMaps, JSObject::kMapOffset); 5851 return HObjectAccess(kMaps, JSObject::kMapOffset);
5852 } 5852 }
5853 5853
5854 static HObjectAccess ForMapInstanceSize() { 5854 static HObjectAccess ForMapInstanceSize() {
5855 return HObjectAccess(kInobject, 5855 return HObjectAccess(kInobject,
5856 Map::kInstanceSizeOffset, 5856 Map::kInstanceSizeOffset,
5857 Representation::Byte()); 5857 Representation::UInteger8());
5858 } 5858 }
5859 5859
5860 static HObjectAccess ForPropertyCellValue() { 5860 static HObjectAccess ForPropertyCellValue() {
5861 return HObjectAccess(kInobject, PropertyCell::kValueOffset); 5861 return HObjectAccess(kInobject, PropertyCell::kValueOffset);
5862 } 5862 }
5863 5863
5864 static HObjectAccess ForCellValue() { 5864 static HObjectAccess ForCellValue() {
5865 return HObjectAccess(kInobject, Cell::kValueOffset); 5865 return HObjectAccess(kInobject, Cell::kValueOffset);
5866 } 5866 }
5867 5867
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5925 RepresentationField::encode(representation.kind()) | 5925 RepresentationField::encode(representation.kind()) |
5926 OffsetField::encode(offset)), 5926 OffsetField::encode(offset)),
5927 name_(name) { 5927 name_(name) {
5928 // assert that the fields decode correctly 5928 // assert that the fields decode correctly
5929 ASSERT(this->offset() == offset); 5929 ASSERT(this->offset() == offset);
5930 ASSERT(this->portion() == portion); 5930 ASSERT(this->portion() == portion);
5931 ASSERT(RepresentationField::decode(value_) == representation.kind()); 5931 ASSERT(RepresentationField::decode(value_) == representation.kind());
5932 } 5932 }
5933 5933
5934 class PortionField : public BitField<Portion, 0, 3> {}; 5934 class PortionField : public BitField<Portion, 0, 3> {};
5935 class RepresentationField : public BitField<Representation::Kind, 3, 3> {}; 5935 class RepresentationField : public BitField<Representation::Kind, 3, 4> {};
5936 class OffsetField : public BitField<int, 6, 26> {}; 5936 class OffsetField : public BitField<int, 7, 25> {};
5937 5937
5938 uint32_t value_; // encodes portion, representation, and offset 5938 uint32_t value_; // encodes portion, representation, and offset
5939 Handle<String> name_; 5939 Handle<String> name_;
5940 5940
5941 friend class HLoadNamedField; 5941 friend class HLoadNamedField;
5942 friend class HStoreNamedField; 5942 friend class HStoreNamedField;
5943 5943
5944 inline Portion portion() const { 5944 inline Portion portion() const {
5945 return PortionField::decode(value_); 5945 return PortionField::decode(value_);
5946 } 5946 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
5979 HLoadNamedField* b = HLoadNamedField::cast(other); 5979 HLoadNamedField* b = HLoadNamedField::cast(other);
5980 return access_.Equals(b->access_); 5980 return access_.Equals(b->access_);
5981 } 5981 }
5982 5982
5983 private: 5983 private:
5984 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { 5984 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) {
5985 ASSERT(object != NULL); 5985 ASSERT(object != NULL);
5986 SetOperandAt(0, object); 5986 SetOperandAt(0, object);
5987 5987
5988 Representation representation = access.representation(); 5988 Representation representation = access.representation();
5989 if (representation.IsByte()) { 5989 if (representation.IsInteger8() ||
5990 representation.IsUInteger8() ||
5991 representation.IsInteger16() ||
5992 representation.IsUInteger16()) {
5990 set_representation(Representation::Integer32()); 5993 set_representation(Representation::Integer32());
5991 } else if (representation.IsSmi()) { 5994 } else if (representation.IsSmi()) {
5992 set_type(HType::Smi()); 5995 set_type(HType::Smi());
5993 set_representation(representation); 5996 set_representation(representation);
5994 } else if (representation.IsDouble() || 5997 } else if (representation.IsDouble() ||
5995 representation.IsExternal() || 5998 representation.IsExternal() ||
5996 representation.IsInteger32()) { 5999 representation.IsInteger32()) {
5997 set_representation(representation); 6000 set_representation(representation);
5998 } else if (FLAG_track_heap_object_fields && 6001 } else if (FLAG_track_heap_object_fields &&
5999 representation.IsHeapObject()) { 6002 representation.IsHeapObject()) {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
6289 return index == 1; 6292 return index == 1;
6290 } 6293 }
6291 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6294 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6292 return !access().IsInobject() || access().offset() >= size; 6295 return !access().IsInobject() || access().offset() >= size;
6293 } 6296 }
6294 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6297 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6295 if (index == 0 && access().IsExternalMemory()) { 6298 if (index == 0 && access().IsExternalMemory()) {
6296 // object must be external in case of external memory access 6299 // object must be external in case of external memory access
6297 return Representation::External(); 6300 return Representation::External();
6298 } else if (index == 1) { 6301 } else if (index == 1) {
6299 if (field_representation().IsByte() || 6302 if (field_representation().IsInteger8() ||
6303 field_representation().IsUInteger8() ||
6304 field_representation().IsInteger16() ||
6305 field_representation().IsUInteger16() ||
6300 field_representation().IsInteger32()) { 6306 field_representation().IsInteger32()) {
6301 return Representation::Integer32(); 6307 return Representation::Integer32();
6302 } else if (field_representation().IsDouble() || 6308 } else if (field_representation().IsDouble() ||
6303 field_representation().IsSmi()) { 6309 field_representation().IsSmi()) {
6304 return field_representation(); 6310 return field_representation();
6305 } 6311 }
6306 } 6312 }
6307 return Representation::Tagged(); 6313 return Representation::Tagged();
6308 } 6314 }
6309 virtual void HandleSideEffectDominator(GVNFlag side_effect, 6315 virtual void HandleSideEffectDominator(GVNFlag side_effect,
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
7190 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7196 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7191 }; 7197 };
7192 7198
7193 7199
7194 #undef DECLARE_INSTRUCTION 7200 #undef DECLARE_INSTRUCTION
7195 #undef DECLARE_CONCRETE_INSTRUCTION 7201 #undef DECLARE_CONCRETE_INSTRUCTION
7196 7202
7197 } } // namespace v8::internal 7203 } } // namespace v8::internal
7198 7204
7199 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7205 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698