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

Side by Side Diff: src/ic.cc

Issue 5717005: Revert r5970 and r5975. (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
« no previous file with comments | « src/ic.h ('k') | src/type-info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 }
2049 } 2044 }
2050 2045
2051 Handle<JSBuiltinsObject> builtins = Top::builtins(); 2046 Handle<JSBuiltinsObject> builtins = Top::builtins();
2052 Object* builtin = NULL; // Initialization calms down the compiler. 2047 Object* builtin = NULL; // Initialization calms down the compiler.
2053 switch (op) { 2048 switch (op) {
2054 case Token::ADD: 2049 case Token::ADD:
2055 builtin = builtins->javascript_builtin(Builtins::ADD); 2050 builtin = builtins->javascript_builtin(Builtins::ADD);
2056 break; 2051 break;
2057 case Token::SUB: 2052 case Token::SUB:
2058 builtin = builtins->javascript_builtin(Builtins::SUB); 2053 builtin = builtins->javascript_builtin(Builtins::SUB);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 case HEAP_NUMBERS: return "HEAP_NUMBERS"; 2120 case HEAP_NUMBERS: return "HEAP_NUMBERS";
2126 case OBJECTS: return "OBJECTS"; 2121 case OBJECTS: return "OBJECTS";
2127 case GENERIC: return "GENERIC"; 2122 case GENERIC: return "GENERIC";
2128 default: 2123 default:
2129 UNREACHABLE(); 2124 UNREACHABLE();
2130 return NULL; 2125 return NULL;
2131 } 2126 }
2132 } 2127 }
2133 2128
2134 2129
2135 CompareIC::State CompareIC::TargetState(State state, 2130 CompareIC::State CompareIC::TargetState(Handle<Object> x, Handle<Object> y) {
2136 bool has_inlined_smi_code, 2131 State state = GetState();
2137 Handle<Object> x, 2132 if (state != UNINITIALIZED) return GENERIC;
2138 Handle<Object> y) { 2133 if (x->IsSmi() && y->IsSmi()) return SMIS;
2139 if (!has_inlined_smi_code && state != UNINITIALIZED) return GENERIC; 2134 if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS;
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;
2143 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; 2135 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC;
2144 if (state == UNINITIALIZED && 2136 if (x->IsJSObject() && y->IsJSObject()) return OBJECTS;
2145 x->IsJSObject() && y->IsJSObject()) return OBJECTS;
2146 return GENERIC; 2137 return GENERIC;
2147 } 2138 }
2148 2139
2149 2140
2150 // Used from ic_<arch>.cc. 2141 // Used from ic_<arch>.cc.
2151 Code* CompareIC_Miss(Arguments args) { 2142 Code* CompareIC_Miss(Arguments args) {
2152 NoHandleAllocation na; 2143 NoHandleAllocation na;
2153 ASSERT(args.length() == 3); 2144 ASSERT(args.length() == 3);
2154 CompareIC ic(static_cast<Token::Value>(Smi::cast(args[2])->value())); 2145 CompareIC ic(static_cast<Token::Value>(Smi::cast(args[2])->value()));
2155 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); 2146 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2156 return ic.target(); 2147 return ic.target();
2157 } 2148 }
2158 2149
2159 2150
2160 static Address IC_utilities[] = { 2151 static Address IC_utilities[] = {
2161 #define ADDR(name) FUNCTION_ADDR(name), 2152 #define ADDR(name) FUNCTION_ADDR(name),
2162 IC_UTIL_LIST(ADDR) 2153 IC_UTIL_LIST(ADDR)
2163 NULL 2154 NULL
2164 #undef ADDR 2155 #undef ADDR
2165 }; 2156 };
2166 2157
2167 2158
2168 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2159 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2169 return IC_utilities[id]; 2160 return IC_utilities[id];
2170 } 2161 }
2171 2162
2172 2163
2173 } } // namespace v8::internal 2164 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698