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

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

Issue 7298003: Add fake data dependencies (instead of disabling GVN) to fix code motion (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: stricter instruction ordering Created 9 years, 5 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 } 1661 }
1662 1662
1663 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) 1663 DECLARE_CONCRETE_INSTRUCTION(CallRuntime)
1664 1664
1665 private: 1665 private:
1666 const Runtime::Function* c_function_; 1666 const Runtime::Function* c_function_;
1667 Handle<String> name_; 1667 Handle<String> name_;
1668 }; 1668 };
1669 1669
1670 1670
1671 class HJSArrayLength: public HUnaryOperation {
1672 public:
1673 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) {
1674 // The length of an array is stored as a tagged value in the array
1675 // object. It is guaranteed to be 32 bit integer, but it can be
1676 // represented as either a smi or heap number.
1677 set_representation(Representation::Tagged());
1678 SetFlag(kUseGVN);
1679 SetFlag(kDependsOnArrayLengths);
1680 SetFlag(kDependsOnMaps);
1681 }
1682
1683 virtual Representation RequiredInputRepresentation(int index) const {
1684 return Representation::Tagged();
1685 }
1686
1687 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength)
1688
1689 protected:
1690 virtual bool DataEquals(HValue* other) { return true; }
1691 };
1692
1693
1694 class HFixedArrayLength: public HUnaryOperation { 1671 class HFixedArrayLength: public HUnaryOperation {
1695 public: 1672 public:
1696 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { 1673 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
1697 set_representation(Representation::Tagged()); 1674 set_representation(Representation::Tagged());
1698 SetFlag(kUseGVN); 1675 SetFlag(kUseGVN);
1699 SetFlag(kDependsOnArrayLengths); 1676 SetFlag(kDependsOnArrayLengths);
1700 } 1677 }
1701 1678
1702 virtual Representation RequiredInputRepresentation(int index) const { 1679 virtual Representation RequiredInputRepresentation(int index) const {
1703 return Representation::Tagged(); 1680 return Representation::Tagged();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 virtual bool DataEquals(HValue* other) { 1818 virtual bool DataEquals(HValue* other) {
1842 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 1819 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
1843 return op_ == b->op(); 1820 return op_ == b->op();
1844 } 1821 }
1845 1822
1846 private: 1823 private:
1847 BuiltinFunctionId op_; 1824 BuiltinFunctionId op_;
1848 }; 1825 };
1849 1826
1850 1827
1851 class HLoadElements: public HUnaryOperation {
1852 public:
1853 explicit HLoadElements(HValue* value) : HUnaryOperation(value) {
1854 set_representation(Representation::Tagged());
1855 SetFlag(kUseGVN);
1856 SetFlag(kDependsOnMaps);
1857 }
1858
1859 virtual Representation RequiredInputRepresentation(int index) const {
1860 return Representation::Tagged();
1861 }
1862
1863 DECLARE_CONCRETE_INSTRUCTION(LoadElements)
1864
1865 protected:
1866 virtual bool DataEquals(HValue* other) { return true; }
1867 };
1868
1869
1870 class HLoadExternalArrayPointer: public HUnaryOperation { 1828 class HLoadExternalArrayPointer: public HUnaryOperation {
1871 public: 1829 public:
1872 explicit HLoadExternalArrayPointer(HValue* value) 1830 explicit HLoadExternalArrayPointer(HValue* value)
1873 : HUnaryOperation(value) { 1831 : HUnaryOperation(value) {
1874 set_representation(Representation::External()); 1832 set_representation(Representation::External());
1875 // The result of this instruction is idempotent as long as its inputs don't 1833 // The result of this instruction is idempotent as long as its inputs don't
1876 // change. The external array of a specialized array elements object cannot 1834 // change. The external array of a specialized array elements object cannot
1877 // change once set, so it's no necessary to introduce any additional 1835 // change once set, so it's no necessary to introduce any additional
1878 // dependencies on top of the inputs. 1836 // dependencies on top of the inputs.
1879 SetFlag(kUseGVN); 1837 SetFlag(kUseGVN);
(...skipping 18 matching lines...) Expand all
1898 SetFlag(kUseGVN); 1856 SetFlag(kUseGVN);
1899 SetFlag(kDependsOnMaps); 1857 SetFlag(kDependsOnMaps);
1900 } 1858 }
1901 1859
1902 virtual Representation RequiredInputRepresentation(int index) const { 1860 virtual Representation RequiredInputRepresentation(int index) const {
1903 return Representation::Tagged(); 1861 return Representation::Tagged();
1904 } 1862 }
1905 virtual void PrintDataTo(StringStream* stream); 1863 virtual void PrintDataTo(StringStream* stream);
1906 virtual HType CalculateInferredType(); 1864 virtual HType CalculateInferredType();
1907 1865
1908 #ifdef DEBUG
1909 virtual void Verify();
1910 #endif
1911
1912 Handle<Map> map() const { return map_; } 1866 Handle<Map> map() const { return map_; }
1913 1867
1914 DECLARE_CONCRETE_INSTRUCTION(CheckMap) 1868 DECLARE_CONCRETE_INSTRUCTION(CheckMap)
1915 1869
1916 protected: 1870 protected:
1917 virtual bool DataEquals(HValue* other) { 1871 virtual bool DataEquals(HValue* other) {
1918 HCheckMap* b = HCheckMap::cast(other); 1872 HCheckMap* b = HCheckMap::cast(other);
1919 return map_.is_identical_to(b->map()); 1873 return map_.is_identical_to(b->map());
1920 } 1874 }
1921 1875
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 return new HCheckInstanceType(value, IS_STRING); 1923 return new HCheckInstanceType(value, IS_STRING);
1970 } 1924 }
1971 static HCheckInstanceType* NewIsSymbol(HValue* value) { 1925 static HCheckInstanceType* NewIsSymbol(HValue* value) {
1972 return new HCheckInstanceType(value, IS_SYMBOL); 1926 return new HCheckInstanceType(value, IS_SYMBOL);
1973 } 1927 }
1974 1928
1975 virtual Representation RequiredInputRepresentation(int index) const { 1929 virtual Representation RequiredInputRepresentation(int index) const {
1976 return Representation::Tagged(); 1930 return Representation::Tagged();
1977 } 1931 }
1978 1932
1979 #ifdef DEBUG
1980 virtual void Verify();
1981 #endif
1982
1983 virtual HValue* Canonicalize() { 1933 virtual HValue* Canonicalize() {
1984 if (!value()->type().IsUninitialized() && 1934 if (!value()->type().IsUninitialized() &&
1985 value()->type().IsString() && 1935 value()->type().IsString() &&
1986 check_ == IS_STRING) { 1936 check_ == IS_STRING) {
1987 return NULL; 1937 return NULL;
1988 } 1938 }
1989 return this; 1939 return this;
1990 } 1940 }
1991 1941
1992 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } 1942 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; }
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 HValue* arguments() { return OperandAt(0); } 2389 HValue* arguments() { return OperandAt(0); }
2440 HValue* length() { return OperandAt(1); } 2390 HValue* length() { return OperandAt(1); }
2441 HValue* index() { return OperandAt(2); } 2391 HValue* index() { return OperandAt(2); }
2442 2392
2443 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) 2393 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
2444 2394
2445 virtual bool DataEquals(HValue* other) { return true; } 2395 virtual bool DataEquals(HValue* other) { return true; }
2446 }; 2396 };
2447 2397
2448 2398
2399 class HJSArrayLength: public HBinaryOperation {
2400 public:
2401 explicit HJSArrayLength(HValue* value, HValue* typecheck)
Kevin Millikin (Chromium) 2011/07/11 15:03:54 No need for explicit.
Jakob Kummerow 2011/07/19 14:55:44 Done.
2402 : HBinaryOperation(value, typecheck) {
2403 // The length of an array is stored as a tagged value in the array
2404 // object. It is guaranteed to be 32 bit integer, but it can be
2405 // represented as either a smi or heap number.
2406 set_representation(Representation::Tagged());
2407 SetFlag(kUseGVN);
2408 SetFlag(kDependsOnArrayLengths);
2409 SetFlag(kDependsOnMaps);
Kevin Millikin (Chromium) 2011/07/11 15:03:54 I'm not positive we need this flag anymore, becaus
2410 }
2411
2412 virtual Representation RequiredInputRepresentation(int index) const {
2413 return Representation::Tagged();
2414 }
2415
2416 HValue* value() { return OperandAt(0); }
2417
2418 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength)
2419
2420 protected:
2421 virtual bool DataEquals(HValue* other) { return true; }
2422 };
2423
2424
2449 class HBoundsCheck: public HBinaryOperation { 2425 class HBoundsCheck: public HBinaryOperation {
2450 public: 2426 public:
2451 HBoundsCheck(HValue* index, HValue* length) 2427 HBoundsCheck(HValue* index, HValue* length)
2452 : HBinaryOperation(index, length) { 2428 : HBinaryOperation(index, length) {
2453 set_representation(Representation::Integer32()); 2429 set_representation(Representation::Integer32());
2454 SetFlag(kUseGVN); 2430 SetFlag(kUseGVN);
2455 } 2431 }
2456 2432
2457 virtual Representation RequiredInputRepresentation(int index) const { 2433 virtual Representation RequiredInputRepresentation(int index) const {
2458 return Representation::Integer32(); 2434 return Representation::Integer32();
2459 } 2435 }
2460 2436
2461 #ifdef DEBUG
2462 virtual void Verify();
2463 #endif
2464
2465 HValue* index() { return left(); } 2437 HValue* index() { return left(); }
2466 HValue* length() { return right(); } 2438 HValue* length() { return right(); }
2467 2439
2468 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) 2440 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck)
2469 2441
2470 protected: 2442 protected:
2471 virtual bool DataEquals(HValue* other) { return true; } 2443 virtual bool DataEquals(HValue* other) { return true; }
2472 }; 2444 };
2473 2445
2474 2446
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
3454 return Representation::Tagged(); 3426 return Representation::Tagged();
3455 } 3427 }
3456 3428
3457 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) 3429 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype)
3458 3430
3459 protected: 3431 protected:
3460 virtual bool DataEquals(HValue* other) { return true; } 3432 virtual bool DataEquals(HValue* other) { return true; }
3461 }; 3433 };
3462 3434
3463 3435
3436 class HLoadElements: public HBinaryOperation {
3437 public:
3438 explicit HLoadElements(HValue* value, HValue* typecheck)
Kevin Millikin (Chromium) 2011/07/11 15:03:54 Same, no need for explicit.
Jakob Kummerow 2011/07/19 14:55:44 Obsolete (I undid the changes to HLoadElements).
3439 : HBinaryOperation(value, typecheck) {
3440 set_representation(Representation::Tagged());
3441 SetFlag(kUseGVN);
3442 SetFlag(kDependsOnMaps);
3443 }
3444
3445 virtual Representation RequiredInputRepresentation(int index) const {
3446 return Representation::Tagged();
3447 }
3448
3449 HValue* value() { return OperandAt(0); }
3450
3451 DECLARE_CONCRETE_INSTRUCTION(LoadElements)
3452
3453 protected:
3454 virtual bool DataEquals(HValue* other) { return true; }
3455 };
3456
3457
3464 class HLoadKeyedFastElement: public HBinaryOperation { 3458 class HLoadKeyedFastElement: public HBinaryOperation {
3465 public: 3459 public:
3466 HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { 3460 HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj, key) {
3467 set_representation(Representation::Tagged()); 3461 set_representation(Representation::Tagged());
3468 SetFlag(kDependsOnArrayElements); 3462 SetFlag(kDependsOnArrayElements);
3469 SetFlag(kUseGVN); 3463 SetFlag(kUseGVN);
3470 } 3464 }
3471 3465
3472 HValue* object() { return OperandAt(0); } 3466 HValue* object() { return OperandAt(0); }
3473 HValue* key() { return OperandAt(1); } 3467 HValue* key() { return OperandAt(1); }
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
4059 4053
4060 DECLARE_CONCRETE_INSTRUCTION(In) 4054 DECLARE_CONCRETE_INSTRUCTION(In)
4061 }; 4055 };
4062 4056
4063 #undef DECLARE_INSTRUCTION 4057 #undef DECLARE_INSTRUCTION
4064 #undef DECLARE_CONCRETE_INSTRUCTION 4058 #undef DECLARE_CONCRETE_INSTRUCTION
4065 4059
4066 } } // namespace v8::internal 4060 } } // namespace v8::internal
4067 4061
4068 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4062 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698