| OLD | NEW | 
|---|
| 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 29 matching lines...) Expand all  Loading... | 
| 40 #define CODE_STUB_LIST_ALL_PLATFORMS(V)  \ | 40 #define CODE_STUB_LIST_ALL_PLATFORMS(V)  \ | 
| 41   V(CallFunction)                        \ | 41   V(CallFunction)                        \ | 
| 42   V(CallConstruct)                       \ | 42   V(CallConstruct)                       \ | 
| 43   V(UnaryOp)                             \ | 43   V(UnaryOp)                             \ | 
| 44   V(BinaryOp)                            \ | 44   V(BinaryOp)                            \ | 
| 45   V(StringAdd)                           \ | 45   V(StringAdd)                           \ | 
| 46   V(SubString)                           \ | 46   V(SubString)                           \ | 
| 47   V(StringCompare)                       \ | 47   V(StringCompare)                       \ | 
| 48   V(Compare)                             \ | 48   V(Compare)                             \ | 
| 49   V(CompareIC)                           \ | 49   V(CompareIC)                           \ | 
|  | 50   V(CompareNilIC)                        \ | 
| 50   V(MathPow)                             \ | 51   V(MathPow)                             \ | 
| 51   V(StringLength)                        \ | 52   V(StringLength)                        \ | 
| 52   V(FunctionPrototype)                   \ | 53   V(FunctionPrototype)                   \ | 
| 53   V(StoreArrayLength)                    \ | 54   V(StoreArrayLength)                    \ | 
| 54   V(RecordWrite)                         \ | 55   V(RecordWrite)                         \ | 
| 55   V(StoreBufferOverflow)                 \ | 56   V(StoreBufferOverflow)                 \ | 
| 56   V(RegExpExec)                          \ | 57   V(RegExpExec)                          \ | 
| 57   V(TranscendentalCache)                 \ | 58   V(TranscendentalCache)                 \ | 
| 58   V(Instanceof)                          \ | 59   V(Instanceof)                          \ | 
| 59   V(ConvertToDouble)                     \ | 60   V(ConvertToDouble)                     \ | 
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 939   virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECT; } | 940   virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECT; } | 
| 940 | 941 | 
| 941   Token::Value op_; | 942   Token::Value op_; | 
| 942   CompareIC::State left_; | 943   CompareIC::State left_; | 
| 943   CompareIC::State right_; | 944   CompareIC::State right_; | 
| 944   CompareIC::State state_; | 945   CompareIC::State state_; | 
| 945   Handle<Map> known_map_; | 946   Handle<Map> known_map_; | 
| 946 }; | 947 }; | 
| 947 | 948 | 
| 948 | 949 | 
|  | 950 class CompareNilICStub : public HydrogenCodeStub  { | 
|  | 951  public: | 
|  | 952   enum Types { | 
|  | 953     kCompareAgainstNull = 1 << 0, | 
|  | 954     kCompareAgainstUndefined = 1 << 1, | 
|  | 955     kCompareAgainstMonomorphicMap = 1 << 2, | 
|  | 956     kCompareAgainstUndetectable = 1 << 3, | 
|  | 957     kFullCompare = kCompareAgainstNull | kCompareAgainstUndefined | | 
|  | 958         kCompareAgainstUndetectable | 
|  | 959   }; | 
|  | 960 | 
|  | 961   CompareNilICStub(EqualityKind kind, NilValue nil, Types types) | 
|  | 962       : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS), bit_field_(0) { | 
|  | 963     bit_field_ = EqualityKindField::encode(kind) | | 
|  | 964         NilValueField::encode(nil) | | 
|  | 965         TypesField::encode(types); | 
|  | 966   } | 
|  | 967 | 
|  | 968   virtual InlineCacheState GetICState() { | 
|  | 969     Types types = GetTypes(); | 
|  | 970     if (types == kFullCompare) { | 
|  | 971       return MEGAMORPHIC; | 
|  | 972     } else if ((types & kCompareAgainstMonomorphicMap) != 0) { | 
|  | 973       return MONOMORPHIC; | 
|  | 974     } else { | 
|  | 975       return PREMONOMORPHIC; | 
|  | 976     } | 
|  | 977   } | 
|  | 978 | 
|  | 979   virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } | 
|  | 980 | 
|  | 981   Handle<Code> GenerateCode(); | 
|  | 982 | 
|  | 983   static Handle<Code> GetUninitialized(Isolate* isolate, | 
|  | 984                                        EqualityKind kind, | 
|  | 985                                        NilValue nil) { | 
|  | 986     return CompareNilICStub(kind, nil).GetCode(isolate); | 
|  | 987   } | 
|  | 988 | 
|  | 989   virtual void InitializeInterfaceDescriptor( | 
|  | 990       Isolate* isolate, | 
|  | 991       CodeStubInterfaceDescriptor* descriptor); | 
|  | 992 | 
|  | 993   static void InitializeForIsolate(Isolate* isolate) { | 
|  | 994     CompareNilICStub compare_stub(kStrictEquality, kNullValue); | 
|  | 995     compare_stub.InitializeInterfaceDescriptor( | 
|  | 996         isolate, | 
|  | 997         isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); | 
|  | 998   } | 
|  | 999 | 
|  | 1000   virtual Code::ExtraICState GetExtraICState() { | 
|  | 1001     return bit_field_; | 
|  | 1002   } | 
|  | 1003 | 
|  | 1004   EqualityKind GetKind() { return EqualityKindField::decode(bit_field_); } | 
|  | 1005   NilValue GetNilValue() { return NilValueField::decode(bit_field_); } | 
|  | 1006   Types GetTypes() { return TypesField::decode(bit_field_); } | 
|  | 1007 | 
|  | 1008   static Types TypesFromExtraICState( | 
|  | 1009       Code::ExtraICState state) { | 
|  | 1010     return TypesField::decode(state); | 
|  | 1011   } | 
|  | 1012   static EqualityKind EqualityKindFromExtraICState( | 
|  | 1013       Code::ExtraICState state) { | 
|  | 1014     return EqualityKindField::decode(state); | 
|  | 1015   } | 
|  | 1016   static NilValue NilValueFromExtraICState(Code::ExtraICState state) { | 
|  | 1017     return NilValueField::decode(state); | 
|  | 1018   } | 
|  | 1019 | 
|  | 1020   static Types GetPatchedICFlags(Code::ExtraICState extra_ic_state, | 
|  | 1021                                  Handle<Object> object, | 
|  | 1022                                  bool* already_monomorphic); | 
|  | 1023 | 
|  | 1024  private: | 
|  | 1025   friend class CompareNilIC; | 
|  | 1026 | 
|  | 1027   class EqualityKindField : public BitField<EqualityKind, 0, 1> {}; | 
|  | 1028   class NilValueField : public BitField<NilValue, 1, 1> {}; | 
|  | 1029   class TypesField : public BitField<Types, 3, 4> {}; | 
|  | 1030 | 
|  | 1031   CompareNilICStub(EqualityKind kind, NilValue nil) | 
|  | 1032       : HydrogenCodeStub(CODE_STUB_IS_MISS), bit_field_(0) { | 
|  | 1033     bit_field_ = EqualityKindField::encode(kind) | | 
|  | 1034         NilValueField::encode(nil); | 
|  | 1035   } | 
|  | 1036 | 
|  | 1037   virtual CodeStub::Major MajorKey() { return CompareNilIC; } | 
|  | 1038   virtual int NotMissMinorKey() { return bit_field_; } | 
|  | 1039 | 
|  | 1040   int bit_field_; | 
|  | 1041 | 
|  | 1042   DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); | 
|  | 1043 }; | 
|  | 1044 | 
|  | 1045 | 
| 949 class CEntryStub : public PlatformCodeStub { | 1046 class CEntryStub : public PlatformCodeStub { | 
| 950  public: | 1047  public: | 
| 951   explicit CEntryStub(int result_size, | 1048   explicit CEntryStub(int result_size, | 
| 952                       SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 1049                       SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 
| 953       : result_size_(result_size), save_doubles_(save_doubles) { } | 1050       : result_size_(result_size), save_doubles_(save_doubles) { } | 
| 954 | 1051 | 
| 955   void Generate(MacroAssembler* masm); | 1052   void Generate(MacroAssembler* masm); | 
| 956 | 1053 | 
| 957   // The version of this stub that doesn't save doubles is generated ahead of | 1054   // The version of this stub that doesn't save doubles is generated ahead of | 
| 958   // time, so it's OK to call it from other stubs that can't cope with GC during | 1055   // time, so it's OK to call it from other stubs that can't cope with GC during | 
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1727 | 1824 | 
| 1728   // The current function entry hook. | 1825   // The current function entry hook. | 
| 1729   static FunctionEntryHook entry_hook_; | 1826   static FunctionEntryHook entry_hook_; | 
| 1730 | 1827 | 
| 1731   DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1828   DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 
| 1732 }; | 1829 }; | 
| 1733 | 1830 | 
| 1734 } }  // namespace v8::internal | 1831 } }  // namespace v8::internal | 
| 1735 | 1832 | 
| 1736 #endif  // V8_CODE_STUBS_H_ | 1833 #endif  // V8_CODE_STUBS_H_ | 
| OLD | NEW | 
|---|