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

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

Issue 11528003: Re-land Crankshaft-generated KeyedLoad stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits Created 8 years 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 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 1937
1938 class HJSArrayLength: public HTemplateInstruction<2> { 1938 class HJSArrayLength: public HTemplateInstruction<2> {
1939 public: 1939 public:
1940 HJSArrayLength(HValue* value, HValue* typecheck, 1940 HJSArrayLength(HValue* value, HValue* typecheck,
1941 HType type = HType::Tagged()) { 1941 HType type = HType::Tagged()) {
1942 set_type(type); 1942 set_type(type);
1943 // The length of an array is stored as a tagged value in the array 1943 // The length of an array is stored as a tagged value in the array
1944 // object. It is guaranteed to be 32 bit integer, but it can be 1944 // object. It is guaranteed to be 32 bit integer, but it can be
1945 // represented as either a smi or heap number. 1945 // represented as either a smi or heap number.
1946 SetOperandAt(0, value); 1946 SetOperandAt(0, value);
1947 SetOperandAt(1, typecheck); 1947 SetOperandAt(1, typecheck != NULL ? typecheck : value);
Jakob Kummerow 2012/12/11 14:05:54 I could swear I've reviewed this change before...
danno 2012/12/12 00:36:03 Landed the other patch first, rebased on it. On 20
1948 set_representation(Representation::Tagged()); 1948 set_representation(Representation::Tagged());
1949 SetFlag(kUseGVN); 1949 SetFlag(kUseGVN);
1950 SetGVNFlag(kDependsOnArrayLengths); 1950 SetGVNFlag(kDependsOnArrayLengths);
1951 SetGVNFlag(kDependsOnMaps); 1951 SetGVNFlag(kDependsOnMaps);
1952 } 1952 }
1953 1953
1954 virtual Representation RequiredInputRepresentation(int index) { 1954 virtual Representation RequiredInputRepresentation(int index) {
1955 return Representation::Tagged(); 1955 return Representation::Tagged();
1956 } 1956 }
1957 1957
1958 virtual void PrintDataTo(StringStream* stream); 1958 virtual void PrintDataTo(StringStream* stream);
1959 1959
1960 HValue* value() { return OperandAt(0); } 1960 HValue* value() { return OperandAt(0); }
1961 HValue* typecheck() { return OperandAt(1); } 1961 HValue* typecheck() {
1962 ASSERT(HasTypeCheck());
1963 return OperandAt(1);
1964 }
1965 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
1962 1966
1963 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) 1967 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength)
1964 1968
1965 protected: 1969 protected:
1966 virtual bool DataEquals(HValue* other_raw) { return true; } 1970 virtual bool DataEquals(HValue* other_raw) { return true; }
1967 1971
1968 private: 1972 private:
1969 virtual bool IsDeletable() const { return true; } 1973 virtual bool IsDeletable() const { return true; }
1970 }; 1974 };
1971 1975
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 virtual bool IsDeletable() const { return true; } 2156 virtual bool IsDeletable() const { return true; }
2153 2157
2154 BuiltinFunctionId op_; 2158 BuiltinFunctionId op_;
2155 }; 2159 };
2156 2160
2157 2161
2158 class HLoadElements: public HTemplateInstruction<2> { 2162 class HLoadElements: public HTemplateInstruction<2> {
2159 public: 2163 public:
2160 HLoadElements(HValue* value, HValue* typecheck) { 2164 HLoadElements(HValue* value, HValue* typecheck) {
2161 SetOperandAt(0, value); 2165 SetOperandAt(0, value);
2162 SetOperandAt(1, typecheck); 2166 SetOperandAt(1, typecheck != NULL ? typecheck : value);
2163 set_representation(Representation::Tagged()); 2167 set_representation(Representation::Tagged());
2164 SetFlag(kUseGVN); 2168 SetFlag(kUseGVN);
2165 SetGVNFlag(kDependsOnElementsPointer); 2169 SetGVNFlag(kDependsOnElementsPointer);
2166 } 2170 }
2167 2171
2168 HValue* value() { return OperandAt(0); } 2172 HValue* value() { return OperandAt(0); }
2169 HValue* typecheck() { return OperandAt(1); } 2173 HValue* typecheck() {
2174 ASSERT(HasTypeCheck());
2175 return OperandAt(1);
2176 }
2177 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
2170 2178
2171 virtual void PrintDataTo(StringStream* stream); 2179 virtual void PrintDataTo(StringStream* stream);
2172 2180
2173 virtual Representation RequiredInputRepresentation(int index) { 2181 virtual Representation RequiredInputRepresentation(int index) {
2174 return Representation::Tagged(); 2182 return Representation::Tagged();
2175 } 2183 }
2176 2184
2177 DECLARE_CONCRETE_INSTRUCTION(LoadElements) 2185 DECLARE_CONCRETE_INSTRUCTION(LoadElements)
2178 2186
2179 protected: 2187 protected:
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4380 : public HTemplateInstruction<4>, public ArrayInstructionInterface { 4388 : public HTemplateInstruction<4>, public ArrayInstructionInterface {
4381 public: 4389 public:
4382 HLoadKeyed(HValue* obj, 4390 HLoadKeyed(HValue* obj,
4383 HValue* checked_key, 4391 HValue* checked_key,
4384 HValue* dependency, 4392 HValue* dependency,
4385 ElementsKind elements_kind) 4393 ElementsKind elements_kind)
4386 : bit_field_(0) { 4394 : bit_field_(0) {
4387 bit_field_ = ElementsKindField::encode(elements_kind); 4395 bit_field_ = ElementsKindField::encode(elements_kind);
4388 SetOperandAt(0, obj); 4396 SetOperandAt(0, obj);
4389 SetOperandAt(1, HBoundsCheck::ExtractUncheckedIndex(checked_key)); 4397 SetOperandAt(1, HBoundsCheck::ExtractUncheckedIndex(checked_key));
4390 SetOperandAt(2, dependency); 4398 SetOperandAt(2, dependency != NULL ? dependency : obj);
4391 SetOperandAt(3, checked_key); 4399 SetOperandAt(3, checked_key);
4392 4400
4393 if (!is_external()) { 4401 if (!is_external()) {
4394 // I can detect the case between storing double (holey and fast) and 4402 // I can detect the case between storing double (holey and fast) and
4395 // smi/object by looking at elements_kind_. 4403 // smi/object by looking at elements_kind_.
4396 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || 4404 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) ||
4397 IsFastDoubleElementsKind(elements_kind)); 4405 IsFastDoubleElementsKind(elements_kind));
4398 4406
4399 if (IsFastSmiOrObjectElementsKind(elements_kind)) { 4407 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
4400 if (IsFastSmiElementsKind(elements_kind) && 4408 if (IsFastSmiElementsKind(elements_kind) &&
(...skipping 21 matching lines...) Expand all
4422 } 4430 }
4423 4431
4424 SetFlag(kUseGVN); 4432 SetFlag(kUseGVN);
4425 } 4433 }
4426 4434
4427 bool is_external() const { 4435 bool is_external() const {
4428 return IsExternalArrayElementsKind(elements_kind()); 4436 return IsExternalArrayElementsKind(elements_kind());
4429 } 4437 }
4430 HValue* elements() { return OperandAt(0); } 4438 HValue* elements() { return OperandAt(0); }
4431 HValue* key() { return OperandAt(1); } 4439 HValue* key() { return OperandAt(1); }
4432 HValue* dependency() { return OperandAt(2); } 4440 HValue* dependency() {
4441 ASSERT(HasDependency());
4442 return OperandAt(2);
4443 }
4444 bool HasDependency() const { return OperandAt(0) != OperandAt(2); }
4433 HValue* checked_key() { return OperandAt(3); } 4445 HValue* checked_key() { return OperandAt(3); }
4434 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } 4446 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); }
4435 void SetIndexOffset(uint32_t index_offset) { 4447 void SetIndexOffset(uint32_t index_offset) {
4436 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); 4448 bit_field_ = IndexOffsetField::update(bit_field_, index_offset);
4437 } 4449 }
4438 HValue* GetKey() { return key(); } 4450 HValue* GetKey() { return key(); }
4439 void SetKey(HValue* key) { SetOperandAt(1, key); } 4451 void SetKey(HValue* key) { SetOperandAt(1, key); }
4440 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } 4452 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); }
4441 void SetDehoisted(bool is_dehoisted) { 4453 void SetDehoisted(bool is_dehoisted) {
4442 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); 4454 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted);
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
5470 virtual bool IsDeletable() const { return true; } 5482 virtual bool IsDeletable() const { return true; }
5471 }; 5483 };
5472 5484
5473 5485
5474 #undef DECLARE_INSTRUCTION 5486 #undef DECLARE_INSTRUCTION
5475 #undef DECLARE_CONCRETE_INSTRUCTION 5487 #undef DECLARE_CONCRETE_INSTRUCTION
5476 5488
5477 } } // namespace v8::internal 5489 } } // namespace v8::internal
5478 5490
5479 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 5491 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698