OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2085 set_target(code); | 2085 set_target(code); |
2086 } | 2086 } |
2087 | 2087 |
2088 | 2088 |
2089 const char* TRBinaryOpIC::GetName(TypeInfo type_info) { | 2089 const char* TRBinaryOpIC::GetName(TypeInfo type_info) { |
2090 switch (type_info) { | 2090 switch (type_info) { |
2091 case UNINITIALIZED: return "Uninitialized"; | 2091 case UNINITIALIZED: return "Uninitialized"; |
2092 case SMI: return "SMI"; | 2092 case SMI: return "SMI"; |
2093 case INT32: return "Int32s"; | 2093 case INT32: return "Int32s"; |
2094 case HEAP_NUMBER: return "HeapNumbers"; | 2094 case HEAP_NUMBER: return "HeapNumbers"; |
| 2095 case ODDBALL: return "Oddball"; |
2095 case STRING: return "Strings"; | 2096 case STRING: return "Strings"; |
2096 case GENERIC: return "Generic"; | 2097 case GENERIC: return "Generic"; |
2097 default: return "Invalid"; | 2098 default: return "Invalid"; |
2098 } | 2099 } |
2099 } | 2100 } |
2100 | 2101 |
2101 | 2102 |
2102 TRBinaryOpIC::State TRBinaryOpIC::ToState(TypeInfo type_info) { | 2103 TRBinaryOpIC::State TRBinaryOpIC::ToState(TypeInfo type_info) { |
2103 switch (type_info) { | 2104 switch (type_info) { |
2104 case UNINITIALIZED: | 2105 case UNINITIALIZED: |
2105 return ::v8::internal::UNINITIALIZED; | 2106 return ::v8::internal::UNINITIALIZED; |
2106 case SMI: | 2107 case SMI: |
2107 case INT32: | 2108 case INT32: |
2108 case HEAP_NUMBER: | 2109 case HEAP_NUMBER: |
| 2110 case ODDBALL: |
2109 case STRING: | 2111 case STRING: |
2110 return MONOMORPHIC; | 2112 return MONOMORPHIC; |
2111 case GENERIC: | 2113 case GENERIC: |
2112 return MEGAMORPHIC; | 2114 return MEGAMORPHIC; |
2113 } | 2115 } |
2114 UNREACHABLE(); | 2116 UNREACHABLE(); |
2115 return ::v8::internal::UNINITIALIZED; | 2117 return ::v8::internal::UNINITIALIZED; |
2116 } | 2118 } |
2117 | 2119 |
2118 | 2120 |
(...skipping 27 matching lines...) Expand all Loading... |
2146 if (left_type.IsNumber() && right_type.IsNumber()) { | 2148 if (left_type.IsNumber() && right_type.IsNumber()) { |
2147 return HEAP_NUMBER; | 2149 return HEAP_NUMBER; |
2148 } | 2150 } |
2149 | 2151 |
2150 if (left_type.IsString() || right_type.IsString()) { | 2152 if (left_type.IsString() || right_type.IsString()) { |
2151 // Patching for fast string ADD makes sense even if only one of the | 2153 // Patching for fast string ADD makes sense even if only one of the |
2152 // arguments is a string. | 2154 // arguments is a string. |
2153 return STRING; | 2155 return STRING; |
2154 } | 2156 } |
2155 | 2157 |
| 2158 // Check for oddball objects. |
| 2159 if (left->IsUndefined() && right->IsNumber()) return ODDBALL; |
| 2160 if (left->IsNumber() && right->IsUndefined()) return ODDBALL; |
| 2161 |
2156 return GENERIC; | 2162 return GENERIC; |
2157 } | 2163 } |
2158 | 2164 |
2159 | 2165 |
2160 // defined in code-stubs-<arch>.cc | 2166 // defined in code-stubs-<arch>.cc |
2161 // Only needed to remove dependency of ic.cc on code-stubs-<arch>.h. | 2167 // Only needed to remove dependency of ic.cc on code-stubs-<arch>.h. |
2162 Handle<Code> GetTypeRecordingBinaryOpStub(int key, | 2168 Handle<Code> GetTypeRecordingBinaryOpStub(int key, |
2163 TRBinaryOpIC::TypeInfo type_info, | 2169 TRBinaryOpIC::TypeInfo type_info, |
2164 TRBinaryOpIC::TypeInfo result_type); | 2170 TRBinaryOpIC::TypeInfo result_type); |
2165 | 2171 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2334 #undef ADDR | 2340 #undef ADDR |
2335 }; | 2341 }; |
2336 | 2342 |
2337 | 2343 |
2338 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2344 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2339 return IC_utilities[id]; | 2345 return IC_utilities[id]; |
2340 } | 2346 } |
2341 | 2347 |
2342 | 2348 |
2343 } } // namespace v8::internal | 2349 } } // namespace v8::internal |
OLD | NEW |