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

Side by Side Diff: src/ic.h

Issue 136643008: A64: Synchronize with r18256. (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/ia32/stub-cache-ia32.cc ('k') | src/ic.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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 StrictModeFlag strict_mode() const { return strict_mode_; } 588 StrictModeFlag strict_mode() const { return strict_mode_; }
589 589
590 // Code generators for stub routines. Only called once at startup. 590 // Code generators for stub routines. Only called once at startup.
591 static void GenerateSlow(MacroAssembler* masm); 591 static void GenerateSlow(MacroAssembler* masm);
592 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 592 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
593 static void GeneratePreMonomorphic(MacroAssembler* masm) { 593 static void GeneratePreMonomorphic(MacroAssembler* masm) {
594 GenerateMiss(masm); 594 GenerateMiss(masm);
595 } 595 }
596 static void GenerateMiss(MacroAssembler* masm); 596 static void GenerateMiss(MacroAssembler* masm);
597 static void GenerateMegamorphic(MacroAssembler* masm, 597 static void GenerateMegamorphic(MacroAssembler* masm,
598 StrictModeFlag strict_mode); 598 ExtraICState extra_ic_state);
599 static void GenerateNormal(MacroAssembler* masm); 599 static void GenerateNormal(MacroAssembler* masm);
600 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 600 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
601 StrictModeFlag strict_mode); 601 StrictModeFlag strict_mode);
602 602
603 MUST_USE_RESULT MaybeObject* Store( 603 MUST_USE_RESULT MaybeObject* Store(
604 Handle<Object> object, 604 Handle<Object> object,
605 Handle<String> name, 605 Handle<String> name,
606 Handle<Object> value, 606 Handle<Object> value,
607 JSReceiver::StoreFromKeyed store_mode = 607 JSReceiver::StoreFromKeyed store_mode =
608 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); 608 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED);
(...skipping 26 matching lines...) Expand all
635 635
636 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, 636 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
637 StrictModeFlag strict_mode) { 637 StrictModeFlag strict_mode) {
638 if (strict_mode == kStrictMode) { 638 if (strict_mode == kStrictMode) {
639 return isolate->builtins()->StoreIC_PreMonomorphic_Strict(); 639 return isolate->builtins()->StoreIC_PreMonomorphic_Strict();
640 } else { 640 } else {
641 return isolate->builtins()->StoreIC_PreMonomorphic(); 641 return isolate->builtins()->StoreIC_PreMonomorphic();
642 } 642 }
643 } 643 }
644 644
645 virtual Handle<Code> global_proxy_stub() {
646 if (strict_mode() == kStrictMode) {
647 return isolate()->builtins()->StoreIC_GlobalProxy_Strict();
648 } else {
649 return isolate()->builtins()->StoreIC_GlobalProxy();
650 }
651 }
652
653 // Update the inline cache and the global stub cache based on the 645 // Update the inline cache and the global stub cache based on the
654 // lookup result. 646 // lookup result.
655 void UpdateCaches(LookupResult* lookup, 647 void UpdateCaches(LookupResult* lookup,
656 Handle<JSObject> receiver, 648 Handle<JSObject> receiver,
657 Handle<String> name, 649 Handle<String> name,
658 Handle<Object> value); 650 Handle<Object> value);
659 virtual Handle<Code> CompileHandler(LookupResult* lookup, 651 virtual Handle<Code> CompileHandler(LookupResult* lookup,
660 Handle<Object> object, 652 Handle<Object> object,
661 Handle<String> name, 653 Handle<String> name,
662 Handle<Object> value, 654 Handle<Object> value,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 Handle<Object> key, 803 Handle<Object> key,
812 Handle<Object> value); 804 Handle<Object> value);
813 805
814 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, 806 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver,
815 KeyedAccessStoreMode store_mode); 807 KeyedAccessStoreMode store_mode);
816 808
817 friend class IC; 809 friend class IC;
818 }; 810 };
819 811
820 812
813 // Mode to overwrite BinaryExpression values.
814 enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT };
815
821 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. 816 // Type Recording BinaryOpIC, that records the types of the inputs and outputs.
822 class BinaryOpIC: public IC { 817 class BinaryOpIC: public IC {
823 public: 818 public:
824 enum TypeInfo { 819 class State V8_FINAL BASE_EMBEDDED {
825 UNINITIALIZED, 820 public:
826 SMI, 821 explicit State(ExtraICState extra_ic_state);
827 INT32, 822
828 NUMBER, 823 State(Token::Value op, OverwriteMode mode)
829 ODDBALL, 824 : op_(op), mode_(mode), left_kind_(NONE), right_kind_(NONE),
830 STRING, // Only used for addition operation. 825 result_kind_(NONE) {
831 GENERIC 826 ASSERT_LE(FIRST_TOKEN, op);
827 ASSERT_LE(op, LAST_TOKEN);
828 }
829
830 InlineCacheState GetICState() const {
831 if (Max(left_kind_, right_kind_) == NONE) {
832 return ::v8::internal::UNINITIALIZED;
833 }
834 if (Max(left_kind_, right_kind_) == GENERIC) {
835 return ::v8::internal::MEGAMORPHIC;
836 }
837 if (Min(left_kind_, right_kind_) == GENERIC) {
838 return ::v8::internal::GENERIC;
839 }
840 return ::v8::internal::MONOMORPHIC;
841 }
842
843 ExtraICState GetExtraICState() const;
844
845 static void GenerateAheadOfTime(
846 Isolate*, void (*Generate)(Isolate*, const State&));
847
848 bool CanReuseDoubleBox() const {
849 return (result_kind_ > SMI && result_kind_ <= NUMBER) &&
850 ((mode_ == OVERWRITE_LEFT &&
851 left_kind_ > SMI && left_kind_ <= NUMBER) ||
852 (mode_ == OVERWRITE_RIGHT &&
853 right_kind_ > SMI && right_kind_ <= NUMBER));
854 }
855
856 bool HasSideEffects() const {
857 return Max(left_kind_, right_kind_) == GENERIC;
858 }
859
860 bool UseInlinedSmiCode() const {
861 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_);
862 }
863
864 static const int FIRST_TOKEN = Token::BIT_OR;
865 static const int LAST_TOKEN = Token::MOD;
866
867 Token::Value op() const { return op_; }
868 OverwriteMode mode() const { return mode_; }
869 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
870
871 Handle<Type> GetLeftType(Isolate* isolate) const {
872 return KindToType(left_kind_, isolate);
873 }
874 Handle<Type> GetRightType(Isolate* isolate) const {
875 return KindToType(right_kind_, isolate);
876 }
877 Handle<Type> GetResultType(Isolate* isolate) const;
878
879 void Print(StringStream* stream) const;
880
881 void Update(Handle<Object> left,
882 Handle<Object> right,
883 Handle<Object> result);
884
885 private:
886 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
887
888 Kind UpdateKind(Handle<Object> object, Kind kind) const;
889
890 static const char* KindToString(Kind kind);
891 static Handle<Type> KindToType(Kind kind, Isolate* isolate);
892 static bool KindMaybeSmi(Kind kind) {
893 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC;
894 }
895
896 // We truncate the last bit of the token.
897 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4));
898 class OpField: public BitField<int, 0, 4> {};
899 class OverwriteModeField: public BitField<OverwriteMode, 4, 2> {};
900 class SSE2Field: public BitField<bool, 6, 1> {};
901 class ResultKindField: public BitField<Kind, 7, 3> {};
902 class LeftKindField: public BitField<Kind, 10, 3> {};
903 // When fixed right arg is set, we don't need to store the right kind.
904 // Thus the two fields can overlap.
905 class HasFixedRightArgField: public BitField<bool, 13, 1> {};
906 class FixedRightArgValueField: public BitField<int, 14, 4> {};
907 class RightKindField: public BitField<Kind, 14, 3> {};
908
909 Token::Value op_;
910 OverwriteMode mode_;
911 Kind left_kind_;
912 Kind right_kind_;
913 Kind result_kind_;
914 Maybe<int> fixed_right_arg_;
832 }; 915 };
833 916
834 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } 917 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
835 918
836 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); 919 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op);
837 920
838 static const char* GetName(TypeInfo type_info);
839
840 MUST_USE_RESULT MaybeObject* Transition(Handle<Object> left, 921 MUST_USE_RESULT MaybeObject* Transition(Handle<Object> left,
841 Handle<Object> right); 922 Handle<Object> right);
842 }; 923 };
843 924
844 925
845 class CompareIC: public IC { 926 class CompareIC: public IC {
846 public: 927 public:
847 // The type/state lattice is defined by the following inequations: 928 // The type/state lattice is defined by the following inequations:
848 // UNINITIALIZED < ... 929 // UNINITIALIZED < ...
849 // ... < GENERIC 930 // ... < GENERIC
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure); 1028 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure);
948 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 1029 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
949 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 1030 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
950 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 1031 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
951 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 1032 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
952 1033
953 1034
954 } } // namespace v8::internal 1035 } } // namespace v8::internal
955 1036
956 #endif // V8_IC_H_ 1037 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698