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

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

Issue 132373011: A64: Synchronize with r17635. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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.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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 V(OsrEntry) \ 152 V(OsrEntry) \
153 V(OuterContext) \ 153 V(OuterContext) \
154 V(Parameter) \ 154 V(Parameter) \
155 V(Power) \ 155 V(Power) \
156 V(PushArgument) \ 156 V(PushArgument) \
157 V(Random) \ 157 V(Random) \
158 V(RegExpLiteral) \ 158 V(RegExpLiteral) \
159 V(Return) \ 159 V(Return) \
160 V(Ror) \ 160 V(Ror) \
161 V(Sar) \ 161 V(Sar) \
162 V(SeqStringGetChar) \
162 V(SeqStringSetChar) \ 163 V(SeqStringSetChar) \
163 V(Shl) \ 164 V(Shl) \
164 V(Shr) \ 165 V(Shr) \
165 V(Simulate) \ 166 V(Simulate) \
166 V(StackCheck) \ 167 V(StackCheck) \
167 V(StoreCodeEntry) \ 168 V(StoreCodeEntry) \
168 V(StoreContextSlot) \ 169 V(StoreContextSlot) \
169 V(StoreGlobalCell) \ 170 V(StoreGlobalCell) \
170 V(StoreGlobalGeneric) \ 171 V(StoreGlobalGeneric) \
171 V(StoreKeyed) \ 172 V(StoreKeyed) \
(...skipping 3079 matching lines...) Expand 10 before | Expand all | Expand 10 after
3251 } 3252 }
3252 3253
3253 protected: 3254 protected:
3254 virtual void InternalSetOperandAt(int index, 3255 virtual void InternalSetOperandAt(int index,
3255 HValue* value) V8_FINAL V8_OVERRIDE { 3256 HValue* value) V8_FINAL V8_OVERRIDE {
3256 values_[index] = value; 3257 values_[index] = value;
3257 } 3258 }
3258 3259
3259 // List of values tracked by this marker. 3260 // List of values tracked by this marker.
3260 ZoneList<HValue*> values_; 3261 ZoneList<HValue*> values_;
3261
3262 private:
3263 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; }
3264 }; 3262 };
3265 3263
3266 3264
3267 class HArgumentsObject V8_FINAL : public HDematerializedObject { 3265 class HArgumentsObject V8_FINAL : public HDematerializedObject {
3268 public: 3266 public:
3269 static HArgumentsObject* New(Zone* zone, HValue* context, int count) { 3267 static HArgumentsObject* New(Zone* zone, HValue* context, int count) {
3270 return new(zone) HArgumentsObject(count, zone); 3268 return new(zone) HArgumentsObject(count, zone);
3271 } 3269 }
3272 3270
3273 // The values contain a list of all elements in the arguments object 3271 // The values contain a list of all elements in the arguments object
3274 // including the receiver object, which is skipped when materializing. 3272 // including the receiver object, which is skipped when materializing.
3275 const ZoneList<HValue*>* arguments_values() const { return &values_; } 3273 const ZoneList<HValue*>* arguments_values() const { return &values_; }
3276 int arguments_count() const { return values_.length(); } 3274 int arguments_count() const { return values_.length(); }
3277 3275
3278 void AddArgument(HValue* argument, Zone* zone) { 3276 void AddArgument(HValue* argument, Zone* zone) {
3279 values_.Add(NULL, zone); // Resize list. 3277 values_.Add(NULL, zone); // Resize list.
3280 SetOperandAt(values_.length() - 1, argument); 3278 SetOperandAt(values_.length() - 1, argument);
3281 } 3279 }
3282 3280
3283 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) 3281 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject)
3284 3282
3285 private: 3283 private:
3286 HArgumentsObject(int count, Zone* zone) 3284 HArgumentsObject(int count, Zone* zone)
3287 : HDematerializedObject(count, zone) { 3285 : HDematerializedObject(count, zone) {
3288 set_representation(Representation::Tagged()); 3286 set_representation(Representation::Tagged());
3289 SetFlag(kIsArguments); 3287 SetFlag(kIsArguments);
3290 } 3288 }
3289
3290 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; }
3291 }; 3291 };
3292 3292
3293 3293
3294 class HCapturedObject V8_FINAL : public HDematerializedObject { 3294 class HCapturedObject V8_FINAL : public HDematerializedObject {
3295 public: 3295 public:
3296 HCapturedObject(int length, int id, Zone* zone) 3296 HCapturedObject(int length, int id, Zone* zone)
3297 : HDematerializedObject(length, zone), capture_id_(id) { 3297 : HDematerializedObject(length, zone), capture_id_(id) {
3298 set_representation(Representation::Tagged()); 3298 set_representation(Representation::Tagged());
3299 values_.AddBlock(NULL, length, zone); // Resize list. 3299 values_.AddBlock(NULL, length, zone); // Resize list.
3300 } 3300 }
(...skipping 16 matching lines...) Expand all
3317 3317
3318 // Replay effects of this instruction on the given environment. 3318 // Replay effects of this instruction on the given environment.
3319 void ReplayEnvironment(HEnvironment* env); 3319 void ReplayEnvironment(HEnvironment* env);
3320 3320
3321 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3321 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
3322 3322
3323 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) 3323 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3324 3324
3325 private: 3325 private:
3326 int capture_id_; 3326 int capture_id_;
3327
3328 // Note that we cannot DCE captured objects as they are used to replay
3329 // the environment. This method is here as an explicit reminder.
3330 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe?
3331 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return false; }
3327 }; 3332 };
3328 3333
3329 3334
3330 class HConstant V8_FINAL : public HTemplateInstruction<0> { 3335 class HConstant V8_FINAL : public HTemplateInstruction<0> {
3331 public: 3336 public:
3332 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); 3337 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t);
3333 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); 3338 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation);
3334 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); 3339 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double);
3335 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); 3340 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>);
3336 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); 3341 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference);
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after
5796 return HObjectAccess(kExternalMemory, 0, Representation::Tagged()); 5801 return HObjectAccess(kExternalMemory, 0, Representation::Tagged());
5797 } 5802 }
5798 5803
5799 static HObjectAccess ForFixedArrayLength() { 5804 static HObjectAccess ForFixedArrayLength() {
5800 return HObjectAccess( 5805 return HObjectAccess(
5801 kArrayLengths, 5806 kArrayLengths,
5802 FixedArray::kLengthOffset, 5807 FixedArray::kLengthOffset,
5803 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); 5808 FLAG_track_fields ? Representation::Smi() : Representation::Tagged());
5804 } 5809 }
5805 5810
5811 static HObjectAccess ForStringHashField() {
5812 return HObjectAccess(kInobject,
5813 String::kHashFieldOffset,
5814 Representation::Integer32());
5815 }
5816
5806 static HObjectAccess ForStringLength() { 5817 static HObjectAccess ForStringLength() {
5807 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 5818 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
5808 return HObjectAccess( 5819 return HObjectAccess(
5809 kStringLengths, 5820 kStringLengths,
5810 String::kLengthOffset, 5821 String::kLengthOffset,
5811 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); 5822 FLAG_track_fields ? Representation::Smi() : Representation::Tagged());
5812 } 5823 }
5813 5824
5825 static HObjectAccess ForConsStringFirst() {
5826 return HObjectAccess(kInobject, ConsString::kFirstOffset);
5827 }
5828
5829 static HObjectAccess ForConsStringSecond() {
5830 return HObjectAccess(kInobject, ConsString::kSecondOffset);
5831 }
5832
5814 static HObjectAccess ForPropertiesPointer() { 5833 static HObjectAccess ForPropertiesPointer() {
5815 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); 5834 return HObjectAccess(kInobject, JSObject::kPropertiesOffset);
5816 } 5835 }
5817 5836
5818 static HObjectAccess ForPrototypeOrInitialMap() { 5837 static HObjectAccess ForPrototypeOrInitialMap() {
5819 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); 5838 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset);
5820 } 5839 }
5821 5840
5822 static HObjectAccess ForSharedFunctionInfoPointer() { 5841 static HObjectAccess ForSharedFunctionInfoPointer() {
5823 return HObjectAccess(kInobject, JSFunction::kSharedFunctionInfoOffset); 5842 return HObjectAccess(kInobject, JSFunction::kSharedFunctionInfoOffset);
(...skipping 24 matching lines...) Expand all
5848 return HObjectAccess(kInobject, JSFunction::kContextOffset); 5867 return HObjectAccess(kInobject, JSFunction::kContextOffset);
5849 } 5868 }
5850 5869
5851 static HObjectAccess ForMap() { 5870 static HObjectAccess ForMap() {
5852 return HObjectAccess(kMaps, JSObject::kMapOffset); 5871 return HObjectAccess(kMaps, JSObject::kMapOffset);
5853 } 5872 }
5854 5873
5855 static HObjectAccess ForMapInstanceSize() { 5874 static HObjectAccess ForMapInstanceSize() {
5856 return HObjectAccess(kInobject, 5875 return HObjectAccess(kInobject,
5857 Map::kInstanceSizeOffset, 5876 Map::kInstanceSizeOffset,
5858 Representation::Byte()); 5877 Representation::UInteger8());
5878 }
5879
5880 static HObjectAccess ForMapInstanceType() {
5881 return HObjectAccess(kInobject,
5882 Map::kInstanceTypeOffset,
5883 Representation::UInteger8());
5859 } 5884 }
5860 5885
5861 static HObjectAccess ForPropertyCellValue() { 5886 static HObjectAccess ForPropertyCellValue() {
5862 return HObjectAccess(kInobject, PropertyCell::kValueOffset); 5887 return HObjectAccess(kInobject, PropertyCell::kValueOffset);
5863 } 5888 }
5864 5889
5865 static HObjectAccess ForCellValue() { 5890 static HObjectAccess ForCellValue() {
5866 return HObjectAccess(kInobject, Cell::kValueOffset); 5891 return HObjectAccess(kInobject, Cell::kValueOffset);
5867 } 5892 }
5868 5893
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5926 RepresentationField::encode(representation.kind()) | 5951 RepresentationField::encode(representation.kind()) |
5927 OffsetField::encode(offset)), 5952 OffsetField::encode(offset)),
5928 name_(name) { 5953 name_(name) {
5929 // assert that the fields decode correctly 5954 // assert that the fields decode correctly
5930 ASSERT(this->offset() == offset); 5955 ASSERT(this->offset() == offset);
5931 ASSERT(this->portion() == portion); 5956 ASSERT(this->portion() == portion);
5932 ASSERT(RepresentationField::decode(value_) == representation.kind()); 5957 ASSERT(RepresentationField::decode(value_) == representation.kind());
5933 } 5958 }
5934 5959
5935 class PortionField : public BitField<Portion, 0, 3> {}; 5960 class PortionField : public BitField<Portion, 0, 3> {};
5936 class RepresentationField : public BitField<Representation::Kind, 3, 3> {}; 5961 class RepresentationField : public BitField<Representation::Kind, 3, 4> {};
5937 class OffsetField : public BitField<int, 6, 26> {}; 5962 class OffsetField : public BitField<int, 7, 25> {};
5938 5963
5939 uint32_t value_; // encodes portion, representation, and offset 5964 uint32_t value_; // encodes portion, representation, and offset
5940 Handle<String> name_; 5965 Handle<String> name_;
5941 5966
5942 friend class HLoadNamedField; 5967 friend class HLoadNamedField;
5943 friend class HStoreNamedField; 5968 friend class HStoreNamedField;
5944 5969
5945 inline Portion portion() const { 5970 inline Portion portion() const {
5946 return PortionField::decode(value_); 5971 return PortionField::decode(value_);
5947 } 5972 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
5980 HLoadNamedField* b = HLoadNamedField::cast(other); 6005 HLoadNamedField* b = HLoadNamedField::cast(other);
5981 return access_.Equals(b->access_); 6006 return access_.Equals(b->access_);
5982 } 6007 }
5983 6008
5984 private: 6009 private:
5985 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { 6010 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) {
5986 ASSERT(object != NULL); 6011 ASSERT(object != NULL);
5987 SetOperandAt(0, object); 6012 SetOperandAt(0, object);
5988 6013
5989 Representation representation = access.representation(); 6014 Representation representation = access.representation();
5990 if (representation.IsByte()) { 6015 if (representation.IsInteger8() ||
6016 representation.IsUInteger8() ||
6017 representation.IsInteger16() ||
6018 representation.IsUInteger16()) {
5991 set_representation(Representation::Integer32()); 6019 set_representation(Representation::Integer32());
5992 } else if (representation.IsSmi()) { 6020 } else if (representation.IsSmi()) {
5993 set_type(HType::Smi()); 6021 set_type(HType::Smi());
5994 set_representation(representation); 6022 set_representation(representation);
5995 } else if (representation.IsDouble() || 6023 } else if (representation.IsDouble() ||
5996 representation.IsExternal() || 6024 representation.IsExternal() ||
5997 representation.IsInteger32()) { 6025 representation.IsInteger32()) {
5998 set_representation(representation); 6026 set_representation(representation);
5999 } else if (FLAG_track_heap_object_fields && 6027 } else if (FLAG_track_heap_object_fields &&
6000 representation.IsHeapObject()) { 6028 representation.IsHeapObject()) {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
6290 return index == 1; 6318 return index == 1;
6291 } 6319 }
6292 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6320 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6293 return !access().IsInobject() || access().offset() >= size; 6321 return !access().IsInobject() || access().offset() >= size;
6294 } 6322 }
6295 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6323 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6296 if (index == 0 && access().IsExternalMemory()) { 6324 if (index == 0 && access().IsExternalMemory()) {
6297 // object must be external in case of external memory access 6325 // object must be external in case of external memory access
6298 return Representation::External(); 6326 return Representation::External();
6299 } else if (index == 1) { 6327 } else if (index == 1) {
6300 if (field_representation().IsByte() || 6328 if (field_representation().IsInteger8() ||
6329 field_representation().IsUInteger8() ||
6330 field_representation().IsInteger16() ||
6331 field_representation().IsUInteger16() ||
6301 field_representation().IsInteger32()) { 6332 field_representation().IsInteger32()) {
6302 return Representation::Integer32(); 6333 return Representation::Integer32();
6303 } else if (field_representation().IsDouble() || 6334 } else if (field_representation().IsDouble() ||
6304 field_representation().IsSmi()) { 6335 field_representation().IsSmi()) {
6305 return field_representation(); 6336 return field_representation();
6306 } 6337 }
6307 } 6338 }
6308 return Representation::Tagged(); 6339 return Representation::Tagged();
6309 } 6340 }
6310 virtual void HandleSideEffectDominator(GVNFlag side_effect, 6341 virtual void HandleSideEffectDominator(GVNFlag side_effect,
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
7016 private: 7047 private:
7017 HDateField(HValue* date, Smi* index) 7048 HDateField(HValue* date, Smi* index)
7018 : HUnaryOperation(date), index_(index) { 7049 : HUnaryOperation(date), index_(index) {
7019 set_representation(Representation::Tagged()); 7050 set_representation(Representation::Tagged());
7020 } 7051 }
7021 7052
7022 Smi* index_; 7053 Smi* index_;
7023 }; 7054 };
7024 7055
7025 7056
7057 class HSeqStringGetChar V8_FINAL : public HTemplateInstruction<2> {
7058 public:
7059 static HInstruction* New(Zone* zone,
7060 HValue* context,
7061 String::Encoding encoding,
7062 HValue* string,
7063 HValue* index);
7064
7065 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7066 return (index == 0) ? Representation::Tagged()
7067 : Representation::Integer32();
7068 }
7069
7070 String::Encoding encoding() const { return encoding_; }
7071 HValue* string() const { return OperandAt(0); }
7072 HValue* index() const { return OperandAt(1); }
7073
7074 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar)
7075
7076 protected:
7077 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
7078 return encoding() == HSeqStringGetChar::cast(other)->encoding();
7079 }
7080
7081 virtual Range* InferRange(Zone* zone) V8_OVERRIDE {
7082 if (encoding() == String::ONE_BYTE_ENCODING) {
7083 return new(zone) Range(0, String::kMaxOneByteCharCode);
7084 } else {
7085 ASSERT_EQ(String::TWO_BYTE_ENCODING, encoding());
7086 return new(zone) Range(0, String::kMaxUtf16CodeUnit);
7087 }
7088 }
7089
7090 private:
7091 HSeqStringGetChar(String::Encoding encoding,
7092 HValue* string,
7093 HValue* index) : encoding_(encoding) {
7094 SetOperandAt(0, string);
7095 SetOperandAt(1, index);
7096 set_representation(Representation::Integer32());
7097 SetFlag(kUseGVN);
7098 SetGVNFlag(kDependsOnStringChars);
7099 }
7100
7101 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7102
7103 String::Encoding encoding_;
7104 };
7105
7106
7026 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> { 7107 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> {
7027 public: 7108 public:
7028 DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding, 7109 DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding,
7029 HValue*, HValue*, HValue*); 7110 HValue*, HValue*, HValue*);
7030 7111
7031 String::Encoding encoding() { return encoding_; } 7112 String::Encoding encoding() { return encoding_; }
7032 HValue* string() { return OperandAt(0); } 7113 HValue* string() { return OperandAt(0); }
7033 HValue* index() { return OperandAt(1); } 7114 HValue* index() { return OperandAt(1); }
7034 HValue* value() { return OperandAt(2); } 7115 HValue* value() { return OperandAt(2); }
7035 7116
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
7193 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7274 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7194 }; 7275 };
7195 7276
7196 7277
7197 #undef DECLARE_INSTRUCTION 7278 #undef DECLARE_INSTRUCTION
7198 #undef DECLARE_CONCRETE_INSTRUCTION 7279 #undef DECLARE_CONCRETE_INSTRUCTION
7199 7280
7200 } } // namespace v8::internal 7281 } } // namespace v8::internal
7201 7282
7202 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7283 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698