| 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 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 return static_cast<State>(target->compare_state()); | 2134 return static_cast<State>(target->compare_state()); |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 | 2137 |
| 2138 const char* CompareIC::GetStateName(State state) { | 2138 const char* CompareIC::GetStateName(State state) { |
| 2139 switch (state) { | 2139 switch (state) { |
| 2140 case UNINITIALIZED: return "UNINITIALIZED"; | 2140 case UNINITIALIZED: return "UNINITIALIZED"; |
| 2141 case SMIS: return "SMIS"; | 2141 case SMIS: return "SMIS"; |
| 2142 case HEAP_NUMBERS: return "HEAP_NUMBERS"; | 2142 case HEAP_NUMBERS: return "HEAP_NUMBERS"; |
| 2143 case OBJECTS: return "OBJECTS"; | 2143 case OBJECTS: return "OBJECTS"; |
| 2144 case STRINGS: return "STRINGS"; |
| 2144 case GENERIC: return "GENERIC"; | 2145 case GENERIC: return "GENERIC"; |
| 2145 default: | 2146 default: |
| 2146 UNREACHABLE(); | 2147 UNREACHABLE(); |
| 2147 return NULL; | 2148 return NULL; |
| 2148 } | 2149 } |
| 2149 } | 2150 } |
| 2150 | 2151 |
| 2151 | 2152 |
| 2152 CompareIC::State CompareIC::TargetState(State state, | 2153 CompareIC::State CompareIC::TargetState(State state, |
| 2153 bool has_inlined_smi_code, | 2154 bool has_inlined_smi_code, |
| 2154 Handle<Object> x, | 2155 Handle<Object> x, |
| 2155 Handle<Object> y) { | 2156 Handle<Object> y) { |
| 2156 if (!has_inlined_smi_code && state != UNINITIALIZED) return GENERIC; | 2157 if (!has_inlined_smi_code && state != UNINITIALIZED) return GENERIC; |
| 2157 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS; | 2158 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS; |
| 2158 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) && | 2159 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) && |
| 2159 x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; | 2160 x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; |
| 2160 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; | 2161 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; |
| 2161 if (state == UNINITIALIZED && | 2162 if (state == UNINITIALIZED && |
| 2163 x->IsString() && y->IsString()) return STRINGS; |
| 2164 if (state == UNINITIALIZED && |
| 2162 x->IsJSObject() && y->IsJSObject()) return OBJECTS; | 2165 x->IsJSObject() && y->IsJSObject()) return OBJECTS; |
| 2163 return GENERIC; | 2166 return GENERIC; |
| 2164 } | 2167 } |
| 2165 | 2168 |
| 2166 | 2169 |
| 2167 // Used from ic_<arch>.cc. | 2170 // Used from ic_<arch>.cc. |
| 2168 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { | 2171 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { |
| 2169 NoHandleAllocation na; | 2172 NoHandleAllocation na; |
| 2170 ASSERT(args.length() == 3); | 2173 ASSERT(args.length() == 3); |
| 2171 CompareIC ic(isolate, static_cast<Token::Value>(Smi::cast(args[2])->value())); | 2174 CompareIC ic(isolate, static_cast<Token::Value>(Smi::cast(args[2])->value())); |
| 2172 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); | 2175 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); |
| 2173 return ic.target(); | 2176 return ic.target(); |
| 2174 } | 2177 } |
| 2175 | 2178 |
| 2176 | 2179 |
| 2177 static const Address IC_utilities[] = { | 2180 static const Address IC_utilities[] = { |
| 2178 #define ADDR(name) FUNCTION_ADDR(name), | 2181 #define ADDR(name) FUNCTION_ADDR(name), |
| 2179 IC_UTIL_LIST(ADDR) | 2182 IC_UTIL_LIST(ADDR) |
| 2180 NULL | 2183 NULL |
| 2181 #undef ADDR | 2184 #undef ADDR |
| 2182 }; | 2185 }; |
| 2183 | 2186 |
| 2184 | 2187 |
| 2185 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2188 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2186 return IC_utilities[id]; | 2189 return IC_utilities[id]; |
| 2187 } | 2190 } |
| 2188 | 2191 |
| 2189 | 2192 |
| 2190 } } // namespace v8::internal | 2193 } } // namespace v8::internal |
| OLD | NEW |