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

Side by Side Diff: src/code-stubs.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, 4 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/code-factory.cc ('k') | src/code-stubs.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_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 16 matching lines...) Expand all
27 V(CallApiAccessor) \ 27 V(CallApiAccessor) \
28 V(CallApiGetter) \ 28 V(CallApiGetter) \
29 V(CallConstruct) \ 29 V(CallConstruct) \
30 V(CallFunction) \ 30 V(CallFunction) \
31 V(CallIC) \ 31 V(CallIC) \
32 V(CallIC_Array) \ 32 V(CallIC_Array) \
33 V(CEntry) \ 33 V(CEntry) \
34 V(CompareIC) \ 34 V(CompareIC) \
35 V(DoubleToI) \ 35 V(DoubleToI) \
36 V(FunctionPrototype) \ 36 V(FunctionPrototype) \
37 V(Instanceof) \ 37 V(InstanceOf) \
38 V(InternalArrayConstructor) \ 38 V(InternalArrayConstructor) \
39 V(JSEntry) \ 39 V(JSEntry) \
40 V(KeyedLoadICTrampoline) \ 40 V(KeyedLoadICTrampoline) \
41 V(LoadICTrampoline) \ 41 V(LoadICTrampoline) \
42 V(CallICTrampoline) \ 42 V(CallICTrampoline) \
43 V(CallIC_ArrayTrampoline) \ 43 V(CallIC_ArrayTrampoline) \
44 V(LoadIndexedInterceptor) \ 44 V(LoadIndexedInterceptor) \
45 V(LoadIndexedString) \ 45 V(LoadIndexedString) \
46 V(MathPow) \ 46 V(MathPow) \
47 V(ProfileEntryHook) \ 47 V(ProfileEntryHook) \
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 bool is_js_array() const { return IsJsArrayBits::decode(sub_minor_key()); } 869 bool is_js_array() const { return IsJsArrayBits::decode(sub_minor_key()); }
870 870
871 private: 871 private:
872 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; 872 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};
873 class IsJsArrayBits : public BitField<bool, ElementsKindBits::kNext, 1> {}; 873 class IsJsArrayBits : public BitField<bool, ElementsKindBits::kNext, 1> {};
874 874
875 DEFINE_CALL_INTERFACE_DESCRIPTOR(GrowArrayElements); 875 DEFINE_CALL_INTERFACE_DESCRIPTOR(GrowArrayElements);
876 DEFINE_HYDROGEN_CODE_STUB(GrowArrayElements, HydrogenCodeStub); 876 DEFINE_HYDROGEN_CODE_STUB(GrowArrayElements, HydrogenCodeStub);
877 }; 877 };
878 878
879 class InstanceofStub: public PlatformCodeStub { 879
880 class InstanceOfStub final : public PlatformCodeStub {
880 public: 881 public:
881 enum Flags { 882 explicit InstanceOfStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
882 kNoFlags = 0,
883 kArgsInRegisters = 1 << 0,
884 kCallSiteInlineCheck = 1 << 1,
885 kReturnTrueFalseObject = 1 << 2
886 };
887
888 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) {
889 minor_key_ = FlagBits::encode(flags);
890 }
891
892 static Register left() { return InstanceofDescriptor::left(); }
893 static Register right() { return InstanceofDescriptor::right(); }
894
895 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
896 if (HasArgsInRegisters()) {
897 return InstanceofDescriptor(isolate());
898 }
899 return ContextOnlyDescriptor(isolate());
900 }
901 883
902 private: 884 private:
903 Flags flags() const { return FlagBits::decode(minor_key_); } 885 DEFINE_CALL_INTERFACE_DESCRIPTOR(InstanceOf);
904 886 DEFINE_PLATFORM_CODE_STUB(InstanceOf, PlatformCodeStub);
905 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; }
906
907 bool HasCallSiteInlineCheck() const {
908 return (flags() & kCallSiteInlineCheck) != 0;
909 }
910
911 bool ReturnTrueFalseObject() const {
912 return (flags() & kReturnTrueFalseObject) != 0;
913 }
914
915 void PrintName(std::ostream& os) const override; // NOLINT
916
917 class FlagBits : public BitField<Flags, 0, 3> {};
918
919 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub);
920 }; 887 };
921 888
922 889
923 enum AllocationSiteOverrideMode { 890 enum AllocationSiteOverrideMode {
924 DONT_OVERRIDE, 891 DONT_OVERRIDE,
925 DISABLE_ALLOCATION_SITES, 892 DISABLE_ALLOCATION_SITES,
926 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES 893 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES
927 }; 894 };
928 895
929 896
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after
3127 #undef DEFINE_PLATFORM_CODE_STUB 3094 #undef DEFINE_PLATFORM_CODE_STUB
3128 #undef DEFINE_HANDLER_CODE_STUB 3095 #undef DEFINE_HANDLER_CODE_STUB
3129 #undef DEFINE_HYDROGEN_CODE_STUB 3096 #undef DEFINE_HYDROGEN_CODE_STUB
3130 #undef DEFINE_CODE_STUB 3097 #undef DEFINE_CODE_STUB
3131 #undef DEFINE_CODE_STUB_BASE 3098 #undef DEFINE_CODE_STUB_BASE
3132 3099
3133 extern Representation RepresentationFromType(Type* type); 3100 extern Representation RepresentationFromType(Type* type);
3134 } } // namespace v8::internal 3101 } } // namespace v8::internal
3135 3102
3136 #endif // V8_CODE_STUBS_H_ 3103 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/code-factory.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698