Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ic.cc

Issue 5763004: Second attempt: Improve our type feedback by recogizining never-executed IC c... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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 bool has_inlined_smi_code,
2132 if (state != UNINITIALIZED) return GENERIC; 2137 Handle<Object> x,
2133 if (x->IsSmi() && y->IsSmi()) return SMIS; 2138 Handle<Object> y) {
2134 if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; 2139 if (!has_inlined_smi_code && state != UNINITIALIZED) return GENERIC;
2140 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS;
2141 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) &&
2142 x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS;
2135 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; 2143 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC;
2136 if (x->IsJSObject() && y->IsJSObject()) return OBJECTS; 2144 if (state == UNINITIALIZED &&
2145 x->IsJSObject() && y->IsJSObject()) return OBJECTS;
2137 return GENERIC; 2146 return GENERIC;
2138 } 2147 }
2139 2148
2140 2149
2141 // Used from ic_<arch>.cc. 2150 // Used from ic_<arch>.cc.
2142 Code* CompareIC_Miss(Arguments args) { 2151 Code* CompareIC_Miss(Arguments args) {
2143 NoHandleAllocation na; 2152 NoHandleAllocation na;
2144 ASSERT(args.length() == 3); 2153 ASSERT(args.length() == 3);
2145 CompareIC ic(static_cast<Token::Value>(Smi::cast(args[2])->value())); 2154 CompareIC ic(static_cast<Token::Value>(Smi::cast(args[2])->value()));
2146 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); 2155 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2147 return ic.target(); 2156 return ic.target();
2148 } 2157 }
2149 2158
2150 2159
2151 static Address IC_utilities[] = { 2160 static Address IC_utilities[] = {
2152 #define ADDR(name) FUNCTION_ADDR(name), 2161 #define ADDR(name) FUNCTION_ADDR(name),
2153 IC_UTIL_LIST(ADDR) 2162 IC_UTIL_LIST(ADDR)
2154 NULL 2163 NULL
2155 #undef ADDR 2164 #undef ADDR
2156 }; 2165 };
2157 2166
2158 2167
2159 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2168 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2160 return IC_utilities[id]; 2169 return IC_utilities[id];
2161 } 2170 }
2162 2171
2163 2172
2164 } } // namespace v8::internal 2173 } } // namespace v8::internal
OLDNEW
« src/ia32/ic-ia32.cc ('K') | « src/ic.h ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698