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 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 case OBJECTS: return "OBJECTS"; | 2126 case OBJECTS: return "OBJECTS"; |
2127 case GENERIC: return "GENERIC"; | 2127 case GENERIC: return "GENERIC"; |
2128 default: | 2128 default: |
2129 UNREACHABLE(); | 2129 UNREACHABLE(); |
2130 return NULL; | 2130 return NULL; |
2131 } | 2131 } |
2132 } | 2132 } |
2133 | 2133 |
2134 | 2134 |
2135 CompareIC::State CompareIC::TargetState(State state, | 2135 CompareIC::State CompareIC::TargetState(State state, |
| 2136 bool has_inlined_smi_code, |
2136 Handle<Object> x, | 2137 Handle<Object> x, |
2137 Handle<Object> y) { | 2138 Handle<Object> y) { |
2138 if (state != UNINITIALIZED) return GENERIC; | 2139 if (!has_inlined_smi_code && state != UNINITIALIZED) return GENERIC; |
2139 if (x->IsSmi() && y->IsSmi()) return SMIS; | 2140 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS; |
2140 if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; | 2141 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) && |
| 2142 x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; |
2141 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; | 2143 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; |
2142 if (x->IsJSObject() && y->IsJSObject()) return OBJECTS; | 2144 if (state == UNINITIALIZED && |
| 2145 x->IsJSObject() && y->IsJSObject()) return OBJECTS; |
2143 return GENERIC; | 2146 return GENERIC; |
2144 } | 2147 } |
2145 | 2148 |
2146 | 2149 |
2147 // Used from ic_<arch>.cc. | 2150 // Used from ic_<arch>.cc. |
2148 Code* CompareIC_Miss(Arguments args) { | 2151 Code* CompareIC_Miss(Arguments args) { |
2149 NoHandleAllocation na; | 2152 NoHandleAllocation na; |
2150 ASSERT(args.length() == 3); | 2153 ASSERT(args.length() == 3); |
2151 CompareIC ic(static_cast<Token::Value>(Smi::cast(args[2])->value())); | 2154 CompareIC ic(static_cast<Token::Value>(Smi::cast(args[2])->value())); |
2152 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); | 2155 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); |
2153 return ic.target(); | 2156 return ic.target(); |
2154 } | 2157 } |
2155 | 2158 |
2156 | 2159 |
2157 static Address IC_utilities[] = { | 2160 static Address IC_utilities[] = { |
2158 #define ADDR(name) FUNCTION_ADDR(name), | 2161 #define ADDR(name) FUNCTION_ADDR(name), |
2159 IC_UTIL_LIST(ADDR) | 2162 IC_UTIL_LIST(ADDR) |
2160 NULL | 2163 NULL |
2161 #undef ADDR | 2164 #undef ADDR |
2162 }; | 2165 }; |
2163 | 2166 |
2164 | 2167 |
2165 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2168 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2166 return IC_utilities[id]; | 2169 return IC_utilities[id]; |
2167 } | 2170 } |
2168 | 2171 |
2169 | 2172 |
2170 } } // namespace v8::internal | 2173 } } // namespace v8::internal |
OLD | NEW |