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

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

Issue 1304633002: Correctify instanceof and make it optimizable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Add MIPS/MIPS64 ports. Created 5 years, 3 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
« no previous file with comments | « src/hydrogen.cc ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <iosfwd> 9 #include <iosfwd>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 V(ForceRepresentation) \ 98 V(ForceRepresentation) \
99 V(ForInCacheArray) \ 99 V(ForInCacheArray) \
100 V(ForInPrepareMap) \ 100 V(ForInPrepareMap) \
101 V(FunctionLiteral) \ 101 V(FunctionLiteral) \
102 V(GetCachedArrayIndex) \ 102 V(GetCachedArrayIndex) \
103 V(Goto) \ 103 V(Goto) \
104 V(HasCachedArrayIndexAndBranch) \ 104 V(HasCachedArrayIndexAndBranch) \
105 V(HasInstanceTypeAndBranch) \ 105 V(HasInstanceTypeAndBranch) \
106 V(InnerAllocatedObject) \ 106 V(InnerAllocatedObject) \
107 V(InstanceOf) \ 107 V(InstanceOf) \
108 V(InstanceOfKnownGlobal) \
109 V(InvokeFunction) \ 108 V(InvokeFunction) \
110 V(IsConstructCallAndBranch) \ 109 V(IsConstructCallAndBranch) \
110 V(HasInPrototypeChainAndBranch) \
111 V(IsObjectAndBranch) \ 111 V(IsObjectAndBranch) \
112 V(IsStringAndBranch) \ 112 V(IsStringAndBranch) \
113 V(IsSmiAndBranch) \ 113 V(IsSmiAndBranch) \
114 V(IsUndetectableAndBranch) \ 114 V(IsUndetectableAndBranch) \
115 V(LeaveInlined) \ 115 V(LeaveInlined) \
116 V(LoadContextSlot) \ 116 V(LoadContextSlot) \
117 V(LoadFieldByIndex) \ 117 V(LoadFieldByIndex) \
118 V(LoadFunctionPrototype) \ 118 V(LoadFunctionPrototype) \
119 V(LoadGlobalGeneric) \ 119 V(LoadGlobalGeneric) \
120 V(LoadGlobalViaContext) \ 120 V(LoadGlobalViaContext) \
(...skipping 4632 matching lines...) Expand 10 before | Expand all | Expand 10 after
4753 private: 4753 private:
4754 HInstanceOf(HValue* context, HValue* left, HValue* right) 4754 HInstanceOf(HValue* context, HValue* left, HValue* right)
4755 : HBinaryOperation(context, left, right, Strength::WEAK, 4755 : HBinaryOperation(context, left, right, Strength::WEAK,
4756 HType::Boolean()) { 4756 HType::Boolean()) {
4757 set_representation(Representation::Tagged()); 4757 set_representation(Representation::Tagged());
4758 SetAllSideEffects(); 4758 SetAllSideEffects();
4759 } 4759 }
4760 }; 4760 };
4761 4761
4762 4762
4763 class HInstanceOfKnownGlobal final : public HTemplateInstruction<2> { 4763 class HHasInPrototypeChainAndBranch final
4764 : public HTemplateControlInstruction<2, 2> {
4764 public: 4765 public:
4765 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, 4766 DECLARE_INSTRUCTION_FACTORY_P2(HHasInPrototypeChainAndBranch, HValue*,
4766 HValue*, 4767 HValue*);
4767 Handle<JSFunction>);
4768 4768
4769 HValue* context() { return OperandAt(0); } 4769 HValue* object() const { return OperandAt(0); }
4770 HValue* left() { return OperandAt(1); } 4770 HValue* prototype() const { return OperandAt(1); }
4771 Handle<JSFunction> function() { return function_; }
4772 4771
4773 Representation RequiredInputRepresentation(int index) override { 4772 Representation RequiredInputRepresentation(int index) override {
4774 return Representation::Tagged(); 4773 return Representation::Tagged();
4775 } 4774 }
4776 4775
4777 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) 4776 bool ObjectNeedsSmiCheck() const {
4777 return !object()->type().IsHeapObject() &&
4778 !object()->representation().IsHeapObject();
4779 }
4780
4781 DECLARE_CONCRETE_INSTRUCTION(HasInPrototypeChainAndBranch)
4778 4782
4779 private: 4783 private:
4780 HInstanceOfKnownGlobal(HValue* context, 4784 HHasInPrototypeChainAndBranch(HValue* object, HValue* prototype) {
4781 HValue* left, 4785 SetOperandAt(0, object);
4782 Handle<JSFunction> right) 4786 SetOperandAt(1, prototype);
4783 : HTemplateInstruction<2>(HType::Boolean()), function_(right) { 4787 SetDependsOnFlag(kCalls);
4784 SetOperandAt(0, context);
4785 SetOperandAt(1, left);
4786 set_representation(Representation::Tagged());
4787 SetAllSideEffects();
4788 } 4788 }
4789
4790 Handle<JSFunction> function_;
4791 }; 4789 };
4792 4790
4793 4791
4794 class HPower final : public HTemplateInstruction<2> { 4792 class HPower final : public HTemplateInstruction<2> {
4795 public: 4793 public:
4796 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, 4794 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context,
4797 HValue* left, HValue* right); 4795 HValue* left, HValue* right);
4798 4796
4799 HValue* left() { return OperandAt(0); } 4797 HValue* left() { return OperandAt(0); }
4800 HValue* right() const { return OperandAt(1); } 4798 HValue* right() const { return OperandAt(1); }
(...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after
8061 }; 8059 };
8062 8060
8063 8061
8064 8062
8065 #undef DECLARE_INSTRUCTION 8063 #undef DECLARE_INSTRUCTION
8066 #undef DECLARE_CONCRETE_INSTRUCTION 8064 #undef DECLARE_CONCRETE_INSTRUCTION
8067 8065
8068 } } // namespace v8::internal 8066 } } // namespace v8::internal
8069 8067
8070 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 8068 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698