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

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

Issue 133443009: A64: Synchronize with r17441. (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-flow-engine.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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 V(FunctionLiteral) \ 119 V(FunctionLiteral) \
120 V(GetCachedArrayIndex) \ 120 V(GetCachedArrayIndex) \
121 V(GlobalObject) \ 121 V(GlobalObject) \
122 V(GlobalReceiver) \ 122 V(GlobalReceiver) \
123 V(Goto) \ 123 V(Goto) \
124 V(HasCachedArrayIndexAndBranch) \ 124 V(HasCachedArrayIndexAndBranch) \
125 V(HasInstanceTypeAndBranch) \ 125 V(HasInstanceTypeAndBranch) \
126 V(InnerAllocatedObject) \ 126 V(InnerAllocatedObject) \
127 V(InstanceOf) \ 127 V(InstanceOf) \
128 V(InstanceOfKnownGlobal) \ 128 V(InstanceOfKnownGlobal) \
129 V(InstanceSize) \
130 V(InvokeFunction) \ 129 V(InvokeFunction) \
131 V(IsConstructCallAndBranch) \ 130 V(IsConstructCallAndBranch) \
132 V(IsObjectAndBranch) \ 131 V(IsObjectAndBranch) \
133 V(IsStringAndBranch) \ 132 V(IsStringAndBranch) \
134 V(IsSmiAndBranch) \ 133 V(IsSmiAndBranch) \
135 V(IsUndetectableAndBranch) \ 134 V(IsUndetectableAndBranch) \
136 V(LeaveInlined) \ 135 V(LeaveInlined) \
137 V(LoadContextSlot) \ 136 V(LoadContextSlot) \
138 V(LoadExternalArrayPointer) \ 137 V(LoadExternalArrayPointer) \
139 V(LoadFieldByIndex) \ 138 V(LoadFieldByIndex) \
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 631
633 HValue(HType type = HType::Tagged()) 632 HValue(HType type = HType::Tagged())
634 : block_(NULL), 633 : block_(NULL),
635 id_(kNoNumber), 634 id_(kNoNumber),
636 type_(type), 635 type_(type),
637 use_list_(NULL), 636 use_list_(NULL),
638 range_(NULL), 637 range_(NULL),
639 flags_(0) {} 638 flags_(0) {}
640 virtual ~HValue() {} 639 virtual ~HValue() {}
641 640
641 virtual int position() const { return RelocInfo::kNoPosition; }
642
642 HBasicBlock* block() const { return block_; } 643 HBasicBlock* block() const { return block_; }
643 void SetBlock(HBasicBlock* block); 644 void SetBlock(HBasicBlock* block);
644 int LoopWeight() const; 645 int LoopWeight() const;
645 646
646 // Note: Never call this method for an unlinked value. 647 // Note: Never call this method for an unlinked value.
647 Isolate* isolate() const; 648 Isolate* isolate() const;
648 649
649 int id() const { return id_; } 650 int id() const { return id_; }
650 void set_id(int id) { id_ = id; } 651 void set_id(int id) { id_ = id; }
651 652
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 1109
1109 virtual void PrintTo(StringStream* stream) V8_OVERRIDE; 1110 virtual void PrintTo(StringStream* stream) V8_OVERRIDE;
1110 virtual void PrintDataTo(StringStream* stream); 1111 virtual void PrintDataTo(StringStream* stream);
1111 1112
1112 bool IsLinked() const { return block() != NULL; } 1113 bool IsLinked() const { return block() != NULL; }
1113 void Unlink(); 1114 void Unlink();
1114 void InsertBefore(HInstruction* next); 1115 void InsertBefore(HInstruction* next);
1115 void InsertAfter(HInstruction* previous); 1116 void InsertAfter(HInstruction* previous);
1116 1117
1117 // The position is a write-once variable. 1118 // The position is a write-once variable.
1118 int position() const { return position_; } 1119 virtual int position() const V8_OVERRIDE { return position_; }
1119 bool has_position() const { return position_ != RelocInfo::kNoPosition; } 1120 bool has_position() const { return position_ != RelocInfo::kNoPosition; }
1120 void set_position(int position) { 1121 void set_position(int position) {
1121 ASSERT(!has_position()); 1122 ASSERT(!has_position());
1122 ASSERT(position != RelocInfo::kNoPosition); 1123 ASSERT(position != RelocInfo::kNoPosition);
1123 position_ = position; 1124 position_ = position;
1124 } 1125 }
1125 1126
1126 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } 1127 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); }
1127 1128
1128 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; 1129 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) { 1487 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) {
1487 SetOperandAt(0, value); 1488 SetOperandAt(0, value);
1488 SetOperandAt(1, context); 1489 SetOperandAt(1, context);
1489 SetOperandAt(2, parameter_count); 1490 SetOperandAt(2, parameter_count);
1490 } 1491 }
1491 }; 1492 };
1492 1493
1493 1494
1494 class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> { 1495 class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> {
1495 public: 1496 public:
1497 DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit);
1498
1496 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1499 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1497 return Representation::None(); 1500 return Representation::None();
1498 } 1501 }
1499 1502
1500 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) 1503 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit)
1504 private:
1505 HAbnormalExit() {}
1501 }; 1506 };
1502 1507
1503 1508
1504 class HUnaryOperation : public HTemplateInstruction<1> { 1509 class HUnaryOperation : public HTemplateInstruction<1> {
1505 public: 1510 public:
1506 HUnaryOperation(HValue* value, HType type = HType::Tagged()) 1511 HUnaryOperation(HValue* value, HType type = HType::Tagged())
1507 : HTemplateInstruction<1>(type) { 1512 : HTemplateInstruction<1>(type) {
1508 SetOperandAt(0, value); 1513 SetOperandAt(0, value);
1509 } 1514 }
1510 1515
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 #ifdef DEBUG 1773 #ifdef DEBUG
1769 Handle<JSFunction> closure_; 1774 Handle<JSFunction> closure_;
1770 #endif 1775 #endif
1771 }; 1776 };
1772 1777
1773 1778
1774 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> { 1779 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> {
1775 public: 1780 public:
1776 enum Kind { BIND, LOOKUP }; 1781 enum Kind { BIND, LOOKUP };
1777 1782
1778 HEnvironmentMarker(Kind kind, int index) 1783 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int);
1779 : kind_(kind), index_(index), next_simulate_(NULL) { }
1780 1784
1781 Kind kind() { return kind_; } 1785 Kind kind() { return kind_; }
1782 int index() { return index_; } 1786 int index() { return index_; }
1783 HSimulate* next_simulate() { return next_simulate_; } 1787 HSimulate* next_simulate() { return next_simulate_; }
1784 void set_next_simulate(HSimulate* simulate) { 1788 void set_next_simulate(HSimulate* simulate) {
1785 next_simulate_ = simulate; 1789 next_simulate_ = simulate;
1786 } 1790 }
1787 1791
1788 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1792 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1789 return Representation::None(); 1793 return Representation::None();
1790 } 1794 }
1791 1795
1792 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1796 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1793 1797
1794 #ifdef DEBUG 1798 #ifdef DEBUG
1795 void set_closure(Handle<JSFunction> closure) { 1799 void set_closure(Handle<JSFunction> closure) {
1796 ASSERT(closure_.is_null()); 1800 ASSERT(closure_.is_null());
1797 ASSERT(!closure.is_null()); 1801 ASSERT(!closure.is_null());
1798 closure_ = closure; 1802 closure_ = closure;
1799 } 1803 }
1800 Handle<JSFunction> closure() const { return closure_; } 1804 Handle<JSFunction> closure() const { return closure_; }
1801 #endif 1805 #endif
1802 1806
1803 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); 1807 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker);
1804 1808
1805 private: 1809 private:
1810 HEnvironmentMarker(Kind kind, int index)
1811 : kind_(kind), index_(index), next_simulate_(NULL) { }
1812
1806 Kind kind_; 1813 Kind kind_;
1807 int index_; 1814 int index_;
1808 HSimulate* next_simulate_; 1815 HSimulate* next_simulate_;
1809 1816
1810 #ifdef DEBUG 1817 #ifdef DEBUG
1811 Handle<JSFunction> closure_; 1818 Handle<JSFunction> closure_;
1812 #endif 1819 #endif
1813 }; 1820 };
1814 1821
1815 1822
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 1978
1972 private: 1979 private:
1973 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { 1980 explicit HPushArgument(HValue* value) : HUnaryOperation(value) {
1974 set_representation(Representation::Tagged()); 1981 set_representation(Representation::Tagged());
1975 } 1982 }
1976 }; 1983 };
1977 1984
1978 1985
1979 class HThisFunction V8_FINAL : public HTemplateInstruction<0> { 1986 class HThisFunction V8_FINAL : public HTemplateInstruction<0> {
1980 public: 1987 public:
1981 HThisFunction() { 1988 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction);
1982 set_representation(Representation::Tagged());
1983 SetFlag(kUseGVN);
1984 }
1985 1989
1986 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1990 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1987 return Representation::None(); 1991 return Representation::None();
1988 } 1992 }
1989 1993
1990 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) 1994 DECLARE_CONCRETE_INSTRUCTION(ThisFunction)
1991 1995
1992 protected: 1996 protected:
1993 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 1997 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
1994 1998
1995 private: 1999 private:
2000 HThisFunction() {
2001 set_representation(Representation::Tagged());
2002 SetFlag(kUseGVN);
2003 }
2004
1996 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 2005 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1997 }; 2006 };
1998 2007
1999 2008
2000 class HOuterContext V8_FINAL : public HUnaryOperation { 2009 class HOuterContext V8_FINAL : public HUnaryOperation {
2001 public: 2010 public:
2002 DECLARE_INSTRUCTION_FACTORY_P1(HOuterContext, HValue*); 2011 DECLARE_INSTRUCTION_FACTORY_P1(HOuterContext, HValue*);
2003 2012
2004 DECLARE_CONCRETE_INSTRUCTION(OuterContext); 2013 DECLARE_CONCRETE_INSTRUCTION(OuterContext);
2005 2014
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 SetAllSideEffects(); 2056 SetAllSideEffects();
2048 } 2057 }
2049 2058
2050 Handle<FixedArray> pairs_; 2059 Handle<FixedArray> pairs_;
2051 int flags_; 2060 int flags_;
2052 }; 2061 };
2053 2062
2054 2063
2055 class HGlobalObject V8_FINAL : public HUnaryOperation { 2064 class HGlobalObject V8_FINAL : public HUnaryOperation {
2056 public: 2065 public:
2057 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { 2066 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(HGlobalObject);
2058 set_representation(Representation::Tagged());
2059 SetFlag(kUseGVN);
2060 }
2061
2062 static HGlobalObject* New(Zone* zone, HValue* context) {
2063 return new(zone) HGlobalObject(context);
2064 }
2065 2067
2066 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) 2068 DECLARE_CONCRETE_INSTRUCTION(GlobalObject)
2067 2069
2068 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2070 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2069 return Representation::Tagged(); 2071 return Representation::Tagged();
2070 } 2072 }
2071 2073
2072 protected: 2074 protected:
2073 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 2075 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
2074 2076
2075 private: 2077 private:
2078 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
2079 set_representation(Representation::Tagged());
2080 SetFlag(kUseGVN);
2081 }
2082
2076 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 2083 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
2077 }; 2084 };
2078 2085
2079 2086
2080 class HGlobalReceiver V8_FINAL : public HUnaryOperation { 2087 class HGlobalReceiver V8_FINAL : public HUnaryOperation {
2081 public: 2088 public:
2082 DECLARE_INSTRUCTION_FACTORY_P1(HGlobalReceiver, HValue*); 2089 DECLARE_INSTRUCTION_FACTORY_P1(HGlobalReceiver, HValue*);
2083 2090
2084 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) 2091 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver)
2085 2092
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 HCallGlobal(HValue* context, Handle<String> name, int argument_count) 2314 HCallGlobal(HValue* context, Handle<String> name, int argument_count)
2308 : HUnaryCall(context, argument_count), name_(name) { 2315 : HUnaryCall(context, argument_count), name_(name) {
2309 } 2316 }
2310 2317
2311 Handle<String> name_; 2318 Handle<String> name_;
2312 }; 2319 };
2313 2320
2314 2321
2315 class HCallKnownGlobal V8_FINAL : public HCall<0> { 2322 class HCallKnownGlobal V8_FINAL : public HCall<0> {
2316 public: 2323 public:
2317 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) 2324 DECLARE_INSTRUCTION_FACTORY_P2(HCallKnownGlobal, Handle<JSFunction>, int);
2318 : HCall<0>(argument_count),
2319 target_(target),
2320 formal_parameter_count_(target->shared()->formal_parameter_count()) { }
2321 2325
2322 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2326 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2323 2327
2324 Handle<JSFunction> target() const { return target_; } 2328 Handle<JSFunction> target() const { return target_; }
2325 int formal_parameter_count() const { return formal_parameter_count_; } 2329 int formal_parameter_count() const { return formal_parameter_count_; }
2326 2330
2327 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2331 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2328 return Representation::None(); 2332 return Representation::None();
2329 } 2333 }
2330 2334
2331 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) 2335 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal)
2332 2336
2333 private: 2337 private:
2338 HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
2339 : HCall<0>(argument_count),
2340 target_(target),
2341 formal_parameter_count_(target->shared()->formal_parameter_count()) { }
2342
2334 Handle<JSFunction> target_; 2343 Handle<JSFunction> target_;
2335 int formal_parameter_count_; 2344 int formal_parameter_count_;
2336 }; 2345 };
2337 2346
2338 2347
2339 class HCallNew V8_FINAL : public HBinaryCall { 2348 class HCallNew V8_FINAL : public HBinaryCall {
2340 public: 2349 public:
2341 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); 2350 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int);
2342 2351
2343 HValue* context() { return first(); } 2352 HValue* context() { return first(); }
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 SetFlag(kUseGVN); 2770 SetFlag(kUseGVN);
2762 } 2771 }
2763 2772
2764 Unique<HeapObject> object_; 2773 Unique<HeapObject> object_;
2765 bool object_in_new_space_; 2774 bool object_in_new_space_;
2766 }; 2775 };
2767 2776
2768 2777
2769 class HCheckInstanceType V8_FINAL : public HUnaryOperation { 2778 class HCheckInstanceType V8_FINAL : public HUnaryOperation {
2770 public: 2779 public:
2771 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { 2780 enum Check {
2772 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); 2781 IS_SPEC_OBJECT,
2773 } 2782 IS_JS_ARRAY,
2774 static HCheckInstanceType* NewIsJSArray(HValue* value, Zone* zone) { 2783 IS_STRING,
2775 return new(zone) HCheckInstanceType(value, IS_JS_ARRAY); 2784 IS_INTERNALIZED_STRING,
2776 } 2785 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2777 static HCheckInstanceType* NewIsString(HValue* value, Zone* zone) { 2786 };
2778 return new(zone) HCheckInstanceType(value, IS_STRING); 2787
2779 } 2788 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check);
2780 static HCheckInstanceType* NewIsInternalizedString(
2781 HValue* value, Zone* zone) {
2782 return new(zone) HCheckInstanceType(value, IS_INTERNALIZED_STRING);
2783 }
2784 2789
2785 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2790 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2786 2791
2787 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2792 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2788 return Representation::Tagged(); 2793 return Representation::Tagged();
2789 } 2794 }
2790 2795
2791 virtual HValue* Canonicalize() V8_OVERRIDE; 2796 virtual HValue* Canonicalize() V8_OVERRIDE;
2792 2797
2793 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } 2798 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; }
2794 void GetCheckInterval(InstanceType* first, InstanceType* last); 2799 void GetCheckInterval(InstanceType* first, InstanceType* last);
2795 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); 2800 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag);
2796 2801
2797 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) 2802 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType)
2798 2803
2799 protected: 2804 protected:
2800 // TODO(ager): It could be nice to allow the ommision of instance 2805 // TODO(ager): It could be nice to allow the ommision of instance
2801 // type checks if we have already performed an instance type check 2806 // type checks if we have already performed an instance type check
2802 // with a larger range. 2807 // with a larger range.
2803 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2808 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
2804 HCheckInstanceType* b = HCheckInstanceType::cast(other); 2809 HCheckInstanceType* b = HCheckInstanceType::cast(other);
2805 return check_ == b->check_; 2810 return check_ == b->check_;
2806 } 2811 }
2807 2812
2808 virtual int RedefinedOperandIndex() { return 0; } 2813 virtual int RedefinedOperandIndex() { return 0; }
2809 2814
2810 private: 2815 private:
2811 enum Check {
2812 IS_SPEC_OBJECT,
2813 IS_JS_ARRAY,
2814 IS_STRING,
2815 IS_INTERNALIZED_STRING,
2816 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2817 };
2818
2819 const char* GetCheckName(); 2816 const char* GetCheckName();
2820 2817
2821 HCheckInstanceType(HValue* value, Check check) 2818 HCheckInstanceType(HValue* value, Check check)
2822 : HUnaryOperation(value), check_(check) { 2819 : HUnaryOperation(value), check_(check) {
2823 set_representation(Representation::Tagged()); 2820 set_representation(Representation::Tagged());
2824 SetFlag(kUseGVN); 2821 SetFlag(kUseGVN);
2825 } 2822 }
2826 2823
2827 const Check check_; 2824 const Check check_;
2828 }; 2825 };
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
3141 virtual HValue* OperandAt(int index) const V8_OVERRIDE { 3138 virtual HValue* OperandAt(int index) const V8_OVERRIDE {
3142 return inputs_[index]; 3139 return inputs_[index];
3143 } 3140 }
3144 HValue* GetRedundantReplacement(); 3141 HValue* GetRedundantReplacement();
3145 void AddInput(HValue* value); 3142 void AddInput(HValue* value);
3146 bool HasRealUses(); 3143 bool HasRealUses();
3147 3144
3148 bool IsReceiver() const { return merged_index_ == 0; } 3145 bool IsReceiver() const { return merged_index_ == 0; }
3149 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } 3146 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; }
3150 3147
3148 virtual int position() const V8_OVERRIDE;
3149
3151 int merged_index() const { return merged_index_; } 3150 int merged_index() const { return merged_index_; }
3152 3151
3153 InductionVariableData* induction_variable_data() { 3152 InductionVariableData* induction_variable_data() {
3154 return induction_variable_data_; 3153 return induction_variable_data_;
3155 } 3154 }
3156 bool IsInductionVariable() { 3155 bool IsInductionVariable() {
3157 return induction_variable_data_ != NULL; 3156 return induction_variable_data_ != NULL;
3158 } 3157 }
3159 bool IsLimitedInductionVariable() { 3158 bool IsLimitedInductionVariable() {
3160 return IsInductionVariable() && 3159 return IsInductionVariable() &&
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3311 3310
3312 void ReuseSideEffectsFromStore(HInstruction* store) { 3311 void ReuseSideEffectsFromStore(HInstruction* store) {
3313 ASSERT(store->HasObservableSideEffects()); 3312 ASSERT(store->HasObservableSideEffects());
3314 ASSERT(store->IsStoreNamedField()); 3313 ASSERT(store->IsStoreNamedField());
3315 gvn_flags_.Add(store->gvn_flags()); 3314 gvn_flags_.Add(store->gvn_flags());
3316 } 3315 }
3317 3316
3318 // Replay effects of this instruction on the given environment. 3317 // Replay effects of this instruction on the given environment.
3319 void ReplayEnvironment(HEnvironment* env); 3318 void ReplayEnvironment(HEnvironment* env);
3320 3319
3320 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
3321
3321 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) 3322 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3322 3323
3323 private: 3324 private:
3324 int capture_id_; 3325 int capture_id_;
3325 }; 3326 };
3326 3327
3327 3328
3328 class HConstant V8_FINAL : public HTemplateInstruction<0> { 3329 class HConstant V8_FINAL : public HTemplateInstruction<0> {
3329 public: 3330 public:
3330 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); 3331 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t);
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
3708 HWrapReceiver(HValue* receiver, HValue* function) { 3709 HWrapReceiver(HValue* receiver, HValue* function) {
3709 set_representation(Representation::Tagged()); 3710 set_representation(Representation::Tagged());
3710 SetOperandAt(0, receiver); 3711 SetOperandAt(0, receiver);
3711 SetOperandAt(1, function); 3712 SetOperandAt(1, function);
3712 } 3713 }
3713 }; 3714 };
3714 3715
3715 3716
3716 class HApplyArguments V8_FINAL : public HTemplateInstruction<4> { 3717 class HApplyArguments V8_FINAL : public HTemplateInstruction<4> {
3717 public: 3718 public:
3718 HApplyArguments(HValue* function, 3719 DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*,
3719 HValue* receiver, 3720 HValue*);
3720 HValue* length,
3721 HValue* elements) {
3722 set_representation(Representation::Tagged());
3723 SetOperandAt(0, function);
3724 SetOperandAt(1, receiver);
3725 SetOperandAt(2, length);
3726 SetOperandAt(3, elements);
3727 SetAllSideEffects();
3728 }
3729 3721
3730 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3722 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3731 // The length is untagged, all other inputs are tagged. 3723 // The length is untagged, all other inputs are tagged.
3732 return (index == 2) 3724 return (index == 2)
3733 ? Representation::Integer32() 3725 ? Representation::Integer32()
3734 : Representation::Tagged(); 3726 : Representation::Tagged();
3735 } 3727 }
3736 3728
3737 HValue* function() { return OperandAt(0); } 3729 HValue* function() { return OperandAt(0); }
3738 HValue* receiver() { return OperandAt(1); } 3730 HValue* receiver() { return OperandAt(1); }
3739 HValue* length() { return OperandAt(2); } 3731 HValue* length() { return OperandAt(2); }
3740 HValue* elements() { return OperandAt(3); } 3732 HValue* elements() { return OperandAt(3); }
3741 3733
3742 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) 3734 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments)
3735
3736 private:
3737 HApplyArguments(HValue* function,
3738 HValue* receiver,
3739 HValue* length,
3740 HValue* elements) {
3741 set_representation(Representation::Tagged());
3742 SetOperandAt(0, function);
3743 SetOperandAt(1, receiver);
3744 SetOperandAt(2, length);
3745 SetOperandAt(3, elements);
3746 SetAllSideEffects();
3747 }
3743 }; 3748 };
3744 3749
3745 3750
3746 class HArgumentsElements V8_FINAL : public HTemplateInstruction<0> { 3751 class HArgumentsElements V8_FINAL : public HTemplateInstruction<0> {
3747 public: 3752 public:
3748 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); 3753 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool);
3749 3754
3750 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) 3755 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements)
3751 3756
3752 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3757 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3790 set_representation(Representation::Integer32()); 3795 set_representation(Representation::Integer32());
3791 SetFlag(kUseGVN); 3796 SetFlag(kUseGVN);
3792 } 3797 }
3793 3798
3794 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3799 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3795 }; 3800 };
3796 3801
3797 3802
3798 class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> { 3803 class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> {
3799 public: 3804 public:
3800 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 3805 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*);
3801 set_representation(Representation::Tagged());
3802 SetFlag(kUseGVN);
3803 SetOperandAt(0, arguments);
3804 SetOperandAt(1, length);
3805 SetOperandAt(2, index);
3806 }
3807 3806
3808 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3807 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
3809 3808
3810 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3809 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3811 // The arguments elements is considered tagged. 3810 // The arguments elements is considered tagged.
3812 return index == 0 3811 return index == 0
3813 ? Representation::Tagged() 3812 ? Representation::Tagged()
3814 : Representation::Integer32(); 3813 : Representation::Integer32();
3815 } 3814 }
3816 3815
3817 HValue* arguments() { return OperandAt(0); } 3816 HValue* arguments() { return OperandAt(0); }
3818 HValue* length() { return OperandAt(1); } 3817 HValue* length() { return OperandAt(1); }
3819 HValue* index() { return OperandAt(2); } 3818 HValue* index() { return OperandAt(2); }
3820 3819
3821 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) 3820 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
3822 3821
3822 private:
3823 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
3824 set_representation(Representation::Tagged());
3825 SetFlag(kUseGVN);
3826 SetOperandAt(0, arguments);
3827 SetOperandAt(1, length);
3828 SetOperandAt(2, index);
3829 }
3830
3823 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3831 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
3824 }; 3832 };
3825 3833
3826 3834
3827 class HBoundsCheckBaseIndexInformation; 3835 class HBoundsCheckBaseIndexInformation;
3828 3836
3829 3837
3830 class HBoundsCheck V8_FINAL : public HTemplateInstruction<2> { 3838 class HBoundsCheck V8_FINAL : public HTemplateInstruction<2> {
3831 public: 3839 public:
3832 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); 3840 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3941 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, 3949 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right,
3942 HType type = HType::Tagged()) 3950 HType type = HType::Tagged())
3943 : HBinaryOperation(context, left, right, type) { 3951 : HBinaryOperation(context, left, right, type) {
3944 SetFlag(kFlexibleRepresentation); 3952 SetFlag(kFlexibleRepresentation);
3945 SetFlag(kTruncatingToInt32); 3953 SetFlag(kTruncatingToInt32);
3946 SetFlag(kAllowUndefinedAsNaN); 3954 SetFlag(kAllowUndefinedAsNaN);
3947 SetAllSideEffects(); 3955 SetAllSideEffects();
3948 } 3956 }
3949 3957
3950 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 3958 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
3951 if (to.IsTagged()) { 3959 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
3960 if (to.IsTagged() &&
3961 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
3952 SetAllSideEffects(); 3962 SetAllSideEffects();
3953 ClearFlag(kUseGVN); 3963 ClearFlag(kUseGVN);
3954 } else { 3964 } else {
3955 ASSERT(to.IsSmiOrInteger32());
3956 ClearAllSideEffects(); 3965 ClearAllSideEffects();
3957 SetFlag(kUseGVN); 3966 SetFlag(kUseGVN);
3958 } 3967 }
3959 } 3968 }
3960 3969
3961 virtual void UpdateRepresentation(Representation new_rep, 3970 virtual void UpdateRepresentation(Representation new_rep,
3962 HInferRepresentationPhase* h_infer, 3971 HInferRepresentationPhase* h_infer,
3963 const char* reason) V8_OVERRIDE { 3972 const char* reason) V8_OVERRIDE {
3964 // We only generate either int32 or generic tagged bitwise operations. 3973 // We only generate either int32 or generic tagged bitwise operations.
3965 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); 3974 if (new_rep.IsDouble()) new_rep = Representation::Integer32();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4017 class HArithmeticBinaryOperation : public HBinaryOperation { 4026 class HArithmeticBinaryOperation : public HBinaryOperation {
4018 public: 4027 public:
4019 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) 4028 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right)
4020 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { 4029 : HBinaryOperation(context, left, right, HType::TaggedNumber()) {
4021 SetAllSideEffects(); 4030 SetAllSideEffects();
4022 SetFlag(kFlexibleRepresentation); 4031 SetFlag(kFlexibleRepresentation);
4023 SetFlag(kAllowUndefinedAsNaN); 4032 SetFlag(kAllowUndefinedAsNaN);
4024 } 4033 }
4025 4034
4026 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4035 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4027 if (to.IsTagged()) { 4036 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
4037 if (to.IsTagged() &&
4038 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
4028 SetAllSideEffects(); 4039 SetAllSideEffects();
4029 ClearFlag(kUseGVN); 4040 ClearFlag(kUseGVN);
4030 } else { 4041 } else {
4031 ClearAllSideEffects(); 4042 ClearAllSideEffects();
4032 SetFlag(kUseGVN); 4043 SetFlag(kUseGVN);
4033 } 4044 }
4034 } 4045 }
4035 4046
4036 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) 4047 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
4037 private: 4048 private:
4038 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4049 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4039 }; 4050 };
4040 4051
4041 4052
4042 class HCompareGeneric V8_FINAL : public HBinaryOperation { 4053 class HCompareGeneric V8_FINAL : public HBinaryOperation {
4043 public: 4054 public:
4044 HCompareGeneric(HValue* context, 4055 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*,
4045 HValue* left, 4056 HValue*, Token::Value);
4046 HValue* right,
4047 Token::Value token)
4048 : HBinaryOperation(context, left, right, HType::Boolean()),
4049 token_(token) {
4050 ASSERT(Token::IsCompareOp(token));
4051 set_representation(Representation::Tagged());
4052 SetAllSideEffects();
4053 }
4054 4057
4055 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4058 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4056 return index == 0 4059 return index == 0
4057 ? Representation::Tagged() 4060 ? Representation::Tagged()
4058 : representation(); 4061 : representation();
4059 } 4062 }
4060 4063
4061 Token::Value token() const { return token_; } 4064 Token::Value token() const { return token_; }
4062 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4065 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4063 4066
4064 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) 4067 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
4065 4068
4066 private: 4069 private:
4070 HCompareGeneric(HValue* context,
4071 HValue* left,
4072 HValue* right,
4073 Token::Value token)
4074 : HBinaryOperation(context, left, right, HType::Boolean()),
4075 token_(token) {
4076 ASSERT(Token::IsCompareOp(token));
4077 set_representation(Representation::Tagged());
4078 SetAllSideEffects();
4079 }
4080
4067 Token::Value token_; 4081 Token::Value token_;
4068 }; 4082 };
4069 4083
4070 4084
4071 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { 4085 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> {
4072 public: 4086 public:
4073 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch, 4087 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch,
4074 HValue*, HValue*, Token::Value); 4088 HValue*, HValue*, Token::Value);
4075 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch, 4089 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch,
4076 HValue*, HValue*, Token::Value, 4090 HValue*, HValue*, Token::Value,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
4308 set_representation(Representation::Tagged()); 4322 set_representation(Representation::Tagged());
4309 SetGVNFlag(kChangesNewSpacePromotion); 4323 SetGVNFlag(kChangesNewSpacePromotion);
4310 } 4324 }
4311 4325
4312 Token::Value token_; 4326 Token::Value token_;
4313 }; 4327 };
4314 4328
4315 4329
4316 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { 4330 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> {
4317 public: 4331 public:
4332 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch);
4333
4318 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4334 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4319 return Representation::None(); 4335 return Representation::None();
4320 } 4336 }
4321 4337
4322 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) 4338 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch)
4339 private:
4340 HIsConstructCallAndBranch() {}
4323 }; 4341 };
4324 4342
4325 4343
4326 class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction { 4344 class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction {
4327 public: 4345 public:
4328 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) 4346 DECLARE_INSTRUCTION_FACTORY_P2(
4329 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } 4347 HHasInstanceTypeAndBranch, HValue*, InstanceType);
4330 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) 4348 DECLARE_INSTRUCTION_FACTORY_P3(
4331 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { 4349 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType);
4332 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
4333 }
4334 4350
4335 InstanceType from() { return from_; } 4351 InstanceType from() { return from_; }
4336 InstanceType to() { return to_; } 4352 InstanceType to() { return to_; }
4337 4353
4338 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4354 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4339 4355
4340 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4356 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4341 return Representation::Tagged(); 4357 return Representation::Tagged();
4342 } 4358 }
4343 4359
4344 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) 4360 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch)
4345 4361
4346 private: 4362 private:
4363 HHasInstanceTypeAndBranch(HValue* value, InstanceType type)
4364 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { }
4365 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to)
4366 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) {
4367 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
4368 }
4369
4347 InstanceType from_; 4370 InstanceType from_;
4348 InstanceType to_; // Inclusive range, not all combinations work. 4371 InstanceType to_; // Inclusive range, not all combinations work.
4349 }; 4372 };
4350 4373
4351 4374
4352 class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction { 4375 class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction {
4353 public: 4376 public:
4354 explicit HHasCachedArrayIndexAndBranch(HValue* value) 4377 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*);
4355 : HUnaryControlInstruction(value, NULL, NULL) { }
4356 4378
4357 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4379 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4358 return Representation::Tagged(); 4380 return Representation::Tagged();
4359 } 4381 }
4360 4382
4361 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) 4383 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch)
4384 private:
4385 explicit HHasCachedArrayIndexAndBranch(HValue* value)
4386 : HUnaryControlInstruction(value, NULL, NULL) { }
4362 }; 4387 };
4363 4388
4364 4389
4365 class HGetCachedArrayIndex V8_FINAL : public HUnaryOperation { 4390 class HGetCachedArrayIndex V8_FINAL : public HUnaryOperation {
4366 public: 4391 public:
4367 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { 4392 DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*);
4368 set_representation(Representation::Tagged());
4369 SetFlag(kUseGVN);
4370 }
4371 4393
4372 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4394 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4373 return Representation::Tagged(); 4395 return Representation::Tagged();
4374 } 4396 }
4375 4397
4376 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) 4398 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex)
4377 4399
4378 protected: 4400 protected:
4379 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4401 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4380 4402
4381 private: 4403 private:
4404 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) {
4405 set_representation(Representation::Tagged());
4406 SetFlag(kUseGVN);
4407 }
4408
4382 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4409 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4383 }; 4410 };
4384 4411
4385 4412
4386 class HClassOfTestAndBranch V8_FINAL : public HUnaryControlInstruction { 4413 class HClassOfTestAndBranch V8_FINAL : public HUnaryControlInstruction {
4387 public: 4414 public:
4388 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) 4415 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*,
4389 : HUnaryControlInstruction(value, NULL, NULL), 4416 Handle<String>);
4390 class_name_(class_name) { }
4391 4417
4392 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) 4418 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch)
4393 4419
4394 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4420 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4395 return Representation::Tagged(); 4421 return Representation::Tagged();
4396 } 4422 }
4397 4423
4398 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4424 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4399 4425
4400 Handle<String> class_name() const { return class_name_; } 4426 Handle<String> class_name() const { return class_name_; }
4401 4427
4402 private: 4428 private:
4429 HClassOfTestAndBranch(HValue* value, Handle<String> class_name)
4430 : HUnaryControlInstruction(value, NULL, NULL),
4431 class_name_(class_name) { }
4432
4403 Handle<String> class_name_; 4433 Handle<String> class_name_;
4404 }; 4434 };
4405 4435
4406 4436
4407 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction { 4437 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction {
4408 public: 4438 public:
4409 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) 4439 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>);
4410 : HUnaryControlInstruction(value, NULL, NULL),
4411 type_literal_(type_literal) { }
4412 4440
4413 Handle<String> type_literal() { return type_literal_; } 4441 Handle<String> type_literal() { return type_literal_; }
4414 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4442 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4415 4443
4416 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) 4444 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch)
4417 4445
4418 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4446 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4419 return Representation::Tagged(); 4447 return Representation::Tagged();
4420 } 4448 }
4421 4449
4422 private: 4450 private:
4451 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal)
4452 : HUnaryControlInstruction(value, NULL, NULL),
4453 type_literal_(type_literal) { }
4454
4423 Handle<String> type_literal_; 4455 Handle<String> type_literal_;
4424 }; 4456 };
4425 4457
4426 4458
4427 class HInstanceOf V8_FINAL : public HBinaryOperation { 4459 class HInstanceOf V8_FINAL : public HBinaryOperation {
4428 public: 4460 public:
4429 HInstanceOf(HValue* context, HValue* left, HValue* right) 4461 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*);
4430 : HBinaryOperation(context, left, right, HType::Boolean()) {
4431 set_representation(Representation::Tagged());
4432 SetAllSideEffects();
4433 }
4434 4462
4435 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4463 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4436 return Representation::Tagged(); 4464 return Representation::Tagged();
4437 } 4465 }
4438 4466
4439 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4467 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4440 4468
4441 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) 4469 DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
4470
4471 private:
4472 HInstanceOf(HValue* context, HValue* left, HValue* right)
4473 : HBinaryOperation(context, left, right, HType::Boolean()) {
4474 set_representation(Representation::Tagged());
4475 SetAllSideEffects();
4476 }
4442 }; 4477 };
4443 4478
4444 4479
4445 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> { 4480 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> {
4446 public: 4481 public:
4447 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, 4482 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal,
4448 HValue*, 4483 HValue*,
4449 Handle<JSFunction>); 4484 Handle<JSFunction>);
4450 4485
4451 HValue* context() { return OperandAt(0); } 4486 HValue* context() { return OperandAt(0); }
(...skipping 14 matching lines...) Expand all
4466 SetOperandAt(0, context); 4501 SetOperandAt(0, context);
4467 SetOperandAt(1, left); 4502 SetOperandAt(1, left);
4468 set_representation(Representation::Tagged()); 4503 set_representation(Representation::Tagged());
4469 SetAllSideEffects(); 4504 SetAllSideEffects();
4470 } 4505 }
4471 4506
4472 Handle<JSFunction> function_; 4507 Handle<JSFunction> function_;
4473 }; 4508 };
4474 4509
4475 4510
4476 // TODO(mstarzinger): This instruction should be modeled as a load of the map
4477 // field followed by a load of the instance size field once HLoadNamedField is
4478 // flexible enough to accommodate byte-field loads.
4479 class HInstanceSize V8_FINAL : public HTemplateInstruction<1> {
4480 public:
4481 explicit HInstanceSize(HValue* object) {
4482 SetOperandAt(0, object);
4483 set_representation(Representation::Integer32());
4484 }
4485
4486 HValue* object() { return OperandAt(0); }
4487
4488 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4489 return Representation::Tagged();
4490 }
4491
4492 DECLARE_CONCRETE_INSTRUCTION(InstanceSize)
4493 };
4494
4495
4496 class HPower V8_FINAL : public HTemplateInstruction<2> { 4511 class HPower V8_FINAL : public HTemplateInstruction<2> {
4497 public: 4512 public:
4498 static HInstruction* New(Zone* zone, 4513 static HInstruction* New(Zone* zone,
4499 HValue* context, 4514 HValue* context,
4500 HValue* left, 4515 HValue* left,
4501 HValue* right); 4516 HValue* right);
4502 4517
4503 HValue* left() { return OperandAt(0); } 4518 HValue* left() { return OperandAt(0); }
4504 HValue* right() const { return OperandAt(1); } 4519 HValue* right() const { return OperandAt(1); }
4505 4520
(...skipping 21 matching lines...) Expand all
4527 } 4542 }
4528 4543
4529 virtual bool IsDeletable() const V8_OVERRIDE { 4544 virtual bool IsDeletable() const V8_OVERRIDE {
4530 return !right()->representation().IsTagged(); 4545 return !right()->representation().IsTagged();
4531 } 4546 }
4532 }; 4547 };
4533 4548
4534 4549
4535 class HRandom V8_FINAL : public HTemplateInstruction<1> { 4550 class HRandom V8_FINAL : public HTemplateInstruction<1> {
4536 public: 4551 public:
4537 explicit HRandom(HValue* global_object) { 4552 DECLARE_INSTRUCTION_FACTORY_P1(HRandom, HValue*);
4538 SetOperandAt(0, global_object);
4539 set_representation(Representation::Double());
4540 }
4541 4553
4542 HValue* global_object() { return OperandAt(0); } 4554 HValue* global_object() { return OperandAt(0); }
4543 4555
4544 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4556 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4545 return Representation::Tagged(); 4557 return Representation::Tagged();
4546 } 4558 }
4547 4559
4548 DECLARE_CONCRETE_INSTRUCTION(Random) 4560 DECLARE_CONCRETE_INSTRUCTION(Random)
4549 4561
4550 private: 4562 private:
4563 explicit HRandom(HValue* global_object) {
4564 SetOperandAt(0, global_object);
4565 set_representation(Representation::Double());
4566 }
4567
4551 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4568 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4552 }; 4569 };
4553 4570
4554 4571
4555 class HAdd V8_FINAL : public HArithmeticBinaryOperation { 4572 class HAdd V8_FINAL : public HArithmeticBinaryOperation {
4556 public: 4573 public:
4557 static HInstruction* New(Zone* zone, 4574 static HInstruction* New(Zone* zone,
4558 HValue* context, 4575 HValue* context,
4559 HValue* left, 4576 HValue* left,
4560 HValue* right); 4577 HValue* right);
(...skipping 15 matching lines...) Expand all
4576 return true; 4593 return true;
4577 } else if (right()->IsInteger32Constant()) { 4594 } else if (right()->IsInteger32Constant()) {
4578 decomposition->Apply(left(), right()->GetInteger32Constant()); 4595 decomposition->Apply(left(), right()->GetInteger32Constant());
4579 return true; 4596 return true;
4580 } else { 4597 } else {
4581 return false; 4598 return false;
4582 } 4599 }
4583 } 4600 }
4584 4601
4585 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4602 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4586 if (to.IsTagged()) ClearFlag(kAllowUndefinedAsNaN); 4603 if (to.IsTagged()) {
4587 HArithmeticBinaryOperation::RepresentationChanged(to); 4604 SetGVNFlag(kChangesNewSpacePromotion);
4605 ClearFlag(kAllowUndefinedAsNaN);
4606 }
4607 if (to.IsTagged() &&
4608 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() ||
4609 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) {
4610 SetAllSideEffects();
4611 ClearFlag(kUseGVN);
4612 } else {
4613 ClearAllSideEffects();
4614 SetFlag(kUseGVN);
4615 }
4588 } 4616 }
4589 4617
4590 DECLARE_CONCRETE_INSTRUCTION(Add) 4618 DECLARE_CONCRETE_INSTRUCTION(Add)
4591 4619
4592 protected: 4620 protected:
4593 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4621 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4594 4622
4595 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4623 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
4596 4624
4597 private: 4625 private:
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
5166 } 5194 }
5167 5195
5168 HEnvironment* environment_; 5196 HEnvironment* environment_;
5169 int index_; 5197 int index_;
5170 HPhi* incoming_value_; 5198 HPhi* incoming_value_;
5171 }; 5199 };
5172 5200
5173 5201
5174 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { 5202 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
5175 public: 5203 public:
5176 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) 5204 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>,
5177 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { 5205 PropertyDetails);
5178 set_representation(Representation::Tagged());
5179 SetFlag(kUseGVN);
5180 SetGVNFlag(kDependsOnGlobalVars);
5181 }
5182 5206
5183 Unique<Cell> cell() const { return cell_; } 5207 Unique<Cell> cell() const { return cell_; }
5184 bool RequiresHoleCheck() const; 5208 bool RequiresHoleCheck() const;
5185 5209
5186 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5210 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5187 5211
5188 virtual intptr_t Hashcode() V8_OVERRIDE { 5212 virtual intptr_t Hashcode() V8_OVERRIDE {
5189 return cell_.Hashcode(); 5213 return cell_.Hashcode();
5190 } 5214 }
5191 5215
5192 virtual void FinalizeUniqueness() V8_OVERRIDE { 5216 virtual void FinalizeUniqueness() V8_OVERRIDE {
5193 cell_ = Unique<Cell>(cell_.handle()); 5217 cell_ = Unique<Cell>(cell_.handle());
5194 } 5218 }
5195 5219
5196 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5220 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5197 return Representation::None(); 5221 return Representation::None();
5198 } 5222 }
5199 5223
5200 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) 5224 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell)
5201 5225
5202 protected: 5226 protected:
5203 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5227 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
5204 return cell_ == HLoadGlobalCell::cast(other)->cell_; 5228 return cell_ == HLoadGlobalCell::cast(other)->cell_;
5205 } 5229 }
5206 5230
5207 private: 5231 private:
5232 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
5233 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
5234 set_representation(Representation::Tagged());
5235 SetFlag(kUseGVN);
5236 SetGVNFlag(kDependsOnGlobalVars);
5237 }
5238
5208 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } 5239 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }
5209 5240
5210 Unique<Cell> cell_; 5241 Unique<Cell> cell_;
5211 PropertyDetails details_; 5242 PropertyDetails details_;
5212 }; 5243 };
5213 5244
5214 5245
5215 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { 5246 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> {
5216 public: 5247 public:
5217 HLoadGlobalGeneric(HValue* context, 5248 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*,
5218 HValue* global_object, 5249 Handle<Object>, bool);
5219 Handle<Object> name,
5220 bool for_typeof)
5221 : name_(name),
5222 for_typeof_(for_typeof) {
5223 SetOperandAt(0, context);
5224 SetOperandAt(1, global_object);
5225 set_representation(Representation::Tagged());
5226 SetAllSideEffects();
5227 }
5228 5250
5229 HValue* context() { return OperandAt(0); } 5251 HValue* context() { return OperandAt(0); }
5230 HValue* global_object() { return OperandAt(1); } 5252 HValue* global_object() { return OperandAt(1); }
5231 Handle<Object> name() const { return name_; } 5253 Handle<Object> name() const { return name_; }
5232 bool for_typeof() const { return for_typeof_; } 5254 bool for_typeof() const { return for_typeof_; }
5233 5255
5234 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5256 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5235 5257
5236 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5258 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5237 return Representation::Tagged(); 5259 return Representation::Tagged();
5238 } 5260 }
5239 5261
5240 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) 5262 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric)
5241 5263
5242 private: 5264 private:
5265 HLoadGlobalGeneric(HValue* context,
5266 HValue* global_object,
5267 Handle<Object> name,
5268 bool for_typeof)
5269 : name_(name),
5270 for_typeof_(for_typeof) {
5271 SetOperandAt(0, context);
5272 SetOperandAt(1, global_object);
5273 set_representation(Representation::Tagged());
5274 SetAllSideEffects();
5275 }
5276
5243 Handle<Object> name_; 5277 Handle<Object> name_;
5244 bool for_typeof_; 5278 bool for_typeof_;
5245 }; 5279 };
5246 5280
5247 5281
5248 class HAllocate V8_FINAL : public HTemplateInstruction<2> { 5282 class HAllocate V8_FINAL : public HTemplateInstruction<2> {
5249 public: 5283 public:
5250 static HAllocate* New(Zone* zone, 5284 static HAllocate* New(Zone* zone,
5251 HValue* context, 5285 HValue* context,
5252 HValue* size, 5286 HValue* size,
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
5745 5779
5746 static HObjectAccess ForArrayLength(ElementsKind elements_kind) { 5780 static HObjectAccess ForArrayLength(ElementsKind elements_kind) {
5747 return HObjectAccess( 5781 return HObjectAccess(
5748 kArrayLengths, 5782 kArrayLengths,
5749 JSArray::kLengthOffset, 5783 JSArray::kLengthOffset,
5750 IsFastElementsKind(elements_kind) && 5784 IsFastElementsKind(elements_kind) &&
5751 FLAG_track_fields 5785 FLAG_track_fields
5752 ? Representation::Smi() : Representation::Tagged()); 5786 ? Representation::Smi() : Representation::Tagged());
5753 } 5787 }
5754 5788
5755 static HObjectAccess ForAllocationSiteTransitionInfo() { 5789 static HObjectAccess ForAllocationSiteOffset(int offset) {
5756 return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset); 5790 ASSERT(offset >= HeapObject::kHeaderSize && offset < AllocationSite::kSize);
5757 } 5791 return HObjectAccess(kInobject, offset);
5758
5759 static HObjectAccess ForAllocationSiteNestedSite() {
5760 return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset);
5761 }
5762
5763 static HObjectAccess ForAllocationSiteDependentCode() {
5764 return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset);
5765 }
5766
5767 static HObjectAccess ForAllocationSiteWeakNext() {
5768 return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset);
5769 } 5792 }
5770 5793
5771 static HObjectAccess ForAllocationSiteList() { 5794 static HObjectAccess ForAllocationSiteList() {
5772 return HObjectAccess(kExternalMemory, 0, Representation::Tagged()); 5795 return HObjectAccess(kExternalMemory, 0, Representation::Tagged());
5773 } 5796 }
5774 5797
5775 static HObjectAccess ForFixedArrayLength() { 5798 static HObjectAccess ForFixedArrayLength() {
5776 return HObjectAccess( 5799 return HObjectAccess(
5777 kArrayLengths, 5800 kArrayLengths,
5778 FixedArray::kLengthOffset, 5801 FixedArray::kLengthOffset,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
5821 } 5844 }
5822 5845
5823 static HObjectAccess ForFunctionContextPointer() { 5846 static HObjectAccess ForFunctionContextPointer() {
5824 return HObjectAccess(kInobject, JSFunction::kContextOffset); 5847 return HObjectAccess(kInobject, JSFunction::kContextOffset);
5825 } 5848 }
5826 5849
5827 static HObjectAccess ForMap() { 5850 static HObjectAccess ForMap() {
5828 return HObjectAccess(kMaps, JSObject::kMapOffset); 5851 return HObjectAccess(kMaps, JSObject::kMapOffset);
5829 } 5852 }
5830 5853
5854 static HObjectAccess ForMapInstanceSize() {
5855 return HObjectAccess(kInobject,
5856 Map::kInstanceSizeOffset,
5857 Representation::Byte());
5858 }
5859
5831 static HObjectAccess ForPropertyCellValue() { 5860 static HObjectAccess ForPropertyCellValue() {
5832 return HObjectAccess(kInobject, PropertyCell::kValueOffset); 5861 return HObjectAccess(kInobject, PropertyCell::kValueOffset);
5833 } 5862 }
5834 5863
5835 static HObjectAccess ForCellValue() { 5864 static HObjectAccess ForCellValue() {
5836 return HObjectAccess(kInobject, Cell::kValueOffset); 5865 return HObjectAccess(kInobject, Cell::kValueOffset);
5837 } 5866 }
5838 5867
5839 static HObjectAccess ForAllocationMementoSite() { 5868 static HObjectAccess ForAllocationMementoSite() {
5840 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); 5869 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
5977 } 6006 }
5978 6007
5979 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6008 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
5980 6009
5981 HObjectAccess access_; 6010 HObjectAccess access_;
5982 }; 6011 };
5983 6012
5984 6013
5985 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { 6014 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> {
5986 public: 6015 public:
5987 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) 6016 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
5988 : name_(name) { 6017 Handle<Object>);
5989 SetOperandAt(0, context);
5990 SetOperandAt(1, object);
5991 set_representation(Representation::Tagged());
5992 SetAllSideEffects();
5993 }
5994 6018
5995 HValue* context() { return OperandAt(0); } 6019 HValue* context() { return OperandAt(0); }
5996 HValue* object() { return OperandAt(1); } 6020 HValue* object() { return OperandAt(1); }
5997 Handle<Object> name() const { return name_; } 6021 Handle<Object> name() const { return name_; }
5998 6022
5999 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6023 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6000 return Representation::Tagged(); 6024 return Representation::Tagged();
6001 } 6025 }
6002 6026
6003 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6027 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6004 6028
6005 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) 6029 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric)
6006 6030
6007 private: 6031 private:
6032 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
6033 : name_(name) {
6034 SetOperandAt(0, context);
6035 SetOperandAt(1, object);
6036 set_representation(Representation::Tagged());
6037 SetAllSideEffects();
6038 }
6039
6008 Handle<Object> name_; 6040 Handle<Object> name_;
6009 }; 6041 };
6010 6042
6011 6043
6012 class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation { 6044 class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation {
6013 public: 6045 public:
6014 explicit HLoadFunctionPrototype(HValue* function) 6046 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*);
6015 : HUnaryOperation(function) {
6016 set_representation(Representation::Tagged());
6017 SetFlag(kUseGVN);
6018 SetGVNFlag(kDependsOnCalls);
6019 }
6020 6047
6021 HValue* function() { return OperandAt(0); } 6048 HValue* function() { return OperandAt(0); }
6022 6049
6023 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6050 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6024 return Representation::Tagged(); 6051 return Representation::Tagged();
6025 } 6052 }
6026 6053
6027 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) 6054 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype)
6028 6055
6029 protected: 6056 protected:
6030 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 6057 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
6058
6059 private:
6060 explicit HLoadFunctionPrototype(HValue* function)
6061 : HUnaryOperation(function) {
6062 set_representation(Representation::Tagged());
6063 SetFlag(kUseGVN);
6064 SetGVNFlag(kDependsOnCalls);
6065 }
6031 }; 6066 };
6032 6067
6033 class ArrayInstructionInterface { 6068 class ArrayInstructionInterface {
6034 public: 6069 public:
6035 virtual HValue* GetKey() = 0; 6070 virtual HValue* GetKey() = 0;
6036 virtual void SetKey(HValue* key) = 0; 6071 virtual void SetKey(HValue* key) = 0;
6037 virtual void SetIndexOffset(uint32_t index_offset) = 0; 6072 virtual void SetIndexOffset(uint32_t index_offset) = 0;
6038 virtual bool IsDehoisted() = 0; 6073 virtual bool IsDehoisted() = 0;
6039 virtual void SetDehoisted(bool is_dehoisted) = 0; 6074 virtual void SetDehoisted(bool is_dehoisted) = 0;
6040 virtual ~ArrayInstructionInterface() { }; 6075 virtual ~ArrayInstructionInterface() { };
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
6208 {}; // NOLINT 6243 {}; // NOLINT
6209 class IsDehoistedField: 6244 class IsDehoistedField:
6210 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> 6245 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted>
6211 {}; // NOLINT 6246 {}; // NOLINT
6212 uint32_t bit_field_; 6247 uint32_t bit_field_;
6213 }; 6248 };
6214 6249
6215 6250
6216 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { 6251 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> {
6217 public: 6252 public:
6218 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { 6253 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*,
6219 set_representation(Representation::Tagged()); 6254 HValue*);
6220 SetOperandAt(0, obj);
6221 SetOperandAt(1, key);
6222 SetOperandAt(2, context);
6223 SetAllSideEffects();
6224 }
6225
6226 HValue* object() { return OperandAt(0); } 6255 HValue* object() { return OperandAt(0); }
6227 HValue* key() { return OperandAt(1); } 6256 HValue* key() { return OperandAt(1); }
6228 HValue* context() { return OperandAt(2); } 6257 HValue* context() { return OperandAt(2); }
6229 6258
6230 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6259 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6231 6260
6232 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6261 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6233 // tagged[tagged] 6262 // tagged[tagged]
6234 return Representation::Tagged(); 6263 return Representation::Tagged();
6235 } 6264 }
6236 6265
6237 virtual HValue* Canonicalize() V8_OVERRIDE; 6266 virtual HValue* Canonicalize() V8_OVERRIDE;
6238 6267
6239 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) 6268 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
6269
6270 private:
6271 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
6272 set_representation(Representation::Tagged());
6273 SetOperandAt(0, obj);
6274 SetOperandAt(1, key);
6275 SetOperandAt(2, context);
6276 SetAllSideEffects();
6277 }
6240 }; 6278 };
6241 6279
6242 6280
6243 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { 6281 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> {
6244 public: 6282 public:
6245 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, 6283 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*,
6246 HObjectAccess, HValue*); 6284 HObjectAccess, HValue*);
6247 6285
6248 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 6286 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
6249 6287
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
6348 6386
6349 HObjectAccess access_; 6387 HObjectAccess access_;
6350 HValue* new_space_dominator_; 6388 HValue* new_space_dominator_;
6351 WriteBarrierMode write_barrier_mode_ : 1; 6389 WriteBarrierMode write_barrier_mode_ : 1;
6352 bool has_transition_ : 1; 6390 bool has_transition_ : 1;
6353 }; 6391 };
6354 6392
6355 6393
6356 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { 6394 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
6357 public: 6395 public:
6358 HStoreNamedGeneric(HValue* context, 6396 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
6359 HValue* object, 6397 Handle<String>, HValue*,
6360 Handle<String> name, 6398 StrictModeFlag);
6361 HValue* value,
6362 StrictModeFlag strict_mode_flag)
6363 : name_(name),
6364 strict_mode_flag_(strict_mode_flag) {
6365 SetOperandAt(0, object);
6366 SetOperandAt(1, value);
6367 SetOperandAt(2, context);
6368 SetAllSideEffects();
6369 }
6370
6371 HValue* object() { return OperandAt(0); } 6399 HValue* object() { return OperandAt(0); }
6372 HValue* value() { return OperandAt(1); } 6400 HValue* value() { return OperandAt(1); }
6373 HValue* context() { return OperandAt(2); } 6401 HValue* context() { return OperandAt(2); }
6374 Handle<String> name() { return name_; } 6402 Handle<String> name() { return name_; }
6375 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } 6403 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; }
6376 6404
6377 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6405 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6378 6406
6379 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6407 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6380 return Representation::Tagged(); 6408 return Representation::Tagged();
6381 } 6409 }
6382 6410
6383 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) 6411 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric)
6384 6412
6385 private: 6413 private:
6414 HStoreNamedGeneric(HValue* context,
6415 HValue* object,
6416 Handle<String> name,
6417 HValue* value,
6418 StrictModeFlag strict_mode_flag)
6419 : name_(name),
6420 strict_mode_flag_(strict_mode_flag) {
6421 SetOperandAt(0, object);
6422 SetOperandAt(1, value);
6423 SetOperandAt(2, context);
6424 SetAllSideEffects();
6425 }
6426
6386 Handle<String> name_; 6427 Handle<String> name_;
6387 StrictModeFlag strict_mode_flag_; 6428 StrictModeFlag strict_mode_flag_;
6388 }; 6429 };
6389 6430
6390 6431
6391 class HStoreKeyed V8_FINAL 6432 class HStoreKeyed V8_FINAL
6392 : public HTemplateInstruction<3>, public ArrayInstructionInterface { 6433 : public HTemplateInstruction<3>, public ArrayInstructionInterface {
6393 public: 6434 public:
6394 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, 6435 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*,
6395 ElementsKind); 6436 ElementsKind);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
6524 ElementsKind elements_kind_; 6565 ElementsKind elements_kind_;
6525 uint32_t index_offset_; 6566 uint32_t index_offset_;
6526 bool is_dehoisted_ : 1; 6567 bool is_dehoisted_ : 1;
6527 bool is_uninitialized_ : 1; 6568 bool is_uninitialized_ : 1;
6528 HValue* new_space_dominator_; 6569 HValue* new_space_dominator_;
6529 }; 6570 };
6530 6571
6531 6572
6532 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { 6573 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> {
6533 public: 6574 public:
6534 HStoreKeyedGeneric(HValue* context, 6575 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*,
6535 HValue* object, 6576 HValue*, HValue*, StrictModeFlag);
6536 HValue* key,
6537 HValue* value,
6538 StrictModeFlag strict_mode_flag)
6539 : strict_mode_flag_(strict_mode_flag) {
6540 SetOperandAt(0, object);
6541 SetOperandAt(1, key);
6542 SetOperandAt(2, value);
6543 SetOperandAt(3, context);
6544 SetAllSideEffects();
6545 }
6546 6577
6547 HValue* object() { return OperandAt(0); } 6578 HValue* object() { return OperandAt(0); }
6548 HValue* key() { return OperandAt(1); } 6579 HValue* key() { return OperandAt(1); }
6549 HValue* value() { return OperandAt(2); } 6580 HValue* value() { return OperandAt(2); }
6550 HValue* context() { return OperandAt(3); } 6581 HValue* context() { return OperandAt(3); }
6551 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } 6582 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; }
6552 6583
6553 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6584 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6554 // tagged[tagged] = tagged 6585 // tagged[tagged] = tagged
6555 return Representation::Tagged(); 6586 return Representation::Tagged();
6556 } 6587 }
6557 6588
6558 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6589 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6559 6590
6560 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) 6591 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
6561 6592
6562 private: 6593 private:
6594 HStoreKeyedGeneric(HValue* context,
6595 HValue* object,
6596 HValue* key,
6597 HValue* value,
6598 StrictModeFlag strict_mode_flag)
6599 : strict_mode_flag_(strict_mode_flag) {
6600 SetOperandAt(0, object);
6601 SetOperandAt(1, key);
6602 SetOperandAt(2, value);
6603 SetOperandAt(3, context);
6604 SetAllSideEffects();
6605 }
6606
6563 StrictModeFlag strict_mode_flag_; 6607 StrictModeFlag strict_mode_flag_;
6564 }; 6608 };
6565 6609
6566 6610
6567 class HTransitionElementsKind V8_FINAL : public HTemplateInstruction<2> { 6611 class HTransitionElementsKind V8_FINAL : public HTemplateInstruction<2> {
6568 public: 6612 public:
6569 inline static HTransitionElementsKind* New(Zone* zone, 6613 inline static HTransitionElementsKind* New(Zone* zone,
6570 HValue* context, 6614 HValue* context,
6571 HValue* object, 6615 HValue* object,
6572 Handle<Map> original_map, 6616 Handle<Map> original_map,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
6640 6684
6641 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 6685 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
6642 6686
6643 protected: 6687 protected:
6644 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 6688 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
6645 6689
6646 private: 6690 private:
6647 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) 6691 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags)
6648 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { 6692 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) {
6649 set_representation(Representation::Tagged()); 6693 set_representation(Representation::Tagged());
6650 if (flags_ == STRING_ADD_CHECK_NONE) { 6694 if (MightHaveSideEffects()) {
6695 SetAllSideEffects();
6696 } else {
6651 SetFlag(kUseGVN); 6697 SetFlag(kUseGVN);
6652 SetGVNFlag(kDependsOnMaps); 6698 SetGVNFlag(kDependsOnMaps);
6653 SetGVNFlag(kChangesNewSpacePromotion); 6699 SetGVNFlag(kChangesNewSpacePromotion);
6654 } else {
6655 SetAllSideEffects();
6656 } 6700 }
6657 } 6701 }
6658 6702
6703 bool MightHaveSideEffects() const {
6704 return flags_ != STRING_ADD_CHECK_NONE &&
6705 (left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved());
6706 }
6707
6659 // No side-effects except possible allocation: 6708 // No side-effects except possible allocation:
6660 // NOTE: this instruction does not call ToString() on its inputs, when flags_ 6709 // NOTE: this instruction does not call ToString() on its inputs, when flags_
6661 // is set to STRING_ADD_CHECK_NONE. 6710 // is set to STRING_ADD_CHECK_NONE.
6662 virtual bool IsDeletable() const V8_OVERRIDE { 6711 virtual bool IsDeletable() const V8_OVERRIDE {
6663 return flags_ == STRING_ADD_CHECK_NONE; 6712 return !MightHaveSideEffects();
6664 } 6713 }
6665 6714
6666 const StringAddFlags flags_; 6715 const StringAddFlags flags_;
6667 }; 6716 };
6668 6717
6669 6718
6670 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { 6719 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> {
6671 public: 6720 public:
6672 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, 6721 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt,
6673 HValue*, 6722 HValue*,
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
6926 ASSERT(function->function_id == Runtime::kCreateObjectLiteral); 6975 ASSERT(function->function_id == Runtime::kCreateObjectLiteral);
6927 #endif 6976 #endif
6928 } 6977 }
6929 6978
6930 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6979 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6931 }; 6980 };
6932 6981
6933 6982
6934 class HValueOf V8_FINAL : public HUnaryOperation { 6983 class HValueOf V8_FINAL : public HUnaryOperation {
6935 public: 6984 public:
6936 explicit HValueOf(HValue* value) : HUnaryOperation(value) { 6985 DECLARE_INSTRUCTION_FACTORY_P1(HValueOf, HValue*);
6937 set_representation(Representation::Tagged());
6938 }
6939 6986
6940 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6987 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6941 return Representation::Tagged(); 6988 return Representation::Tagged();
6942 } 6989 }
6943 6990
6944 DECLARE_CONCRETE_INSTRUCTION(ValueOf) 6991 DECLARE_CONCRETE_INSTRUCTION(ValueOf)
6945 6992
6946 private: 6993 private:
6994 explicit HValueOf(HValue* value) : HUnaryOperation(value) {
6995 set_representation(Representation::Tagged());
6996 }
6997
6947 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6998 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6948 }; 6999 };
6949 7000
6950 7001
6951 class HDateField V8_FINAL : public HUnaryOperation { 7002 class HDateField V8_FINAL : public HUnaryOperation {
6952 public: 7003 public:
6953 HDateField(HValue* date, Smi* index) 7004 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*);
6954 : HUnaryOperation(date), index_(index) {
6955 set_representation(Representation::Tagged());
6956 }
6957 7005
6958 Smi* index() const { return index_; } 7006 Smi* index() const { return index_; }
6959 7007
6960 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7008 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6961 return Representation::Tagged(); 7009 return Representation::Tagged();
6962 } 7010 }
6963 7011
6964 DECLARE_CONCRETE_INSTRUCTION(DateField) 7012 DECLARE_CONCRETE_INSTRUCTION(DateField)
6965 7013
6966 private: 7014 private:
7015 HDateField(HValue* date, Smi* index)
7016 : HUnaryOperation(date), index_(index) {
7017 set_representation(Representation::Tagged());
7018 }
7019
6967 Smi* index_; 7020 Smi* index_;
6968 }; 7021 };
6969 7022
6970 7023
6971 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> { 7024 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> {
6972 public: 7025 public:
6973 HSeqStringSetChar(String::Encoding encoding, 7026 DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding,
6974 HValue* string, 7027 HValue*, HValue*, HValue*);
6975 HValue* index,
6976 HValue* value) : encoding_(encoding) {
6977 SetOperandAt(0, string);
6978 SetOperandAt(1, index);
6979 SetOperandAt(2, value);
6980 set_representation(Representation::Tagged());
6981 }
6982 7028
6983 String::Encoding encoding() { return encoding_; } 7029 String::Encoding encoding() { return encoding_; }
6984 HValue* string() { return OperandAt(0); } 7030 HValue* string() { return OperandAt(0); }
6985 HValue* index() { return OperandAt(1); } 7031 HValue* index() { return OperandAt(1); }
6986 HValue* value() { return OperandAt(2); } 7032 HValue* value() { return OperandAt(2); }
6987 7033
6988 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7034 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6989 return (index == 0) ? Representation::Tagged() 7035 return (index == 0) ? Representation::Tagged()
6990 : Representation::Integer32(); 7036 : Representation::Integer32();
6991 } 7037 }
6992 7038
6993 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) 7039 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar)
6994 7040
6995 private: 7041 private:
7042 HSeqStringSetChar(String::Encoding encoding,
7043 HValue* string,
7044 HValue* index,
7045 HValue* value) : encoding_(encoding) {
7046 SetOperandAt(0, string);
7047 SetOperandAt(1, index);
7048 SetOperandAt(2, value);
7049 set_representation(Representation::Tagged());
7050 }
7051
6996 String::Encoding encoding_; 7052 String::Encoding encoding_;
6997 }; 7053 };
6998 7054
6999 7055
7000 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { 7056 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> {
7001 public: 7057 public:
7002 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); 7058 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*);
7003 7059
7004 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7060 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7005 return Representation::Tagged(); 7061 return Representation::Tagged();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
7134 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7190 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7135 }; 7191 };
7136 7192
7137 7193
7138 #undef DECLARE_INSTRUCTION 7194 #undef DECLARE_INSTRUCTION
7139 #undef DECLARE_CONCRETE_INSTRUCTION 7195 #undef DECLARE_CONCRETE_INSTRUCTION
7140 7196
7141 } } // namespace v8::internal 7197 } } // namespace v8::internal
7142 7198
7143 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7199 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-flow-engine.h ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698