| 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 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 return MONOMORPHIC; | 1944 return MONOMORPHIC; |
| 1945 case GENERIC: | 1945 case GENERIC: |
| 1946 return MEGAMORPHIC; | 1946 return MEGAMORPHIC; |
| 1947 } | 1947 } |
| 1948 UNREACHABLE(); | 1948 UNREACHABLE(); |
| 1949 return ::v8::internal::UNINITIALIZED; | 1949 return ::v8::internal::UNINITIALIZED; |
| 1950 } | 1950 } |
| 1951 | 1951 |
| 1952 | 1952 |
| 1953 TRBinaryOpIC::TypeInfo TRBinaryOpIC::JoinTypes(TRBinaryOpIC::TypeInfo x, | 1953 TRBinaryOpIC::TypeInfo TRBinaryOpIC::JoinTypes(TRBinaryOpIC::TypeInfo x, |
| 1954 TRBinaryOpIC::TypeInfo y) { | 1954 TRBinaryOpIC::TypeInfo y) { |
| 1955 if (x == UNINITIALIZED) return y; | 1955 if (x == UNINITIALIZED) return y; |
| 1956 if (y == UNINITIALIZED) return x; | 1956 if (y == UNINITIALIZED) return x; |
| 1957 if (x == STRING && y == STRING) return STRING; | 1957 if (x == STRING && y == STRING) return STRING; |
| 1958 if (x == STRING || y == STRING) return GENERIC; | 1958 if (x == STRING || y == STRING) return GENERIC; |
| 1959 if (x >= y) return x; | 1959 if (x >= y) return x; |
| 1960 return y; | 1960 return y; |
| 1961 } | 1961 } |
| 1962 | 1962 |
| 1963 TRBinaryOpIC::TypeInfo TRBinaryOpIC::GetTypeInfo(Handle<Object> left, | 1963 TRBinaryOpIC::TypeInfo TRBinaryOpIC::GetTypeInfo(Handle<Object> left, |
| 1964 Handle<Object> right) { | 1964 Handle<Object> right) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 if (!code.is_null()) { | 2034 if (!code.is_null()) { |
| 2035 TRBinaryOpIC ic; | 2035 TRBinaryOpIC ic; |
| 2036 ic.patch(*code); | 2036 ic.patch(*code); |
| 2037 if (FLAG_trace_ic) { | 2037 if (FLAG_trace_ic) { |
| 2038 PrintF("[TypeRecordingBinaryOpIC (%s->(%s->%s))#%s]\n", | 2038 PrintF("[TypeRecordingBinaryOpIC (%s->(%s->%s))#%s]\n", |
| 2039 TRBinaryOpIC::GetName(previous_type), | 2039 TRBinaryOpIC::GetName(previous_type), |
| 2040 TRBinaryOpIC::GetName(type), | 2040 TRBinaryOpIC::GetName(type), |
| 2041 TRBinaryOpIC::GetName(result_type), | 2041 TRBinaryOpIC::GetName(result_type), |
| 2042 Token::Name(op)); | 2042 Token::Name(op)); |
| 2043 } | 2043 } |
| 2044 |
| 2045 // Activate inlined smi code. |
| 2046 if (previous_type == TRBinaryOpIC::UNINITIALIZED) { |
| 2047 PatchInlinedSmiCode(ic.address()); |
| 2048 } |
| 2044 } | 2049 } |
| 2045 | 2050 |
| 2046 Handle<JSBuiltinsObject> builtins = Top::builtins(); | 2051 Handle<JSBuiltinsObject> builtins = Top::builtins(); |
| 2047 Object* builtin = NULL; // Initialization calms down the compiler. | 2052 Object* builtin = NULL; // Initialization calms down the compiler. |
| 2048 switch (op) { | 2053 switch (op) { |
| 2049 case Token::ADD: | 2054 case Token::ADD: |
| 2050 builtin = builtins->javascript_builtin(Builtins::ADD); | 2055 builtin = builtins->javascript_builtin(Builtins::ADD); |
| 2051 break; | 2056 break; |
| 2052 case Token::SUB: | 2057 case Token::SUB: |
| 2053 builtin = builtins->javascript_builtin(Builtins::SUB); | 2058 builtin = builtins->javascript_builtin(Builtins::SUB); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 case HEAP_NUMBERS: return "HEAP_NUMBERS"; | 2125 case HEAP_NUMBERS: return "HEAP_NUMBERS"; |
| 2121 case OBJECTS: return "OBJECTS"; | 2126 case OBJECTS: return "OBJECTS"; |
| 2122 case GENERIC: return "GENERIC"; | 2127 case GENERIC: return "GENERIC"; |
| 2123 default: | 2128 default: |
| 2124 UNREACHABLE(); | 2129 UNREACHABLE(); |
| 2125 return NULL; | 2130 return NULL; |
| 2126 } | 2131 } |
| 2127 } | 2132 } |
| 2128 | 2133 |
| 2129 | 2134 |
| 2130 CompareIC::State CompareIC::TargetState(Handle<Object> x, Handle<Object> y) { | 2135 CompareIC::State CompareIC::TargetState(State state, |
| 2131 State state = GetState(); | 2136 Handle<Object> x, |
| 2137 Handle<Object> y) { |
| 2132 if (state != UNINITIALIZED) return GENERIC; | 2138 if (state != UNINITIALIZED) return GENERIC; |
| 2133 if (x->IsSmi() && y->IsSmi()) return SMIS; | 2139 if (x->IsSmi() && y->IsSmi()) return SMIS; |
| 2134 if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; | 2140 if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; |
| 2135 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; | 2141 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; |
| 2136 if (x->IsJSObject() && y->IsJSObject()) return OBJECTS; | 2142 if (x->IsJSObject() && y->IsJSObject()) return OBJECTS; |
| 2137 return GENERIC; | 2143 return GENERIC; |
| 2138 } | 2144 } |
| 2139 | 2145 |
| 2140 | 2146 |
| 2141 // Used from ic_<arch>.cc. | 2147 // Used from ic_<arch>.cc. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2155 #undef ADDR | 2161 #undef ADDR |
| 2156 }; | 2162 }; |
| 2157 | 2163 |
| 2158 | 2164 |
| 2159 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2165 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2160 return IC_utilities[id]; | 2166 return IC_utilities[id]; |
| 2161 } | 2167 } |
| 2162 | 2168 |
| 2163 | 2169 |
| 2164 } } // namespace v8::internal | 2170 } } // namespace v8::internal |
| OLD | NEW |