OLD | NEW |
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 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 | 1930 |
1931 class HJSArrayLength: public HTemplateInstruction<2> { | 1931 class HJSArrayLength: public HTemplateInstruction<2> { |
1932 public: | 1932 public: |
1933 HJSArrayLength(HValue* value, HValue* typecheck, | 1933 HJSArrayLength(HValue* value, HValue* typecheck, |
1934 HType type = HType::Tagged()) { | 1934 HType type = HType::Tagged()) { |
1935 set_type(type); | 1935 set_type(type); |
1936 // The length of an array is stored as a tagged value in the array | 1936 // The length of an array is stored as a tagged value in the array |
1937 // object. It is guaranteed to be 32 bit integer, but it can be | 1937 // object. It is guaranteed to be 32 bit integer, but it can be |
1938 // represented as either a smi or heap number. | 1938 // represented as either a smi or heap number. |
1939 SetOperandAt(0, value); | 1939 SetOperandAt(0, value); |
1940 SetOperandAt(1, typecheck); | 1940 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
1941 set_representation(Representation::Tagged()); | 1941 set_representation(Representation::Tagged()); |
1942 SetFlag(kUseGVN); | 1942 SetFlag(kUseGVN); |
1943 SetGVNFlag(kDependsOnArrayLengths); | 1943 SetGVNFlag(kDependsOnArrayLengths); |
1944 SetGVNFlag(kDependsOnMaps); | 1944 SetGVNFlag(kDependsOnMaps); |
1945 } | 1945 } |
1946 | 1946 |
1947 virtual Representation RequiredInputRepresentation(int index) { | 1947 virtual Representation RequiredInputRepresentation(int index) { |
1948 return Representation::Tagged(); | 1948 return Representation::Tagged(); |
1949 } | 1949 } |
1950 | 1950 |
1951 virtual void PrintDataTo(StringStream* stream); | 1951 virtual void PrintDataTo(StringStream* stream); |
1952 | 1952 |
1953 HValue* value() { return OperandAt(0); } | 1953 HValue* value() { return OperandAt(0); } |
1954 HValue* typecheck() { return OperandAt(1); } | 1954 HValue* typecheck() { |
| 1955 ASSERT(HasTypeCheck()); |
| 1956 return OperandAt(1); |
| 1957 } |
| 1958 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } |
1955 | 1959 |
1956 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) | 1960 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) |
1957 | 1961 |
1958 protected: | 1962 protected: |
1959 virtual bool DataEquals(HValue* other_raw) { return true; } | 1963 virtual bool DataEquals(HValue* other_raw) { return true; } |
1960 | 1964 |
1961 private: | 1965 private: |
1962 virtual bool IsDeletable() const { return true; } | 1966 virtual bool IsDeletable() const { return true; } |
1963 }; | 1967 }; |
1964 | 1968 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 virtual bool IsDeletable() const { return true; } | 2149 virtual bool IsDeletable() const { return true; } |
2146 | 2150 |
2147 BuiltinFunctionId op_; | 2151 BuiltinFunctionId op_; |
2148 }; | 2152 }; |
2149 | 2153 |
2150 | 2154 |
2151 class HLoadElements: public HTemplateInstruction<2> { | 2155 class HLoadElements: public HTemplateInstruction<2> { |
2152 public: | 2156 public: |
2153 HLoadElements(HValue* value, HValue* typecheck) { | 2157 HLoadElements(HValue* value, HValue* typecheck) { |
2154 SetOperandAt(0, value); | 2158 SetOperandAt(0, value); |
2155 SetOperandAt(1, typecheck); | 2159 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
2156 set_representation(Representation::Tagged()); | 2160 set_representation(Representation::Tagged()); |
2157 SetFlag(kUseGVN); | 2161 SetFlag(kUseGVN); |
2158 SetGVNFlag(kDependsOnElementsPointer); | 2162 SetGVNFlag(kDependsOnElementsPointer); |
2159 } | 2163 } |
2160 | 2164 |
2161 HValue* value() { return OperandAt(0); } | 2165 HValue* value() { return OperandAt(0); } |
2162 HValue* typecheck() { return OperandAt(1); } | 2166 HValue* typecheck() { |
| 2167 ASSERT(HasTypeCheck()); |
| 2168 return OperandAt(1); |
| 2169 } |
| 2170 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } |
2163 | 2171 |
2164 virtual void PrintDataTo(StringStream* stream); | 2172 virtual void PrintDataTo(StringStream* stream); |
2165 | 2173 |
2166 virtual Representation RequiredInputRepresentation(int index) { | 2174 virtual Representation RequiredInputRepresentation(int index) { |
2167 return Representation::Tagged(); | 2175 return Representation::Tagged(); |
2168 } | 2176 } |
2169 | 2177 |
2170 DECLARE_CONCRETE_INSTRUCTION(LoadElements) | 2178 DECLARE_CONCRETE_INSTRUCTION(LoadElements) |
2171 | 2179 |
2172 protected: | 2180 protected: |
(...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4359 public: | 4367 public: |
4360 HLoadKeyed(HValue* obj, | 4368 HLoadKeyed(HValue* obj, |
4361 HValue* key, | 4369 HValue* key, |
4362 HValue* dependency, | 4370 HValue* dependency, |
4363 ElementsKind elements_kind) | 4371 ElementsKind elements_kind) |
4364 : bit_field_(0) { | 4372 : bit_field_(0) { |
4365 bit_field_ = ElementsKindField::encode(elements_kind); | 4373 bit_field_ = ElementsKindField::encode(elements_kind); |
4366 | 4374 |
4367 SetOperandAt(0, obj); | 4375 SetOperandAt(0, obj); |
4368 SetOperandAt(1, key); | 4376 SetOperandAt(1, key); |
4369 SetOperandAt(2, dependency); | 4377 SetOperandAt(2, dependency != NULL ? dependency : obj); |
4370 | 4378 |
4371 if (!is_external()) { | 4379 if (!is_external()) { |
4372 // I can detect the case between storing double (holey and fast) and | 4380 // I can detect the case between storing double (holey and fast) and |
4373 // smi/object by looking at elements_kind_. | 4381 // smi/object by looking at elements_kind_. |
4374 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || | 4382 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || |
4375 IsFastDoubleElementsKind(elements_kind)); | 4383 IsFastDoubleElementsKind(elements_kind)); |
4376 | 4384 |
4377 if (IsFastSmiOrObjectElementsKind(elements_kind)) { | 4385 if (IsFastSmiOrObjectElementsKind(elements_kind)) { |
4378 if (IsFastSmiElementsKind(elements_kind) && | 4386 if (IsFastSmiElementsKind(elements_kind) && |
4379 IsFastPackedElementsKind(elements_kind)) { | 4387 IsFastPackedElementsKind(elements_kind)) { |
(...skipping 20 matching lines...) Expand all Loading... |
4400 } | 4408 } |
4401 | 4409 |
4402 SetFlag(kUseGVN); | 4410 SetFlag(kUseGVN); |
4403 } | 4411 } |
4404 | 4412 |
4405 bool is_external() const { | 4413 bool is_external() const { |
4406 return IsExternalArrayElementsKind(elements_kind()); | 4414 return IsExternalArrayElementsKind(elements_kind()); |
4407 } | 4415 } |
4408 HValue* elements() { return OperandAt(0); } | 4416 HValue* elements() { return OperandAt(0); } |
4409 HValue* key() { return OperandAt(1); } | 4417 HValue* key() { return OperandAt(1); } |
4410 HValue* dependency() { return OperandAt(2); } | 4418 HValue* dependency() { |
| 4419 ASSERT(HasDependency()); |
| 4420 return OperandAt(2); |
| 4421 } |
| 4422 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
4411 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } | 4423 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } |
4412 void SetIndexOffset(uint32_t index_offset) { | 4424 void SetIndexOffset(uint32_t index_offset) { |
4413 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); | 4425 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); |
4414 } | 4426 } |
4415 HValue* GetKey() { return key(); } | 4427 HValue* GetKey() { return key(); } |
4416 void SetKey(HValue* key) { SetOperandAt(1, key); } | 4428 void SetKey(HValue* key) { SetOperandAt(1, key); } |
4417 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } | 4429 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } |
4418 void SetDehoisted(bool is_dehoisted) { | 4430 void SetDehoisted(bool is_dehoisted) { |
4419 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 4431 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
4420 } | 4432 } |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5430 virtual bool IsDeletable() const { return true; } | 5442 virtual bool IsDeletable() const { return true; } |
5431 }; | 5443 }; |
5432 | 5444 |
5433 | 5445 |
5434 #undef DECLARE_INSTRUCTION | 5446 #undef DECLARE_INSTRUCTION |
5435 #undef DECLARE_CONCRETE_INSTRUCTION | 5447 #undef DECLARE_CONCRETE_INSTRUCTION |
5436 | 5448 |
5437 } } // namespace v8::internal | 5449 } } // namespace v8::internal |
5438 | 5450 |
5439 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5451 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |