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

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: Add arm64 port. 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
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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 bool is_js_array() const { return IsJsArrayBits::decode(sub_minor_key()); } 893 bool is_js_array() const { return IsJsArrayBits::decode(sub_minor_key()); }
894 894
895 private: 895 private:
896 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; 896 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};
897 class IsJsArrayBits : public BitField<bool, ElementsKindBits::kNext, 1> {}; 897 class IsJsArrayBits : public BitField<bool, ElementsKindBits::kNext, 1> {};
898 898
899 DEFINE_CALL_INTERFACE_DESCRIPTOR(GrowArrayElements); 899 DEFINE_CALL_INTERFACE_DESCRIPTOR(GrowArrayElements);
900 DEFINE_HYDROGEN_CODE_STUB(GrowArrayElements, HydrogenCodeStub); 900 DEFINE_HYDROGEN_CODE_STUB(GrowArrayElements, HydrogenCodeStub);
901 }; 901 };
902 902
903 class InstanceofStub: public PlatformCodeStub { 903
904 class InstanceOfStub final : public PlatformCodeStub {
904 public: 905 public:
905 enum Flags { 906 explicit InstanceOfStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
906 kNoFlags = 0,
907 kArgsInRegisters = 1 << 0,
908 kCallSiteInlineCheck = 1 << 1,
909 kReturnTrueFalseObject = 1 << 2
910 };
911
912 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) {
913 minor_key_ = FlagBits::encode(flags);
914 }
915
916 static Register left() { return InstanceofDescriptor::left(); }
917 static Register right() { return InstanceofDescriptor::right(); }
918
919 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
920 if (HasArgsInRegisters()) {
921 return InstanceofDescriptor(isolate());
922 }
923 return ContextOnlyDescriptor(isolate());
924 }
925 907
926 private: 908 private:
927 Flags flags() const { return FlagBits::decode(minor_key_); } 909 DEFINE_CALL_INTERFACE_DESCRIPTOR(InstanceOf);
928 910 DEFINE_PLATFORM_CODE_STUB(InstanceOf, PlatformCodeStub);
929 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; }
930
931 bool HasCallSiteInlineCheck() const {
932 return (flags() & kCallSiteInlineCheck) != 0;
933 }
934
935 bool ReturnTrueFalseObject() const {
936 return (flags() & kReturnTrueFalseObject) != 0;
937 }
938
939 void PrintName(std::ostream& os) const override; // NOLINT
940
941 class FlagBits : public BitField<Flags, 0, 3> {};
942
943 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub);
944 }; 911 };
945 912
946 913
947 enum AllocationSiteOverrideMode { 914 enum AllocationSiteOverrideMode {
948 DONT_OVERRIDE, 915 DONT_OVERRIDE,
949 DISABLE_ALLOCATION_SITES, 916 DISABLE_ALLOCATION_SITES,
950 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES 917 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES
951 }; 918 };
952 919
953 920
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 #undef DEFINE_PLATFORM_CODE_STUB 3042 #undef DEFINE_PLATFORM_CODE_STUB
3076 #undef DEFINE_HANDLER_CODE_STUB 3043 #undef DEFINE_HANDLER_CODE_STUB
3077 #undef DEFINE_HYDROGEN_CODE_STUB 3044 #undef DEFINE_HYDROGEN_CODE_STUB
3078 #undef DEFINE_CODE_STUB 3045 #undef DEFINE_CODE_STUB
3079 #undef DEFINE_CODE_STUB_BASE 3046 #undef DEFINE_CODE_STUB_BASE
3080 3047
3081 extern Representation RepresentationFromType(Type* type); 3048 extern Representation RepresentationFromType(Type* type);
3082 } } // namespace v8::internal 3049 } } // namespace v8::internal
3083 3050
3084 #endif // V8_CODE_STUBS_H_ 3051 #endif // V8_CODE_STUBS_H_
OLDNEW
« src/arm/code-stubs-arm.cc ('K') | « src/code-factory.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698