| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 856 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
| 856 | 857 |
| 857 Type* GetLeftType(Zone* zone) const { | 858 Type* GetLeftType(Zone* zone) const { |
| 858 return KindToType(left_kind_, zone); | 859 return KindToType(left_kind_, zone); |
| 859 } | 860 } |
| 860 Type* GetRightType(Zone* zone) const { | 861 Type* GetRightType(Zone* zone) const { |
| 861 return KindToType(right_kind_, zone); | 862 return KindToType(right_kind_, zone); |
| 862 } | 863 } |
| 863 Type* GetResultType(Zone* zone) const; | 864 Type* GetResultType(Zone* zone) const; |
| 864 | 865 |
| 865 void Print(StringStream* stream) const; | |
| 866 | |
| 867 void Update(Handle<Object> left, | 866 void Update(Handle<Object> left, |
| 868 Handle<Object> right, | 867 Handle<Object> right, |
| 869 Handle<Object> result); | 868 Handle<Object> result); |
| 870 | 869 |
| 871 Isolate* isolate() const { return isolate_; } | 870 Isolate* isolate() const { return isolate_; } |
| 872 | 871 |
| 873 private: | 872 private: |
| 873 friend OStream& operator<<(OStream& os, const BinaryOpIC::State& s); |
| 874 |
| 874 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; | 875 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; |
| 875 | 876 |
| 876 Kind UpdateKind(Handle<Object> object, Kind kind) const; | 877 Kind UpdateKind(Handle<Object> object, Kind kind) const; |
| 877 | 878 |
| 878 static const char* KindToString(Kind kind); | 879 static const char* KindToString(Kind kind); |
| 879 static Type* KindToType(Kind kind, Zone* zone); | 880 static Type* KindToType(Kind kind, Zone* zone); |
| 880 static bool KindMaybeSmi(Kind kind) { | 881 static bool KindMaybeSmi(Kind kind) { |
| 881 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; | 882 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; |
| 882 } | 883 } |
| 883 | 884 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 905 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } | 906 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
| 906 | 907 |
| 907 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); | 908 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); |
| 908 | 909 |
| 909 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, | 910 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, |
| 910 Handle<Object> left, | 911 Handle<Object> left, |
| 911 Handle<Object> right) V8_WARN_UNUSED_RESULT; | 912 Handle<Object> right) V8_WARN_UNUSED_RESULT; |
| 912 }; | 913 }; |
| 913 | 914 |
| 914 | 915 |
| 916 OStream& operator<<(OStream& os, const BinaryOpIC::State& s); |
| 917 |
| 918 |
| 915 class CompareIC: public IC { | 919 class CompareIC: public IC { |
| 916 public: | 920 public: |
| 917 // The type/state lattice is defined by the following inequations: | 921 // The type/state lattice is defined by the following inequations: |
| 918 // UNINITIALIZED < ... | 922 // UNINITIALIZED < ... |
| 919 // ... < GENERIC | 923 // ... < GENERIC |
| 920 // SMI < NUMBER | 924 // SMI < NUMBER |
| 921 // INTERNALIZED_STRING < STRING | 925 // INTERNALIZED_STRING < STRING |
| 922 // KNOWN_OBJECT < OBJECT | 926 // KNOWN_OBJECT < OBJECT |
| 923 enum State { | 927 enum State { |
| 924 UNINITIALIZED, | 928 UNINITIALIZED, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); | 1026 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); |
| 1023 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); | 1027 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); |
| 1024 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); | 1028 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); |
| 1025 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); | 1029 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); |
| 1026 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); | 1030 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); |
| 1027 | 1031 |
| 1028 | 1032 |
| 1029 } } // namespace v8::internal | 1033 } } // namespace v8::internal |
| 1030 | 1034 |
| 1031 #endif // V8_IC_H_ | 1035 #endif // V8_IC_H_ |
| OLD | NEW |