OLD | NEW |
---|---|
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 // An ExternalReference represents a C++ address used in the generated | 807 // An ExternalReference represents a C++ address used in the generated |
808 // code. All references to C++ functions and variables must be encapsulated in | 808 // code. All references to C++ functions and variables must be encapsulated in |
809 // an ExternalReference instance. This is done in order to track the origin of | 809 // an ExternalReference instance. This is done in order to track the origin of |
810 // all external references in the code so that they can be bound to the correct | 810 // all external references in the code so that they can be bound to the correct |
811 // addresses when deserializing a heap. | 811 // addresses when deserializing a heap. |
812 class ExternalReference BASE_EMBEDDED { | 812 class ExternalReference BASE_EMBEDDED { |
813 public: | 813 public: |
814 // Used in the simulator to support different native api calls. | 814 // Used in the simulator to support different native api calls. |
815 enum Type { | 815 enum Type { |
816 // Builtin call. | 816 // Builtin call. |
817 // Object* f(v8::internal::Arguments) or | 817 // Object* f(v8::internal::Arguments). |
818 BUILTIN_CALL, // default | |
819 | |
820 // Builtin call returning object pair. | |
818 // ObjectPair f(v8::internal::Arguments). | 821 // ObjectPair f(v8::internal::Arguments). |
819 BUILTIN_CALL, // default | 822 BUILTIN_CALL_PAIR, |
820 | 823 |
821 // Builtin call that returns . | 824 // Builtin call that returns . |
822 // ObjectTriple f(v8::internal::Arguments). | 825 // ObjectTriple f(v8::internal::Arguments). |
823 BUILTIN_CALL_TRIPLE, | 826 BUILTIN_CALL_TRIPLE, |
824 | 827 |
825 // Builtin that takes float arguments and returns an int. | 828 // Builtin that takes float arguments and returns an int. |
826 // int f(double, double). | 829 // int f(double, double). |
827 BUILTIN_COMPARE_CALL, | 830 BUILTIN_COMPARE_CALL, |
828 | 831 |
829 // Builtin call that returns floating point. | 832 // Builtin call that returns floating point. |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1034 Type type = ExternalReference::BUILTIN_CALL) { | 1037 Type type = ExternalReference::BUILTIN_CALL) { |
1035 ExternalReferenceRedirector* redirector = | 1038 ExternalReferenceRedirector* redirector = |
1036 reinterpret_cast<ExternalReferenceRedirector*>( | 1039 reinterpret_cast<ExternalReferenceRedirector*>( |
1037 isolate->external_reference_redirector()); | 1040 isolate->external_reference_redirector()); |
1038 void* address = reinterpret_cast<void*>(address_arg); | 1041 void* address = reinterpret_cast<void*>(address_arg); |
1039 void* answer = | 1042 void* answer = |
1040 (redirector == NULL) ? address : (*redirector)(isolate, address, type); | 1043 (redirector == NULL) ? address : (*redirector)(isolate, address, type); |
1041 return answer; | 1044 return answer; |
1042 } | 1045 } |
1043 | 1046 |
1047 static Type builtin_call_type(int size) { | |
rmcilroy
2016/01/22 11:13:52
/s/size/result_size
rmcilroy
2016/01/22 11:13:52
Just call this BuiltinCallTypeForResultSize and ma
MTBrandyberry
2016/01/22 14:53:53
Done.
MTBrandyberry
2016/01/22 14:53:53
Done.
| |
1048 Type type; | |
1049 switch (size) { | |
1050 case 1: | |
1051 type = BUILTIN_CALL; | |
1052 break; | |
rmcilroy
2016/01/22 11:13:52
nit - just "return BUILTIN_CALL" directly, no need
MTBrandyberry
2016/01/22 14:53:53
Done.
| |
1053 case 2: | |
1054 type = BUILTIN_CALL_PAIR; | |
1055 break; | |
1056 case 3: | |
1057 type = BUILTIN_CALL_TRIPLE; | |
1058 break; | |
1059 default: | |
1060 UNREACHABLE(); | |
1061 } | |
1062 return type; | |
1063 } | |
1064 | |
1044 void* address_; | 1065 void* address_; |
1045 }; | 1066 }; |
1046 | 1067 |
1047 bool operator==(ExternalReference, ExternalReference); | 1068 bool operator==(ExternalReference, ExternalReference); |
1048 bool operator!=(ExternalReference, ExternalReference); | 1069 bool operator!=(ExternalReference, ExternalReference); |
1049 | 1070 |
1050 size_t hash_value(ExternalReference); | 1071 size_t hash_value(ExternalReference); |
1051 | 1072 |
1052 std::ostream& operator<<(std::ostream&, ExternalReference); | 1073 std::ostream& operator<<(std::ostream&, ExternalReference); |
1053 | 1074 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1279 std::vector<ConstantPoolEntry> shared_entries; | 1300 std::vector<ConstantPoolEntry> shared_entries; |
1280 }; | 1301 }; |
1281 | 1302 |
1282 Label emitted_label_; // Records pc_offset of emitted pool | 1303 Label emitted_label_; // Records pc_offset of emitted pool |
1283 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 1304 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; |
1284 }; | 1305 }; |
1285 | 1306 |
1286 } // namespace internal | 1307 } // namespace internal |
1287 } // namespace v8 | 1308 } // namespace v8 |
1288 #endif // V8_ASSEMBLER_H_ | 1309 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |