| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 ICU(KeyedStoreIC_MissForceGeneric) \ | 49 ICU(KeyedStoreIC_MissForceGeneric) \ |
| 50 ICU(KeyedStoreIC_Slow) \ | 50 ICU(KeyedStoreIC_Slow) \ |
| 51 /* Utilities for IC stubs. */ \ | 51 /* Utilities for IC stubs. */ \ |
| 52 ICU(LoadCallbackProperty) \ | 52 ICU(LoadCallbackProperty) \ |
| 53 ICU(StoreCallbackProperty) \ | 53 ICU(StoreCallbackProperty) \ |
| 54 ICU(LoadPropertyWithInterceptorOnly) \ | 54 ICU(LoadPropertyWithInterceptorOnly) \ |
| 55 ICU(LoadPropertyWithInterceptorForLoad) \ | 55 ICU(LoadPropertyWithInterceptorForLoad) \ |
| 56 ICU(LoadPropertyWithInterceptorForCall) \ | 56 ICU(LoadPropertyWithInterceptorForCall) \ |
| 57 ICU(KeyedLoadPropertyWithInterceptor) \ | 57 ICU(KeyedLoadPropertyWithInterceptor) \ |
| 58 ICU(StoreInterceptorProperty) \ | 58 ICU(StoreInterceptorProperty) \ |
| 59 ICU(TypeRecordingUnaryOp_Patch) \ | 59 ICU(UnaryOp_Patch) \ |
| 60 ICU(TypeRecordingBinaryOp_Patch) \ | 60 ICU(BinaryOp_Patch) \ |
| 61 ICU(CompareIC_Miss) | 61 ICU(CompareIC_Miss) |
| 62 // | 62 // |
| 63 // IC is the base class for LoadIC, StoreIC, CallIC, KeyedLoadIC, | 63 // IC is the base class for LoadIC, StoreIC, CallIC, KeyedLoadIC, |
| 64 // and KeyedStoreIC. | 64 // and KeyedStoreIC. |
| 65 // | 65 // |
| 66 class IC { | 66 class IC { |
| 67 public: | 67 public: |
| 68 | 68 |
| 69 // The ids for utility called from the generated code. | 69 // The ids for utility called from the generated code. |
| 70 enum UtilityId { | 70 enum UtilityId { |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 return isolate()->builtins()->builtin( | 614 return isolate()->builtins()->builtin( |
| 615 Builtins::kKeyedStoreIC_Generic_Strict); | 615 Builtins::kKeyedStoreIC_Generic_Strict); |
| 616 } | 616 } |
| 617 | 617 |
| 618 static void Clear(Address address, Code* target); | 618 static void Clear(Address address, Code* target); |
| 619 | 619 |
| 620 friend class IC; | 620 friend class IC; |
| 621 }; | 621 }; |
| 622 | 622 |
| 623 | 623 |
| 624 class TRUnaryOpIC: public IC { | 624 class UnaryOpIC: public IC { |
| 625 public: | 625 public: |
| 626 | 626 |
| 627 // sorted: increasingly more unspecific (ignoring UNINITIALIZED) | 627 // sorted: increasingly more unspecific (ignoring UNINITIALIZED) |
| 628 // TODO(svenpanne) Using enums+switch is an antipattern, use a class instead. | 628 // TODO(svenpanne) Using enums+switch is an antipattern, use a class instead. |
| 629 enum TypeInfo { | 629 enum TypeInfo { |
| 630 UNINITIALIZED, | 630 UNINITIALIZED, |
| 631 SMI, | 631 SMI, |
| 632 HEAP_NUMBER, | 632 HEAP_NUMBER, |
| 633 GENERIC | 633 GENERIC |
| 634 }; | 634 }; |
| 635 | 635 |
| 636 explicit TRUnaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { } | 636 explicit UnaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { } |
| 637 | 637 |
| 638 void patch(Code* code); | 638 void patch(Code* code); |
| 639 | 639 |
| 640 static const char* GetName(TypeInfo type_info); | 640 static const char* GetName(TypeInfo type_info); |
| 641 | 641 |
| 642 static State ToState(TypeInfo type_info); | 642 static State ToState(TypeInfo type_info); |
| 643 | 643 |
| 644 static TypeInfo GetTypeInfo(Handle<Object> operand); | 644 static TypeInfo GetTypeInfo(Handle<Object> operand); |
| 645 | 645 |
| 646 static TypeInfo ComputeNewType(TypeInfo type, TypeInfo previous); | 646 static TypeInfo ComputeNewType(TypeInfo type, TypeInfo previous); |
| 647 }; | 647 }; |
| 648 | 648 |
| 649 | 649 |
| 650 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. | 650 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. |
| 651 class TRBinaryOpIC: public IC { | 651 class BinaryOpIC: public IC { |
| 652 public: | 652 public: |
| 653 | 653 |
| 654 enum TypeInfo { | 654 enum TypeInfo { |
| 655 UNINITIALIZED, | 655 UNINITIALIZED, |
| 656 SMI, | 656 SMI, |
| 657 INT32, | 657 INT32, |
| 658 HEAP_NUMBER, | 658 HEAP_NUMBER, |
| 659 ODDBALL, | 659 ODDBALL, |
| 660 BOTH_STRING, // Only used for addition operation. | 660 BOTH_STRING, // Only used for addition operation. |
| 661 STRING, // Only used for addition operation. At least one string operand. | 661 STRING, // Only used for addition operation. At least one string operand. |
| 662 GENERIC | 662 GENERIC |
| 663 }; | 663 }; |
| 664 | 664 |
| 665 explicit TRBinaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { } | 665 explicit BinaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { } |
| 666 | 666 |
| 667 void patch(Code* code); | 667 void patch(Code* code); |
| 668 | 668 |
| 669 static const char* GetName(TypeInfo type_info); | 669 static const char* GetName(TypeInfo type_info); |
| 670 | 670 |
| 671 static State ToState(TypeInfo type_info); | 671 static State ToState(TypeInfo type_info); |
| 672 | 672 |
| 673 static TypeInfo GetTypeInfo(Handle<Object> left, Handle<Object> right); | 673 static TypeInfo GetTypeInfo(Handle<Object> left, Handle<Object> right); |
| 674 | 674 |
| 675 static TypeInfo JoinTypes(TypeInfo x, TypeInfo y); | 675 static TypeInfo JoinTypes(TypeInfo x, TypeInfo y); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 State TargetState(State state, bool has_inlined_smi_code, | 709 State TargetState(State state, bool has_inlined_smi_code, |
| 710 Handle<Object> x, Handle<Object> y); | 710 Handle<Object> x, Handle<Object> y); |
| 711 | 711 |
| 712 bool strict() const { return op_ == Token::EQ_STRICT; } | 712 bool strict() const { return op_ == Token::EQ_STRICT; } |
| 713 Condition GetCondition() const { return ComputeCondition(op_); } | 713 Condition GetCondition() const { return ComputeCondition(op_); } |
| 714 State GetState() { return ComputeState(target()); } | 714 State GetState() { return ComputeState(target()); } |
| 715 | 715 |
| 716 Token::Value op_; | 716 Token::Value op_; |
| 717 }; | 717 }; |
| 718 | 718 |
| 719 // Helper for TRBinaryOpIC and CompareIC. | 719 // Helper for BinaryOpIC and CompareIC. |
| 720 void PatchInlinedSmiCode(Address address); | 720 void PatchInlinedSmiCode(Address address); |
| 721 | 721 |
| 722 } } // namespace v8::internal | 722 } } // namespace v8::internal |
| 723 | 723 |
| 724 #endif // V8_IC_H_ | 724 #endif // V8_IC_H_ |
| OLD | NEW |