| OLD | NEW |
| 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_IC_H_ | 5 #ifndef V8_IC_H_ |
| 6 #define V8_IC_H_ | 6 #define V8_IC_H_ |
| 7 | 7 |
| 8 #include "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 ExtraICState GetExtraICState() const; | 347 ExtraICState GetExtraICState() const; |
| 348 | 348 |
| 349 static void GenerateAheadOfTime( | 349 static void GenerateAheadOfTime( |
| 350 Isolate*, void (*Generate)(Isolate*, const State&)); | 350 Isolate*, void (*Generate)(Isolate*, const State&)); |
| 351 | 351 |
| 352 int arg_count() const { return argc_; } | 352 int arg_count() const { return argc_; } |
| 353 CallType call_type() const { return call_type_; } | 353 CallType call_type() const { return call_type_; } |
| 354 | 354 |
| 355 bool CallAsMethod() const { return call_type_ == METHOD; } | 355 bool CallAsMethod() const { return call_type_ == METHOD; } |
| 356 | 356 |
| 357 void Print(StringStream* stream) const; | |
| 358 | |
| 359 private: | 357 private: |
| 360 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {}; | 358 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {}; |
| 361 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {}; | 359 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {}; |
| 362 | 360 |
| 363 const int argc_; | 361 const int argc_; |
| 364 const CallType call_type_; | 362 const CallType call_type_; |
| 365 }; | 363 }; |
| 366 | 364 |
| 367 explicit CallIC(Isolate* isolate) | 365 explicit CallIC(Isolate* isolate) |
| 368 : IC(EXTRA_CALL_FRAME, isolate) { | 366 : IC(EXTRA_CALL_FRAME, isolate) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 385 // Code generator routines. | 383 // Code generator routines. |
| 386 static Handle<Code> initialize_stub(Isolate* isolate, | 384 static Handle<Code> initialize_stub(Isolate* isolate, |
| 387 int argc, | 385 int argc, |
| 388 CallType call_type); | 386 CallType call_type); |
| 389 | 387 |
| 390 static void Clear(Isolate* isolate, Address address, Code* target, | 388 static void Clear(Isolate* isolate, Address address, Code* target, |
| 391 ConstantPoolArray* constant_pool); | 389 ConstantPoolArray* constant_pool); |
| 392 }; | 390 }; |
| 393 | 391 |
| 394 | 392 |
| 393 OStream& operator<<(OStream& os, const CallIC::State& s); |
| 394 |
| 395 |
| 395 class LoadIC: public IC { | 396 class LoadIC: public IC { |
| 396 public: | 397 public: |
| 397 // ExtraICState bits | 398 // ExtraICState bits |
| 398 class ContextualModeBits: public BitField<ContextualMode, 0, 1> {}; | 399 class ContextualModeBits: public BitField<ContextualMode, 0, 1> {}; |
| 399 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); | 400 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); |
| 400 | 401 |
| 401 enum RegisterInfo { | 402 enum RegisterInfo { |
| 402 kReceiverIndex, | 403 kReceiverIndex, |
| 403 kNameIndex, | 404 kNameIndex, |
| 404 kRegisterArgumentCount | 405 kRegisterArgumentCount |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 859 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
| 859 | 860 |
| 860 Type* GetLeftType(Zone* zone) const { | 861 Type* GetLeftType(Zone* zone) const { |
| 861 return KindToType(left_kind_, zone); | 862 return KindToType(left_kind_, zone); |
| 862 } | 863 } |
| 863 Type* GetRightType(Zone* zone) const { | 864 Type* GetRightType(Zone* zone) const { |
| 864 return KindToType(right_kind_, zone); | 865 return KindToType(right_kind_, zone); |
| 865 } | 866 } |
| 866 Type* GetResultType(Zone* zone) const; | 867 Type* GetResultType(Zone* zone) const; |
| 867 | 868 |
| 868 void Print(StringStream* stream) const; | |
| 869 | |
| 870 void Update(Handle<Object> left, | 869 void Update(Handle<Object> left, |
| 871 Handle<Object> right, | 870 Handle<Object> right, |
| 872 Handle<Object> result); | 871 Handle<Object> result); |
| 873 | 872 |
| 874 Isolate* isolate() const { return isolate_; } | 873 Isolate* isolate() const { return isolate_; } |
| 875 | 874 |
| 876 private: | 875 private: |
| 876 friend OStream& operator<<(OStream& os, const BinaryOpIC::State& s); |
| 877 |
| 877 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; | 878 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; |
| 878 | 879 |
| 879 Kind UpdateKind(Handle<Object> object, Kind kind) const; | 880 Kind UpdateKind(Handle<Object> object, Kind kind) const; |
| 880 | 881 |
| 881 static const char* KindToString(Kind kind); | 882 static const char* KindToString(Kind kind); |
| 882 static Type* KindToType(Kind kind, Zone* zone); | 883 static Type* KindToType(Kind kind, Zone* zone); |
| 883 static bool KindMaybeSmi(Kind kind) { | 884 static bool KindMaybeSmi(Kind kind) { |
| 884 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; | 885 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; |
| 885 } | 886 } |
| 886 | 887 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 908 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } | 909 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
| 909 | 910 |
| 910 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); | 911 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); |
| 911 | 912 |
| 912 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, | 913 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, |
| 913 Handle<Object> left, | 914 Handle<Object> left, |
| 914 Handle<Object> right) V8_WARN_UNUSED_RESULT; | 915 Handle<Object> right) V8_WARN_UNUSED_RESULT; |
| 915 }; | 916 }; |
| 916 | 917 |
| 917 | 918 |
| 919 OStream& operator<<(OStream& os, const BinaryOpIC::State& s); |
| 920 |
| 921 |
| 918 class CompareIC: public IC { | 922 class CompareIC: public IC { |
| 919 public: | 923 public: |
| 920 // The type/state lattice is defined by the following inequations: | 924 // The type/state lattice is defined by the following inequations: |
| 921 // UNINITIALIZED < ... | 925 // UNINITIALIZED < ... |
| 922 // ... < GENERIC | 926 // ... < GENERIC |
| 923 // SMI < NUMBER | 927 // SMI < NUMBER |
| 924 // INTERNALIZED_STRING < STRING | 928 // INTERNALIZED_STRING < STRING |
| 925 // KNOWN_OBJECT < OBJECT | 929 // KNOWN_OBJECT < OBJECT |
| 926 enum State { | 930 enum State { |
| 927 UNINITIALIZED, | 931 UNINITIALIZED, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); | 1029 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); |
| 1026 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); | 1030 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); |
| 1027 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); | 1031 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); |
| 1028 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); | 1032 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); |
| 1029 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); | 1033 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); |
| 1030 | 1034 |
| 1031 | 1035 |
| 1032 } } // namespace v8::internal | 1036 } } // namespace v8::internal |
| 1033 | 1037 |
| 1034 #endif // V8_IC_H_ | 1038 #endif // V8_IC_H_ |
| OLD | NEW |