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

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

Issue 39973003: Merge bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: again Created 7 years, 2 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 631
632 HValue(HType type = HType::Tagged()) 632 HValue(HType type = HType::Tagged())
633 : block_(NULL), 633 : block_(NULL),
634 id_(kNoNumber), 634 id_(kNoNumber),
635 type_(type), 635 type_(type),
636 use_list_(NULL), 636 use_list_(NULL),
637 range_(NULL), 637 range_(NULL),
638 flags_(0) {} 638 flags_(0) {}
639 virtual ~HValue() {} 639 virtual ~HValue() {}
640 640
641 virtual int position() const { return RelocInfo::kNoPosition; }
642
641 HBasicBlock* block() const { return block_; } 643 HBasicBlock* block() const { return block_; }
642 void SetBlock(HBasicBlock* block); 644 void SetBlock(HBasicBlock* block);
643 int LoopWeight() const; 645 int LoopWeight() const;
644 646
645 // Note: Never call this method for an unlinked value. 647 // Note: Never call this method for an unlinked value.
646 Isolate* isolate() const; 648 Isolate* isolate() const;
647 649
648 int id() const { return id_; } 650 int id() const { return id_; }
649 void set_id(int id) { id_ = id; } 651 void set_id(int id) { id_ = id; }
650 652
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 1109
1108 virtual void PrintTo(StringStream* stream) V8_OVERRIDE; 1110 virtual void PrintTo(StringStream* stream) V8_OVERRIDE;
1109 virtual void PrintDataTo(StringStream* stream); 1111 virtual void PrintDataTo(StringStream* stream);
1110 1112
1111 bool IsLinked() const { return block() != NULL; } 1113 bool IsLinked() const { return block() != NULL; }
1112 void Unlink(); 1114 void Unlink();
1113 void InsertBefore(HInstruction* next); 1115 void InsertBefore(HInstruction* next);
1114 void InsertAfter(HInstruction* previous); 1116 void InsertAfter(HInstruction* previous);
1115 1117
1116 // The position is a write-once variable. 1118 // The position is a write-once variable.
1117 int position() const { return position_; } 1119 virtual int position() const V8_OVERRIDE { return position_; }
1118 bool has_position() const { return position_ != RelocInfo::kNoPosition; } 1120 bool has_position() const { return position_ != RelocInfo::kNoPosition; }
1119 void set_position(int position) { 1121 void set_position(int position) {
1120 ASSERT(!has_position()); 1122 ASSERT(!has_position());
1121 ASSERT(position != RelocInfo::kNoPosition); 1123 ASSERT(position != RelocInfo::kNoPosition);
1122 position_ = position; 1124 position_ = position;
1123 } 1125 }
1124 1126
1125 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } 1127 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); }
1126 1128
1127 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
1485 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) { 1487 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) {
1486 SetOperandAt(0, value); 1488 SetOperandAt(0, value);
1487 SetOperandAt(1, context); 1489 SetOperandAt(1, context);
1488 SetOperandAt(2, parameter_count); 1490 SetOperandAt(2, parameter_count);
1489 } 1491 }
1490 }; 1492 };
1491 1493
1492 1494
1493 class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> { 1495 class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> {
1494 public: 1496 public:
1497 DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit);
1498
1495 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1499 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1496 return Representation::None(); 1500 return Representation::None();
1497 } 1501 }
1498 1502
1499 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) 1503 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit)
1504 private:
1505 HAbnormalExit() {}
1500 }; 1506 };
1501 1507
1502 1508
1503 class HUnaryOperation : public HTemplateInstruction<1> { 1509 class HUnaryOperation : public HTemplateInstruction<1> {
1504 public: 1510 public:
1505 HUnaryOperation(HValue* value, HType type = HType::Tagged()) 1511 HUnaryOperation(HValue* value, HType type = HType::Tagged())
1506 : HTemplateInstruction<1>(type) { 1512 : HTemplateInstruction<1>(type) {
1507 SetOperandAt(0, value); 1513 SetOperandAt(0, value);
1508 } 1514 }
1509 1515
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 #ifdef DEBUG 1773 #ifdef DEBUG
1768 Handle<JSFunction> closure_; 1774 Handle<JSFunction> closure_;
1769 #endif 1775 #endif
1770 }; 1776 };
1771 1777
1772 1778
1773 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> { 1779 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> {
1774 public: 1780 public:
1775 enum Kind { BIND, LOOKUP }; 1781 enum Kind { BIND, LOOKUP };
1776 1782
1777 HEnvironmentMarker(Kind kind, int index) 1783 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int);
1778 : kind_(kind), index_(index), next_simulate_(NULL) { }
1779 1784
1780 Kind kind() { return kind_; } 1785 Kind kind() { return kind_; }
1781 int index() { return index_; } 1786 int index() { return index_; }
1782 HSimulate* next_simulate() { return next_simulate_; } 1787 HSimulate* next_simulate() { return next_simulate_; }
1783 void set_next_simulate(HSimulate* simulate) { 1788 void set_next_simulate(HSimulate* simulate) {
1784 next_simulate_ = simulate; 1789 next_simulate_ = simulate;
1785 } 1790 }
1786 1791
1787 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1792 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1788 return Representation::None(); 1793 return Representation::None();
1789 } 1794 }
1790 1795
1791 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1796 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1792 1797
1793 #ifdef DEBUG 1798 #ifdef DEBUG
1794 void set_closure(Handle<JSFunction> closure) { 1799 void set_closure(Handle<JSFunction> closure) {
1795 ASSERT(closure_.is_null()); 1800 ASSERT(closure_.is_null());
1796 ASSERT(!closure.is_null()); 1801 ASSERT(!closure.is_null());
1797 closure_ = closure; 1802 closure_ = closure;
1798 } 1803 }
1799 Handle<JSFunction> closure() const { return closure_; } 1804 Handle<JSFunction> closure() const { return closure_; }
1800 #endif 1805 #endif
1801 1806
1802 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); 1807 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker);
1803 1808
1804 private: 1809 private:
1810 HEnvironmentMarker(Kind kind, int index)
1811 : kind_(kind), index_(index), next_simulate_(NULL) { }
1812
1805 Kind kind_; 1813 Kind kind_;
1806 int index_; 1814 int index_;
1807 HSimulate* next_simulate_; 1815 HSimulate* next_simulate_;
1808 1816
1809 #ifdef DEBUG 1817 #ifdef DEBUG
1810 Handle<JSFunction> closure_; 1818 Handle<JSFunction> closure_;
1811 #endif 1819 #endif
1812 }; 1820 };
1813 1821
1814 1822
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 1978
1971 private: 1979 private:
1972 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { 1980 explicit HPushArgument(HValue* value) : HUnaryOperation(value) {
1973 set_representation(Representation::Tagged()); 1981 set_representation(Representation::Tagged());
1974 } 1982 }
1975 }; 1983 };
1976 1984
1977 1985
1978 class HThisFunction V8_FINAL : public HTemplateInstruction<0> { 1986 class HThisFunction V8_FINAL : public HTemplateInstruction<0> {
1979 public: 1987 public:
1980 HThisFunction() { 1988 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction);
1981 set_representation(Representation::Tagged());
1982 SetFlag(kUseGVN);
1983 }
1984 1989
1985 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1990 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1986 return Representation::None(); 1991 return Representation::None();
1987 } 1992 }
1988 1993
1989 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) 1994 DECLARE_CONCRETE_INSTRUCTION(ThisFunction)
1990 1995
1991 protected: 1996 protected:
1992 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 1997 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
1993 1998
1994 private: 1999 private:
2000 HThisFunction() {
2001 set_representation(Representation::Tagged());
2002 SetFlag(kUseGVN);
2003 }
2004
1995 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 2005 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1996 }; 2006 };
1997 2007
1998 2008
1999 class HOuterContext V8_FINAL : public HUnaryOperation { 2009 class HOuterContext V8_FINAL : public HUnaryOperation {
2000 public: 2010 public:
2001 DECLARE_INSTRUCTION_FACTORY_P1(HOuterContext, HValue*); 2011 DECLARE_INSTRUCTION_FACTORY_P1(HOuterContext, HValue*);
2002 2012
2003 DECLARE_CONCRETE_INSTRUCTION(OuterContext); 2013 DECLARE_CONCRETE_INSTRUCTION(OuterContext);
2004 2014
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 SetAllSideEffects(); 2056 SetAllSideEffects();
2047 } 2057 }
2048 2058
2049 Handle<FixedArray> pairs_; 2059 Handle<FixedArray> pairs_;
2050 int flags_; 2060 int flags_;
2051 }; 2061 };
2052 2062
2053 2063
2054 class HGlobalObject V8_FINAL : public HUnaryOperation { 2064 class HGlobalObject V8_FINAL : public HUnaryOperation {
2055 public: 2065 public:
2056 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { 2066 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(HGlobalObject);
2057 set_representation(Representation::Tagged());
2058 SetFlag(kUseGVN);
2059 }
2060
2061 static HGlobalObject* New(Zone* zone, HValue* context) {
2062 return new(zone) HGlobalObject(context);
2063 }
2064 2067
2065 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) 2068 DECLARE_CONCRETE_INSTRUCTION(GlobalObject)
2066 2069
2067 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2070 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2068 return Representation::Tagged(); 2071 return Representation::Tagged();
2069 } 2072 }
2070 2073
2071 protected: 2074 protected:
2072 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 2075 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
2073 2076
2074 private: 2077 private:
2078 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
2079 set_representation(Representation::Tagged());
2080 SetFlag(kUseGVN);
2081 }
2082
2075 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 2083 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
2076 }; 2084 };
2077 2085
2078 2086
2079 class HGlobalReceiver V8_FINAL : public HUnaryOperation { 2087 class HGlobalReceiver V8_FINAL : public HUnaryOperation {
2080 public: 2088 public:
2081 DECLARE_INSTRUCTION_FACTORY_P1(HGlobalReceiver, HValue*); 2089 DECLARE_INSTRUCTION_FACTORY_P1(HGlobalReceiver, HValue*);
2082 2090
2083 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) 2091 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver)
2084 2092
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 HCallGlobal(HValue* context, Handle<String> name, int argument_count) 2314 HCallGlobal(HValue* context, Handle<String> name, int argument_count)
2307 : HUnaryCall(context, argument_count), name_(name) { 2315 : HUnaryCall(context, argument_count), name_(name) {
2308 } 2316 }
2309 2317
2310 Handle<String> name_; 2318 Handle<String> name_;
2311 }; 2319 };
2312 2320
2313 2321
2314 class HCallKnownGlobal V8_FINAL : public HCall<0> { 2322 class HCallKnownGlobal V8_FINAL : public HCall<0> {
2315 public: 2323 public:
2316 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) 2324 DECLARE_INSTRUCTION_FACTORY_P2(HCallKnownGlobal, Handle<JSFunction>, int);
2317 : HCall<0>(argument_count),
2318 target_(target),
2319 formal_parameter_count_(target->shared()->formal_parameter_count()) { }
2320 2325
2321 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2326 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2322 2327
2323 Handle<JSFunction> target() const { return target_; } 2328 Handle<JSFunction> target() const { return target_; }
2324 int formal_parameter_count() const { return formal_parameter_count_; } 2329 int formal_parameter_count() const { return formal_parameter_count_; }
2325 2330
2326 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2331 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2327 return Representation::None(); 2332 return Representation::None();
2328 } 2333 }
2329 2334
2330 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) 2335 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal)
2331 2336
2332 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
2333 Handle<JSFunction> target_; 2343 Handle<JSFunction> target_;
2334 int formal_parameter_count_; 2344 int formal_parameter_count_;
2335 }; 2345 };
2336 2346
2337 2347
2338 class HCallNew V8_FINAL : public HBinaryCall { 2348 class HCallNew V8_FINAL : public HBinaryCall {
2339 public: 2349 public:
2340 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); 2350 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int);
2341 2351
2342 HValue* context() { return first(); } 2352 HValue* context() { return first(); }
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2760 SetFlag(kUseGVN); 2770 SetFlag(kUseGVN);
2761 } 2771 }
2762 2772
2763 Unique<HeapObject> object_; 2773 Unique<HeapObject> object_;
2764 bool object_in_new_space_; 2774 bool object_in_new_space_;
2765 }; 2775 };
2766 2776
2767 2777
2768 class HCheckInstanceType V8_FINAL : public HUnaryOperation { 2778 class HCheckInstanceType V8_FINAL : public HUnaryOperation {
2769 public: 2779 public:
2770 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { 2780 enum Check {
2771 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); 2781 IS_SPEC_OBJECT,
2772 } 2782 IS_JS_ARRAY,
2773 static HCheckInstanceType* NewIsJSArray(HValue* value, Zone* zone) { 2783 IS_STRING,
2774 return new(zone) HCheckInstanceType(value, IS_JS_ARRAY); 2784 IS_INTERNALIZED_STRING,
2775 } 2785 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2776 static HCheckInstanceType* NewIsString(HValue* value, Zone* zone) { 2786 };
2777 return new(zone) HCheckInstanceType(value, IS_STRING); 2787
2778 } 2788 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check);
2779 static HCheckInstanceType* NewIsInternalizedString(
2780 HValue* value, Zone* zone) {
2781 return new(zone) HCheckInstanceType(value, IS_INTERNALIZED_STRING);
2782 }
2783 2789
2784 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2790 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2785 2791
2786 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2792 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2787 return Representation::Tagged(); 2793 return Representation::Tagged();
2788 } 2794 }
2789 2795
2790 virtual HValue* Canonicalize() V8_OVERRIDE; 2796 virtual HValue* Canonicalize() V8_OVERRIDE;
2791 2797
2792 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } 2798 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; }
2793 void GetCheckInterval(InstanceType* first, InstanceType* last); 2799 void GetCheckInterval(InstanceType* first, InstanceType* last);
2794 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); 2800 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag);
2795 2801
2796 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) 2802 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType)
2797 2803
2798 protected: 2804 protected:
2799 // 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
2800 // type checks if we have already performed an instance type check 2806 // type checks if we have already performed an instance type check
2801 // with a larger range. 2807 // with a larger range.
2802 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2808 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
2803 HCheckInstanceType* b = HCheckInstanceType::cast(other); 2809 HCheckInstanceType* b = HCheckInstanceType::cast(other);
2804 return check_ == b->check_; 2810 return check_ == b->check_;
2805 } 2811 }
2806 2812
2807 virtual int RedefinedOperandIndex() { return 0; } 2813 virtual int RedefinedOperandIndex() { return 0; }
2808 2814
2809 private: 2815 private:
2810 enum Check {
2811 IS_SPEC_OBJECT,
2812 IS_JS_ARRAY,
2813 IS_STRING,
2814 IS_INTERNALIZED_STRING,
2815 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2816 };
2817
2818 const char* GetCheckName(); 2816 const char* GetCheckName();
2819 2817
2820 HCheckInstanceType(HValue* value, Check check) 2818 HCheckInstanceType(HValue* value, Check check)
2821 : HUnaryOperation(value), check_(check) { 2819 : HUnaryOperation(value), check_(check) {
2822 set_representation(Representation::Tagged()); 2820 set_representation(Representation::Tagged());
2823 SetFlag(kUseGVN); 2821 SetFlag(kUseGVN);
2824 } 2822 }
2825 2823
2826 const Check check_; 2824 const Check check_;
2827 }; 2825 };
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 virtual HValue* OperandAt(int index) const V8_OVERRIDE { 3138 virtual HValue* OperandAt(int index) const V8_OVERRIDE {
3141 return inputs_[index]; 3139 return inputs_[index];
3142 } 3140 }
3143 HValue* GetRedundantReplacement(); 3141 HValue* GetRedundantReplacement();
3144 void AddInput(HValue* value); 3142 void AddInput(HValue* value);
3145 bool HasRealUses(); 3143 bool HasRealUses();
3146 3144
3147 bool IsReceiver() const { return merged_index_ == 0; } 3145 bool IsReceiver() const { return merged_index_ == 0; }
3148 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } 3146 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; }
3149 3147
3148 virtual int position() const V8_OVERRIDE;
3149
3150 int merged_index() const { return merged_index_; } 3150 int merged_index() const { return merged_index_; }
3151 3151
3152 InductionVariableData* induction_variable_data() { 3152 InductionVariableData* induction_variable_data() {
3153 return induction_variable_data_; 3153 return induction_variable_data_;
3154 } 3154 }
3155 bool IsInductionVariable() { 3155 bool IsInductionVariable() {
3156 return induction_variable_data_ != NULL; 3156 return induction_variable_data_ != NULL;
3157 } 3157 }
3158 bool IsLimitedInductionVariable() { 3158 bool IsLimitedInductionVariable() {
3159 return IsInductionVariable() && 3159 return IsInductionVariable() &&
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 3310
3311 void ReuseSideEffectsFromStore(HInstruction* store) { 3311 void ReuseSideEffectsFromStore(HInstruction* store) {
3312 ASSERT(store->HasObservableSideEffects()); 3312 ASSERT(store->HasObservableSideEffects());
3313 ASSERT(store->IsStoreNamedField()); 3313 ASSERT(store->IsStoreNamedField());
3314 gvn_flags_.Add(store->gvn_flags()); 3314 gvn_flags_.Add(store->gvn_flags());
3315 } 3315 }
3316 3316
3317 // Replay effects of this instruction on the given environment. 3317 // Replay effects of this instruction on the given environment.
3318 void ReplayEnvironment(HEnvironment* env); 3318 void ReplayEnvironment(HEnvironment* env);
3319 3319
3320 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
3321
3320 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) 3322 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3321 3323
3322 private: 3324 private:
3323 int capture_id_; 3325 int capture_id_;
3324 }; 3326 };
3325 3327
3326 3328
3327 class HConstant V8_FINAL : public HTemplateInstruction<0> { 3329 class HConstant V8_FINAL : public HTemplateInstruction<0> {
3328 public: 3330 public:
3329 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
3707 HWrapReceiver(HValue* receiver, HValue* function) { 3709 HWrapReceiver(HValue* receiver, HValue* function) {
3708 set_representation(Representation::Tagged()); 3710 set_representation(Representation::Tagged());
3709 SetOperandAt(0, receiver); 3711 SetOperandAt(0, receiver);
3710 SetOperandAt(1, function); 3712 SetOperandAt(1, function);
3711 } 3713 }
3712 }; 3714 };
3713 3715
3714 3716
3715 class HApplyArguments V8_FINAL : public HTemplateInstruction<4> { 3717 class HApplyArguments V8_FINAL : public HTemplateInstruction<4> {
3716 public: 3718 public:
3717 HApplyArguments(HValue* function, 3719 DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*,
3718 HValue* receiver, 3720 HValue*);
3719 HValue* length,
3720 HValue* elements) {
3721 set_representation(Representation::Tagged());
3722 SetOperandAt(0, function);
3723 SetOperandAt(1, receiver);
3724 SetOperandAt(2, length);
3725 SetOperandAt(3, elements);
3726 SetAllSideEffects();
3727 }
3728 3721
3729 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3722 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3730 // The length is untagged, all other inputs are tagged. 3723 // The length is untagged, all other inputs are tagged.
3731 return (index == 2) 3724 return (index == 2)
3732 ? Representation::Integer32() 3725 ? Representation::Integer32()
3733 : Representation::Tagged(); 3726 : Representation::Tagged();
3734 } 3727 }
3735 3728
3736 HValue* function() { return OperandAt(0); } 3729 HValue* function() { return OperandAt(0); }
3737 HValue* receiver() { return OperandAt(1); } 3730 HValue* receiver() { return OperandAt(1); }
3738 HValue* length() { return OperandAt(2); } 3731 HValue* length() { return OperandAt(2); }
3739 HValue* elements() { return OperandAt(3); } 3732 HValue* elements() { return OperandAt(3); }
3740 3733
3741 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 }
3742 }; 3748 };
3743 3749
3744 3750
3745 class HArgumentsElements V8_FINAL : public HTemplateInstruction<0> { 3751 class HArgumentsElements V8_FINAL : public HTemplateInstruction<0> {
3746 public: 3752 public:
3747 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); 3753 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool);
3748 3754
3749 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) 3755 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements)
3750 3756
3751 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
3789 set_representation(Representation::Integer32()); 3795 set_representation(Representation::Integer32());
3790 SetFlag(kUseGVN); 3796 SetFlag(kUseGVN);
3791 } 3797 }
3792 3798
3793 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3799 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3794 }; 3800 };
3795 3801
3796 3802
3797 class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> { 3803 class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> {
3798 public: 3804 public:
3799 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 3805 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*);
3800 set_representation(Representation::Tagged());
3801 SetFlag(kUseGVN);
3802 SetOperandAt(0, arguments);
3803 SetOperandAt(1, length);
3804 SetOperandAt(2, index);
3805 }
3806 3806
3807 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3807 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
3808 3808
3809 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3809 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3810 // The arguments elements is considered tagged. 3810 // The arguments elements is considered tagged.
3811 return index == 0 3811 return index == 0
3812 ? Representation::Tagged() 3812 ? Representation::Tagged()
3813 : Representation::Integer32(); 3813 : Representation::Integer32();
3814 } 3814 }
3815 3815
3816 HValue* arguments() { return OperandAt(0); } 3816 HValue* arguments() { return OperandAt(0); }
3817 HValue* length() { return OperandAt(1); } 3817 HValue* length() { return OperandAt(1); }
3818 HValue* index() { return OperandAt(2); } 3818 HValue* index() { return OperandAt(2); }
3819 3819
3820 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) 3820 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
3821 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
3822 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3831 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
3823 }; 3832 };
3824 3833
3825 3834
3826 class HBoundsCheckBaseIndexInformation; 3835 class HBoundsCheckBaseIndexInformation;
3827 3836
3828 3837
3829 class HBoundsCheck V8_FINAL : public HTemplateInstruction<2> { 3838 class HBoundsCheck V8_FINAL : public HTemplateInstruction<2> {
3830 public: 3839 public:
3831 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
3940 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, 3949 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right,
3941 HType type = HType::Tagged()) 3950 HType type = HType::Tagged())
3942 : HBinaryOperation(context, left, right, type) { 3951 : HBinaryOperation(context, left, right, type) {
3943 SetFlag(kFlexibleRepresentation); 3952 SetFlag(kFlexibleRepresentation);
3944 SetFlag(kTruncatingToInt32); 3953 SetFlag(kTruncatingToInt32);
3945 SetFlag(kAllowUndefinedAsNaN); 3954 SetFlag(kAllowUndefinedAsNaN);
3946 SetAllSideEffects(); 3955 SetAllSideEffects();
3947 } 3956 }
3948 3957
3949 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 3958 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
3950 if (to.IsTagged()) { 3959 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
3960 if (to.IsTagged() &&
3961 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
3951 SetAllSideEffects(); 3962 SetAllSideEffects();
3952 ClearFlag(kUseGVN); 3963 ClearFlag(kUseGVN);
3953 } else { 3964 } else {
3954 ASSERT(to.IsSmiOrInteger32());
3955 ClearAllSideEffects(); 3965 ClearAllSideEffects();
3956 SetFlag(kUseGVN); 3966 SetFlag(kUseGVN);
3957 } 3967 }
3958 } 3968 }
3959 3969
3960 virtual void UpdateRepresentation(Representation new_rep, 3970 virtual void UpdateRepresentation(Representation new_rep,
3961 HInferRepresentationPhase* h_infer, 3971 HInferRepresentationPhase* h_infer,
3962 const char* reason) V8_OVERRIDE { 3972 const char* reason) V8_OVERRIDE {
3963 // We only generate either int32 or generic tagged bitwise operations. 3973 // We only generate either int32 or generic tagged bitwise operations.
3964 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
4016 class HArithmeticBinaryOperation : public HBinaryOperation { 4026 class HArithmeticBinaryOperation : public HBinaryOperation {
4017 public: 4027 public:
4018 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) 4028 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right)
4019 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { 4029 : HBinaryOperation(context, left, right, HType::TaggedNumber()) {
4020 SetAllSideEffects(); 4030 SetAllSideEffects();
4021 SetFlag(kFlexibleRepresentation); 4031 SetFlag(kFlexibleRepresentation);
4022 SetFlag(kAllowUndefinedAsNaN); 4032 SetFlag(kAllowUndefinedAsNaN);
4023 } 4033 }
4024 4034
4025 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4035 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4026 if (to.IsTagged()) { 4036 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
4037 if (to.IsTagged() &&
4038 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
4027 SetAllSideEffects(); 4039 SetAllSideEffects();
4028 ClearFlag(kUseGVN); 4040 ClearFlag(kUseGVN);
4029 } else { 4041 } else {
4030 ClearAllSideEffects(); 4042 ClearAllSideEffects();
4031 SetFlag(kUseGVN); 4043 SetFlag(kUseGVN);
4032 } 4044 }
4033 } 4045 }
4034 4046
4035 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) 4047 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
4036 private: 4048 private:
4037 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4049 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4038 }; 4050 };
4039 4051
4040 4052
4041 class HCompareGeneric V8_FINAL : public HBinaryOperation { 4053 class HCompareGeneric V8_FINAL : public HBinaryOperation {
4042 public: 4054 public:
4043 HCompareGeneric(HValue* context, 4055 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*,
4044 HValue* left, 4056 HValue*, Token::Value);
4045 HValue* right,
4046 Token::Value token)
4047 : HBinaryOperation(context, left, right, HType::Boolean()),
4048 token_(token) {
4049 ASSERT(Token::IsCompareOp(token));
4050 set_representation(Representation::Tagged());
4051 SetAllSideEffects();
4052 }
4053 4057
4054 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4058 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4055 return index == 0 4059 return index == 0
4056 ? Representation::Tagged() 4060 ? Representation::Tagged()
4057 : representation(); 4061 : representation();
4058 } 4062 }
4059 4063
4060 Token::Value token() const { return token_; } 4064 Token::Value token() const { return token_; }
4061 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4065 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4062 4066
4063 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) 4067 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
4064 4068
4065 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
4066 Token::Value token_; 4081 Token::Value token_;
4067 }; 4082 };
4068 4083
4069 4084
4070 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { 4085 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> {
4071 public: 4086 public:
4072 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch, 4087 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch,
4073 HValue*, HValue*, Token::Value); 4088 HValue*, HValue*, Token::Value);
4074 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch, 4089 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch,
4075 HValue*, HValue*, Token::Value, 4090 HValue*, HValue*, Token::Value,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 set_representation(Representation::Tagged()); 4322 set_representation(Representation::Tagged());
4308 SetGVNFlag(kChangesNewSpacePromotion); 4323 SetGVNFlag(kChangesNewSpacePromotion);
4309 } 4324 }
4310 4325
4311 Token::Value token_; 4326 Token::Value token_;
4312 }; 4327 };
4313 4328
4314 4329
4315 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { 4330 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> {
4316 public: 4331 public:
4332 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch);
4333
4317 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4334 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4318 return Representation::None(); 4335 return Representation::None();
4319 } 4336 }
4320 4337
4321 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) 4338 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch)
4339 private:
4340 HIsConstructCallAndBranch() {}
4322 }; 4341 };
4323 4342
4324 4343
4325 class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction { 4344 class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction {
4326 public: 4345 public:
4327 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) 4346 DECLARE_INSTRUCTION_FACTORY_P2(
4328 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } 4347 HHasInstanceTypeAndBranch, HValue*, InstanceType);
4329 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) 4348 DECLARE_INSTRUCTION_FACTORY_P3(
4330 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { 4349 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType);
4331 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
4332 }
4333 4350
4334 InstanceType from() { return from_; } 4351 InstanceType from() { return from_; }
4335 InstanceType to() { return to_; } 4352 InstanceType to() { return to_; }
4336 4353
4337 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4354 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4338 4355
4339 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4356 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4340 return Representation::Tagged(); 4357 return Representation::Tagged();
4341 } 4358 }
4342 4359
4343 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) 4360 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch)
4344 4361
4345 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
4346 InstanceType from_; 4370 InstanceType from_;
4347 InstanceType to_; // Inclusive range, not all combinations work. 4371 InstanceType to_; // Inclusive range, not all combinations work.
4348 }; 4372 };
4349 4373
4350 4374
4351 class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction { 4375 class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction {
4352 public: 4376 public:
4353 explicit HHasCachedArrayIndexAndBranch(HValue* value) 4377 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*);
4354 : HUnaryControlInstruction(value, NULL, NULL) { }
4355 4378
4356 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4379 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4357 return Representation::Tagged(); 4380 return Representation::Tagged();
4358 } 4381 }
4359 4382
4360 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) 4383 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch)
4384 private:
4385 explicit HHasCachedArrayIndexAndBranch(HValue* value)
4386 : HUnaryControlInstruction(value, NULL, NULL) { }
4361 }; 4387 };
4362 4388
4363 4389
4364 class HGetCachedArrayIndex V8_FINAL : public HUnaryOperation { 4390 class HGetCachedArrayIndex V8_FINAL : public HUnaryOperation {
4365 public: 4391 public:
4366 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { 4392 DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*);
4367 set_representation(Representation::Tagged());
4368 SetFlag(kUseGVN);
4369 }
4370 4393
4371 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4394 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4372 return Representation::Tagged(); 4395 return Representation::Tagged();
4373 } 4396 }
4374 4397
4375 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) 4398 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex)
4376 4399
4377 protected: 4400 protected:
4378 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4401 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4379 4402
4380 private: 4403 private:
4404 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) {
4405 set_representation(Representation::Tagged());
4406 SetFlag(kUseGVN);
4407 }
4408
4381 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4409 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4382 }; 4410 };
4383 4411
4384 4412
4385 class HClassOfTestAndBranch V8_FINAL : public HUnaryControlInstruction { 4413 class HClassOfTestAndBranch V8_FINAL : public HUnaryControlInstruction {
4386 public: 4414 public:
4387 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) 4415 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*,
4388 : HUnaryControlInstruction(value, NULL, NULL), 4416 Handle<String>);
4389 class_name_(class_name) { }
4390 4417
4391 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) 4418 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch)
4392 4419
4393 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4420 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4394 return Representation::Tagged(); 4421 return Representation::Tagged();
4395 } 4422 }
4396 4423
4397 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4424 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4398 4425
4399 Handle<String> class_name() const { return class_name_; } 4426 Handle<String> class_name() const { return class_name_; }
4400 4427
4401 private: 4428 private:
4429 HClassOfTestAndBranch(HValue* value, Handle<String> class_name)
4430 : HUnaryControlInstruction(value, NULL, NULL),
4431 class_name_(class_name) { }
4432
4402 Handle<String> class_name_; 4433 Handle<String> class_name_;
4403 }; 4434 };
4404 4435
4405 4436
4406 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction { 4437 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction {
4407 public: 4438 public:
4408 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) 4439 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>);
4409 : HUnaryControlInstruction(value, NULL, NULL),
4410 type_literal_(type_literal) { }
4411 4440
4412 Handle<String> type_literal() { return type_literal_; } 4441 Handle<String> type_literal() { return type_literal_; }
4413 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4442 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4414 4443
4415 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) 4444 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch)
4416 4445
4417 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4446 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4418 return Representation::Tagged(); 4447 return Representation::Tagged();
4419 } 4448 }
4420 4449
4421 private: 4450 private:
4451 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal)
4452 : HUnaryControlInstruction(value, NULL, NULL),
4453 type_literal_(type_literal) { }
4454
4422 Handle<String> type_literal_; 4455 Handle<String> type_literal_;
4423 }; 4456 };
4424 4457
4425 4458
4426 class HInstanceOf V8_FINAL : public HBinaryOperation { 4459 class HInstanceOf V8_FINAL : public HBinaryOperation {
4427 public: 4460 public:
4428 HInstanceOf(HValue* context, HValue* left, HValue* right) 4461 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*);
4429 : HBinaryOperation(context, left, right, HType::Boolean()) {
4430 set_representation(Representation::Tagged());
4431 SetAllSideEffects();
4432 }
4433 4462
4434 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4463 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4435 return Representation::Tagged(); 4464 return Representation::Tagged();
4436 } 4465 }
4437 4466
4438 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4467 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4439 4468
4440 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 }
4441 }; 4477 };
4442 4478
4443 4479
4444 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> { 4480 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> {
4445 public: 4481 public:
4446 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, 4482 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal,
4447 HValue*, 4483 HValue*,
4448 Handle<JSFunction>); 4484 Handle<JSFunction>);
4449 4485
4450 HValue* context() { return OperandAt(0); } 4486 HValue* context() { return OperandAt(0); }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4506 } 4542 }
4507 4543
4508 virtual bool IsDeletable() const V8_OVERRIDE { 4544 virtual bool IsDeletable() const V8_OVERRIDE {
4509 return !right()->representation().IsTagged(); 4545 return !right()->representation().IsTagged();
4510 } 4546 }
4511 }; 4547 };
4512 4548
4513 4549
4514 class HRandom V8_FINAL : public HTemplateInstruction<1> { 4550 class HRandom V8_FINAL : public HTemplateInstruction<1> {
4515 public: 4551 public:
4516 explicit HRandom(HValue* global_object) { 4552 DECLARE_INSTRUCTION_FACTORY_P1(HRandom, HValue*);
4517 SetOperandAt(0, global_object);
4518 set_representation(Representation::Double());
4519 }
4520 4553
4521 HValue* global_object() { return OperandAt(0); } 4554 HValue* global_object() { return OperandAt(0); }
4522 4555
4523 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4556 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4524 return Representation::Tagged(); 4557 return Representation::Tagged();
4525 } 4558 }
4526 4559
4527 DECLARE_CONCRETE_INSTRUCTION(Random) 4560 DECLARE_CONCRETE_INSTRUCTION(Random)
4528 4561
4529 private: 4562 private:
4563 explicit HRandom(HValue* global_object) {
4564 SetOperandAt(0, global_object);
4565 set_representation(Representation::Double());
4566 }
4567
4530 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4568 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4531 }; 4569 };
4532 4570
4533 4571
4534 class HAdd V8_FINAL : public HArithmeticBinaryOperation { 4572 class HAdd V8_FINAL : public HArithmeticBinaryOperation {
4535 public: 4573 public:
4536 static HInstruction* New(Zone* zone, 4574 static HInstruction* New(Zone* zone,
4537 HValue* context, 4575 HValue* context,
4538 HValue* left, 4576 HValue* left,
4539 HValue* right); 4577 HValue* right);
(...skipping 15 matching lines...) Expand all
4555 return true; 4593 return true;
4556 } else if (right()->IsInteger32Constant()) { 4594 } else if (right()->IsInteger32Constant()) {
4557 decomposition->Apply(left(), right()->GetInteger32Constant()); 4595 decomposition->Apply(left(), right()->GetInteger32Constant());
4558 return true; 4596 return true;
4559 } else { 4597 } else {
4560 return false; 4598 return false;
4561 } 4599 }
4562 } 4600 }
4563 4601
4564 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4602 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4565 if (to.IsTagged()) ClearFlag(kAllowUndefinedAsNaN); 4603 if (to.IsTagged()) {
4566 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 }
4567 } 4616 }
4568 4617
4569 DECLARE_CONCRETE_INSTRUCTION(Add) 4618 DECLARE_CONCRETE_INSTRUCTION(Add)
4570 4619
4571 protected: 4620 protected:
4572 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4621 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4573 4622
4574 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4623 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
4575 4624
4576 private: 4625 private:
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
5145 } 5194 }
5146 5195
5147 HEnvironment* environment_; 5196 HEnvironment* environment_;
5148 int index_; 5197 int index_;
5149 HPhi* incoming_value_; 5198 HPhi* incoming_value_;
5150 }; 5199 };
5151 5200
5152 5201
5153 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { 5202 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
5154 public: 5203 public:
5155 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) 5204 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>,
5156 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { 5205 PropertyDetails);
5157 set_representation(Representation::Tagged());
5158 SetFlag(kUseGVN);
5159 SetGVNFlag(kDependsOnGlobalVars);
5160 }
5161 5206
5162 Unique<Cell> cell() const { return cell_; } 5207 Unique<Cell> cell() const { return cell_; }
5163 bool RequiresHoleCheck() const; 5208 bool RequiresHoleCheck() const;
5164 5209
5165 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5210 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5166 5211
5167 virtual intptr_t Hashcode() V8_OVERRIDE { 5212 virtual intptr_t Hashcode() V8_OVERRIDE {
5168 return cell_.Hashcode(); 5213 return cell_.Hashcode();
5169 } 5214 }
5170 5215
5171 virtual void FinalizeUniqueness() V8_OVERRIDE { 5216 virtual void FinalizeUniqueness() V8_OVERRIDE {
5172 cell_ = Unique<Cell>(cell_.handle()); 5217 cell_ = Unique<Cell>(cell_.handle());
5173 } 5218 }
5174 5219
5175 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5220 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5176 return Representation::None(); 5221 return Representation::None();
5177 } 5222 }
5178 5223
5179 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) 5224 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell)
5180 5225
5181 protected: 5226 protected:
5182 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5227 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
5183 return cell_ == HLoadGlobalCell::cast(other)->cell_; 5228 return cell_ == HLoadGlobalCell::cast(other)->cell_;
5184 } 5229 }
5185 5230
5186 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
5187 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } 5239 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }
5188 5240
5189 Unique<Cell> cell_; 5241 Unique<Cell> cell_;
5190 PropertyDetails details_; 5242 PropertyDetails details_;
5191 }; 5243 };
5192 5244
5193 5245
5194 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { 5246 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> {
5195 public: 5247 public:
5196 HLoadGlobalGeneric(HValue* context, 5248 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*,
5197 HValue* global_object, 5249 Handle<Object>, bool);
5198 Handle<Object> name,
5199 bool for_typeof)
5200 : name_(name),
5201 for_typeof_(for_typeof) {
5202 SetOperandAt(0, context);
5203 SetOperandAt(1, global_object);
5204 set_representation(Representation::Tagged());
5205 SetAllSideEffects();
5206 }
5207 5250
5208 HValue* context() { return OperandAt(0); } 5251 HValue* context() { return OperandAt(0); }
5209 HValue* global_object() { return OperandAt(1); } 5252 HValue* global_object() { return OperandAt(1); }
5210 Handle<Object> name() const { return name_; } 5253 Handle<Object> name() const { return name_; }
5211 bool for_typeof() const { return for_typeof_; } 5254 bool for_typeof() const { return for_typeof_; }
5212 5255
5213 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5256 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5214 5257
5215 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5258 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5216 return Representation::Tagged(); 5259 return Representation::Tagged();
5217 } 5260 }
5218 5261
5219 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) 5262 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric)
5220 5263
5221 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
5222 Handle<Object> name_; 5277 Handle<Object> name_;
5223 bool for_typeof_; 5278 bool for_typeof_;
5224 }; 5279 };
5225 5280
5226 5281
5227 class HAllocate V8_FINAL : public HTemplateInstruction<2> { 5282 class HAllocate V8_FINAL : public HTemplateInstruction<2> {
5228 public: 5283 public:
5229 static HAllocate* New(Zone* zone, 5284 static HAllocate* New(Zone* zone,
5230 HValue* context, 5285 HValue* context,
5231 HValue* size, 5286 HValue* size,
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
5962 } 6017 }
5963 6018
5964 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6019 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
5965 6020
5966 HObjectAccess access_; 6021 HObjectAccess access_;
5967 }; 6022 };
5968 6023
5969 6024
5970 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { 6025 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> {
5971 public: 6026 public:
5972 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) 6027 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
5973 : name_(name) { 6028 Handle<Object>);
5974 SetOperandAt(0, context);
5975 SetOperandAt(1, object);
5976 set_representation(Representation::Tagged());
5977 SetAllSideEffects();
5978 }
5979 6029
5980 HValue* context() { return OperandAt(0); } 6030 HValue* context() { return OperandAt(0); }
5981 HValue* object() { return OperandAt(1); } 6031 HValue* object() { return OperandAt(1); }
5982 Handle<Object> name() const { return name_; } 6032 Handle<Object> name() const { return name_; }
5983 6033
5984 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6034 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5985 return Representation::Tagged(); 6035 return Representation::Tagged();
5986 } 6036 }
5987 6037
5988 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6038 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5989 6039
5990 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) 6040 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric)
5991 6041
5992 private: 6042 private:
6043 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
6044 : name_(name) {
6045 SetOperandAt(0, context);
6046 SetOperandAt(1, object);
6047 set_representation(Representation::Tagged());
6048 SetAllSideEffects();
6049 }
6050
5993 Handle<Object> name_; 6051 Handle<Object> name_;
5994 }; 6052 };
5995 6053
5996 6054
5997 class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation { 6055 class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation {
5998 public: 6056 public:
5999 explicit HLoadFunctionPrototype(HValue* function) 6057 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*);
6000 : HUnaryOperation(function) {
6001 set_representation(Representation::Tagged());
6002 SetFlag(kUseGVN);
6003 SetGVNFlag(kDependsOnCalls);
6004 }
6005 6058
6006 HValue* function() { return OperandAt(0); } 6059 HValue* function() { return OperandAt(0); }
6007 6060
6008 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6061 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6009 return Representation::Tagged(); 6062 return Representation::Tagged();
6010 } 6063 }
6011 6064
6012 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) 6065 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype)
6013 6066
6014 protected: 6067 protected:
6015 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 6068 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
6069
6070 private:
6071 explicit HLoadFunctionPrototype(HValue* function)
6072 : HUnaryOperation(function) {
6073 set_representation(Representation::Tagged());
6074 SetFlag(kUseGVN);
6075 SetGVNFlag(kDependsOnCalls);
6076 }
6016 }; 6077 };
6017 6078
6018 class ArrayInstructionInterface { 6079 class ArrayInstructionInterface {
6019 public: 6080 public:
6020 virtual HValue* GetKey() = 0; 6081 virtual HValue* GetKey() = 0;
6021 virtual void SetKey(HValue* key) = 0; 6082 virtual void SetKey(HValue* key) = 0;
6022 virtual void SetIndexOffset(uint32_t index_offset) = 0; 6083 virtual void SetIndexOffset(uint32_t index_offset) = 0;
6023 virtual bool IsDehoisted() = 0; 6084 virtual bool IsDehoisted() = 0;
6024 virtual void SetDehoisted(bool is_dehoisted) = 0; 6085 virtual void SetDehoisted(bool is_dehoisted) = 0;
6025 virtual ~ArrayInstructionInterface() { }; 6086 virtual ~ArrayInstructionInterface() { };
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
6193 {}; // NOLINT 6254 {}; // NOLINT
6194 class IsDehoistedField: 6255 class IsDehoistedField:
6195 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> 6256 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted>
6196 {}; // NOLINT 6257 {}; // NOLINT
6197 uint32_t bit_field_; 6258 uint32_t bit_field_;
6198 }; 6259 };
6199 6260
6200 6261
6201 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { 6262 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> {
6202 public: 6263 public:
6203 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { 6264 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*,
6204 set_representation(Representation::Tagged()); 6265 HValue*);
6205 SetOperandAt(0, obj);
6206 SetOperandAt(1, key);
6207 SetOperandAt(2, context);
6208 SetAllSideEffects();
6209 }
6210
6211 HValue* object() { return OperandAt(0); } 6266 HValue* object() { return OperandAt(0); }
6212 HValue* key() { return OperandAt(1); } 6267 HValue* key() { return OperandAt(1); }
6213 HValue* context() { return OperandAt(2); } 6268 HValue* context() { return OperandAt(2); }
6214 6269
6215 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6270 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6216 6271
6217 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6272 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6218 // tagged[tagged] 6273 // tagged[tagged]
6219 return Representation::Tagged(); 6274 return Representation::Tagged();
6220 } 6275 }
6221 6276
6222 virtual HValue* Canonicalize() V8_OVERRIDE; 6277 virtual HValue* Canonicalize() V8_OVERRIDE;
6223 6278
6224 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) 6279 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
6280
6281 private:
6282 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
6283 set_representation(Representation::Tagged());
6284 SetOperandAt(0, obj);
6285 SetOperandAt(1, key);
6286 SetOperandAt(2, context);
6287 SetAllSideEffects();
6288 }
6225 }; 6289 };
6226 6290
6227 6291
6228 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { 6292 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> {
6229 public: 6293 public:
6230 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, 6294 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*,
6231 HObjectAccess, HValue*); 6295 HObjectAccess, HValue*);
6232 6296
6233 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 6297 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
6234 6298
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
6333 6397
6334 HObjectAccess access_; 6398 HObjectAccess access_;
6335 HValue* new_space_dominator_; 6399 HValue* new_space_dominator_;
6336 WriteBarrierMode write_barrier_mode_ : 1; 6400 WriteBarrierMode write_barrier_mode_ : 1;
6337 bool has_transition_ : 1; 6401 bool has_transition_ : 1;
6338 }; 6402 };
6339 6403
6340 6404
6341 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { 6405 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
6342 public: 6406 public:
6343 HStoreNamedGeneric(HValue* context, 6407 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
6344 HValue* object, 6408 Handle<String>, HValue*,
6345 Handle<String> name, 6409 StrictModeFlag);
6346 HValue* value,
6347 StrictModeFlag strict_mode_flag)
6348 : name_(name),
6349 strict_mode_flag_(strict_mode_flag) {
6350 SetOperandAt(0, object);
6351 SetOperandAt(1, value);
6352 SetOperandAt(2, context);
6353 SetAllSideEffects();
6354 }
6355
6356 HValue* object() { return OperandAt(0); } 6410 HValue* object() { return OperandAt(0); }
6357 HValue* value() { return OperandAt(1); } 6411 HValue* value() { return OperandAt(1); }
6358 HValue* context() { return OperandAt(2); } 6412 HValue* context() { return OperandAt(2); }
6359 Handle<String> name() { return name_; } 6413 Handle<String> name() { return name_; }
6360 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } 6414 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; }
6361 6415
6362 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6416 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6363 6417
6364 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6418 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6365 return Representation::Tagged(); 6419 return Representation::Tagged();
6366 } 6420 }
6367 6421
6368 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) 6422 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric)
6369 6423
6370 private: 6424 private:
6425 HStoreNamedGeneric(HValue* context,
6426 HValue* object,
6427 Handle<String> name,
6428 HValue* value,
6429 StrictModeFlag strict_mode_flag)
6430 : name_(name),
6431 strict_mode_flag_(strict_mode_flag) {
6432 SetOperandAt(0, object);
6433 SetOperandAt(1, value);
6434 SetOperandAt(2, context);
6435 SetAllSideEffects();
6436 }
6437
6371 Handle<String> name_; 6438 Handle<String> name_;
6372 StrictModeFlag strict_mode_flag_; 6439 StrictModeFlag strict_mode_flag_;
6373 }; 6440 };
6374 6441
6375 6442
6376 class HStoreKeyed V8_FINAL 6443 class HStoreKeyed V8_FINAL
6377 : public HTemplateInstruction<3>, public ArrayInstructionInterface { 6444 : public HTemplateInstruction<3>, public ArrayInstructionInterface {
6378 public: 6445 public:
6379 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, 6446 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*,
6380 ElementsKind); 6447 ElementsKind);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
6509 ElementsKind elements_kind_; 6576 ElementsKind elements_kind_;
6510 uint32_t index_offset_; 6577 uint32_t index_offset_;
6511 bool is_dehoisted_ : 1; 6578 bool is_dehoisted_ : 1;
6512 bool is_uninitialized_ : 1; 6579 bool is_uninitialized_ : 1;
6513 HValue* new_space_dominator_; 6580 HValue* new_space_dominator_;
6514 }; 6581 };
6515 6582
6516 6583
6517 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { 6584 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> {
6518 public: 6585 public:
6519 HStoreKeyedGeneric(HValue* context, 6586 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*,
6520 HValue* object, 6587 HValue*, HValue*, StrictModeFlag);
6521 HValue* key,
6522 HValue* value,
6523 StrictModeFlag strict_mode_flag)
6524 : strict_mode_flag_(strict_mode_flag) {
6525 SetOperandAt(0, object);
6526 SetOperandAt(1, key);
6527 SetOperandAt(2, value);
6528 SetOperandAt(3, context);
6529 SetAllSideEffects();
6530 }
6531 6588
6532 HValue* object() { return OperandAt(0); } 6589 HValue* object() { return OperandAt(0); }
6533 HValue* key() { return OperandAt(1); } 6590 HValue* key() { return OperandAt(1); }
6534 HValue* value() { return OperandAt(2); } 6591 HValue* value() { return OperandAt(2); }
6535 HValue* context() { return OperandAt(3); } 6592 HValue* context() { return OperandAt(3); }
6536 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } 6593 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; }
6537 6594
6538 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6595 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6539 // tagged[tagged] = tagged 6596 // tagged[tagged] = tagged
6540 return Representation::Tagged(); 6597 return Representation::Tagged();
6541 } 6598 }
6542 6599
6543 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6600 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6544 6601
6545 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) 6602 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
6546 6603
6547 private: 6604 private:
6605 HStoreKeyedGeneric(HValue* context,
6606 HValue* object,
6607 HValue* key,
6608 HValue* value,
6609 StrictModeFlag strict_mode_flag)
6610 : strict_mode_flag_(strict_mode_flag) {
6611 SetOperandAt(0, object);
6612 SetOperandAt(1, key);
6613 SetOperandAt(2, value);
6614 SetOperandAt(3, context);
6615 SetAllSideEffects();
6616 }
6617
6548 StrictModeFlag strict_mode_flag_; 6618 StrictModeFlag strict_mode_flag_;
6549 }; 6619 };
6550 6620
6551 6621
6552 class HTransitionElementsKind V8_FINAL : public HTemplateInstruction<2> { 6622 class HTransitionElementsKind V8_FINAL : public HTemplateInstruction<2> {
6553 public: 6623 public:
6554 inline static HTransitionElementsKind* New(Zone* zone, 6624 inline static HTransitionElementsKind* New(Zone* zone,
6555 HValue* context, 6625 HValue* context,
6556 HValue* object, 6626 HValue* object,
6557 Handle<Map> original_map, 6627 Handle<Map> original_map,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
6625 6695
6626 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 6696 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
6627 6697
6628 protected: 6698 protected:
6629 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 6699 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
6630 6700
6631 private: 6701 private:
6632 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) 6702 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags)
6633 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { 6703 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) {
6634 set_representation(Representation::Tagged()); 6704 set_representation(Representation::Tagged());
6635 if (flags_ == STRING_ADD_CHECK_NONE) { 6705 if (MightHaveSideEffects()) {
6706 SetAllSideEffects();
6707 } else {
6636 SetFlag(kUseGVN); 6708 SetFlag(kUseGVN);
6637 SetGVNFlag(kDependsOnMaps); 6709 SetGVNFlag(kDependsOnMaps);
6638 SetGVNFlag(kChangesNewSpacePromotion); 6710 SetGVNFlag(kChangesNewSpacePromotion);
6639 } else {
6640 SetAllSideEffects();
6641 } 6711 }
6642 } 6712 }
6643 6713
6714 bool MightHaveSideEffects() const {
6715 return flags_ != STRING_ADD_CHECK_NONE &&
6716 (left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved());
6717 }
6718
6644 // No side-effects except possible allocation: 6719 // No side-effects except possible allocation:
6645 // NOTE: this instruction does not call ToString() on its inputs, when flags_ 6720 // NOTE: this instruction does not call ToString() on its inputs, when flags_
6646 // is set to STRING_ADD_CHECK_NONE. 6721 // is set to STRING_ADD_CHECK_NONE.
6647 virtual bool IsDeletable() const V8_OVERRIDE { 6722 virtual bool IsDeletable() const V8_OVERRIDE {
6648 return flags_ == STRING_ADD_CHECK_NONE; 6723 return !MightHaveSideEffects();
6649 } 6724 }
6650 6725
6651 const StringAddFlags flags_; 6726 const StringAddFlags flags_;
6652 }; 6727 };
6653 6728
6654 6729
6655 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { 6730 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> {
6656 public: 6731 public:
6657 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, 6732 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt,
6658 HValue*, 6733 HValue*,
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
6911 ASSERT(function->function_id == Runtime::kCreateObjectLiteral); 6986 ASSERT(function->function_id == Runtime::kCreateObjectLiteral);
6912 #endif 6987 #endif
6913 } 6988 }
6914 6989
6915 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6990 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6916 }; 6991 };
6917 6992
6918 6993
6919 class HValueOf V8_FINAL : public HUnaryOperation { 6994 class HValueOf V8_FINAL : public HUnaryOperation {
6920 public: 6995 public:
6921 explicit HValueOf(HValue* value) : HUnaryOperation(value) { 6996 DECLARE_INSTRUCTION_FACTORY_P1(HValueOf, HValue*);
6922 set_representation(Representation::Tagged());
6923 }
6924 6997
6925 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6998 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6926 return Representation::Tagged(); 6999 return Representation::Tagged();
6927 } 7000 }
6928 7001
6929 DECLARE_CONCRETE_INSTRUCTION(ValueOf) 7002 DECLARE_CONCRETE_INSTRUCTION(ValueOf)
6930 7003
6931 private: 7004 private:
7005 explicit HValueOf(HValue* value) : HUnaryOperation(value) {
7006 set_representation(Representation::Tagged());
7007 }
7008
6932 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7009 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6933 }; 7010 };
6934 7011
6935 7012
6936 class HDateField V8_FINAL : public HUnaryOperation { 7013 class HDateField V8_FINAL : public HUnaryOperation {
6937 public: 7014 public:
6938 HDateField(HValue* date, Smi* index) 7015 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*);
6939 : HUnaryOperation(date), index_(index) {
6940 set_representation(Representation::Tagged());
6941 }
6942 7016
6943 Smi* index() const { return index_; } 7017 Smi* index() const { return index_; }
6944 7018
6945 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7019 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6946 return Representation::Tagged(); 7020 return Representation::Tagged();
6947 } 7021 }
6948 7022
6949 DECLARE_CONCRETE_INSTRUCTION(DateField) 7023 DECLARE_CONCRETE_INSTRUCTION(DateField)
6950 7024
6951 private: 7025 private:
7026 HDateField(HValue* date, Smi* index)
7027 : HUnaryOperation(date), index_(index) {
7028 set_representation(Representation::Tagged());
7029 }
7030
6952 Smi* index_; 7031 Smi* index_;
6953 }; 7032 };
6954 7033
6955 7034
6956 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> { 7035 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> {
6957 public: 7036 public:
6958 HSeqStringSetChar(String::Encoding encoding, 7037 DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding,
6959 HValue* string, 7038 HValue*, HValue*, HValue*);
6960 HValue* index,
6961 HValue* value) : encoding_(encoding) {
6962 SetOperandAt(0, string);
6963 SetOperandAt(1, index);
6964 SetOperandAt(2, value);
6965 set_representation(Representation::Tagged());
6966 }
6967 7039
6968 String::Encoding encoding() { return encoding_; } 7040 String::Encoding encoding() { return encoding_; }
6969 HValue* string() { return OperandAt(0); } 7041 HValue* string() { return OperandAt(0); }
6970 HValue* index() { return OperandAt(1); } 7042 HValue* index() { return OperandAt(1); }
6971 HValue* value() { return OperandAt(2); } 7043 HValue* value() { return OperandAt(2); }
6972 7044
6973 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7045 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6974 return (index == 0) ? Representation::Tagged() 7046 return (index == 0) ? Representation::Tagged()
6975 : Representation::Integer32(); 7047 : Representation::Integer32();
6976 } 7048 }
6977 7049
6978 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) 7050 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar)
6979 7051
6980 private: 7052 private:
7053 HSeqStringSetChar(String::Encoding encoding,
7054 HValue* string,
7055 HValue* index,
7056 HValue* value) : encoding_(encoding) {
7057 SetOperandAt(0, string);
7058 SetOperandAt(1, index);
7059 SetOperandAt(2, value);
7060 set_representation(Representation::Tagged());
7061 }
7062
6981 String::Encoding encoding_; 7063 String::Encoding encoding_;
6982 }; 7064 };
6983 7065
6984 7066
6985 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { 7067 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> {
6986 public: 7068 public:
6987 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); 7069 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*);
6988 7070
6989 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7071 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6990 return Representation::Tagged(); 7072 return Representation::Tagged();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
7119 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7201 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7120 }; 7202 };
7121 7203
7122 7204
7123 #undef DECLARE_INSTRUCTION 7205 #undef DECLARE_INSTRUCTION
7124 #undef DECLARE_CONCRETE_INSTRUCTION 7206 #undef DECLARE_CONCRETE_INSTRUCTION
7125 7207
7126 } } // namespace v8::internal 7208 } } // namespace v8::internal
7127 7209
7128 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7210 #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