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

Side by Side Diff: src/ic.cc

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 months 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/json.js » ('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 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 return MONOMORPHIC; 1992 return MONOMORPHIC;
1993 case GENERIC: 1993 case GENERIC:
1994 return MEGAMORPHIC; 1994 return MEGAMORPHIC;
1995 } 1995 }
1996 UNREACHABLE(); 1996 UNREACHABLE();
1997 return ::v8::internal::UNINITIALIZED; 1997 return ::v8::internal::UNINITIALIZED;
1998 } 1998 }
1999 1999
2000 2000
2001 TRBinaryOpIC::TypeInfo TRBinaryOpIC::JoinTypes(TRBinaryOpIC::TypeInfo x, 2001 TRBinaryOpIC::TypeInfo TRBinaryOpIC::JoinTypes(TRBinaryOpIC::TypeInfo x,
2002 TRBinaryOpIC::TypeInfo y) { 2002 TRBinaryOpIC::TypeInfo y) {
2003 if (x == UNINITIALIZED) return y; 2003 if (x == UNINITIALIZED) return y;
2004 if (y == UNINITIALIZED) return x; 2004 if (y == UNINITIALIZED) return x;
2005 if (x == STRING && y == STRING) return STRING; 2005 if (x == STRING && y == STRING) return STRING;
2006 if (x == STRING || y == STRING) return GENERIC; 2006 if (x == STRING || y == STRING) return GENERIC;
2007 if (x >= y) return x; 2007 if (x >= y) return x;
2008 return y; 2008 return y;
2009 } 2009 }
2010 2010
2011 TRBinaryOpIC::TypeInfo TRBinaryOpIC::GetTypeInfo(Handle<Object> left, 2011 TRBinaryOpIC::TypeInfo TRBinaryOpIC::GetTypeInfo(Handle<Object> left,
2012 Handle<Object> right) { 2012 Handle<Object> right) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 if (!code.is_null()) { 2083 if (!code.is_null()) {
2084 TRBinaryOpIC ic(isolate); 2084 TRBinaryOpIC ic(isolate);
2085 ic.patch(*code); 2085 ic.patch(*code);
2086 if (FLAG_trace_ic) { 2086 if (FLAG_trace_ic) {
2087 PrintF("[TypeRecordingBinaryOpIC (%s->(%s->%s))#%s]\n", 2087 PrintF("[TypeRecordingBinaryOpIC (%s->(%s->%s))#%s]\n",
2088 TRBinaryOpIC::GetName(previous_type), 2088 TRBinaryOpIC::GetName(previous_type),
2089 TRBinaryOpIC::GetName(type), 2089 TRBinaryOpIC::GetName(type),
2090 TRBinaryOpIC::GetName(result_type), 2090 TRBinaryOpIC::GetName(result_type),
2091 Token::Name(op)); 2091 Token::Name(op));
2092 } 2092 }
2093
2094 // Activate inlined smi code.
2095 if (previous_type == TRBinaryOpIC::UNINITIALIZED) {
2096 PatchInlinedSmiCode(ic.address());
2097 }
2093 } 2098 }
2094 2099
2095 Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>( 2100 Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>(
2096 isolate->thread_local_top()->context_->builtins()); 2101 isolate->thread_local_top()->context_->builtins());
2097 Object* builtin = NULL; // Initialization calms down the compiler. 2102 Object* builtin = NULL; // Initialization calms down the compiler.
2098 switch (op) { 2103 switch (op) {
2099 case Token::ADD: 2104 case Token::ADD:
2100 builtin = builtins->javascript_builtin(Builtins::ADD); 2105 builtin = builtins->javascript_builtin(Builtins::ADD);
2101 break; 2106 break;
2102 case Token::SUB: 2107 case Token::SUB:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 case HEAP_NUMBERS: return "HEAP_NUMBERS"; 2175 case HEAP_NUMBERS: return "HEAP_NUMBERS";
2171 case OBJECTS: return "OBJECTS"; 2176 case OBJECTS: return "OBJECTS";
2172 case GENERIC: return "GENERIC"; 2177 case GENERIC: return "GENERIC";
2173 default: 2178 default:
2174 UNREACHABLE(); 2179 UNREACHABLE();
2175 return NULL; 2180 return NULL;
2176 } 2181 }
2177 } 2182 }
2178 2183
2179 2184
2180 CompareIC::State CompareIC::TargetState(Handle<Object> x, Handle<Object> y) { 2185 CompareIC::State CompareIC::TargetState(State state,
2181 State state = GetState(); 2186 bool has_inlined_smi_code,
2182 if (state != UNINITIALIZED) return GENERIC; 2187 Handle<Object> x,
2183 if (x->IsSmi() && y->IsSmi()) return SMIS; 2188 Handle<Object> y) {
2184 if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; 2189 if (!has_inlined_smi_code && state != UNINITIALIZED) return GENERIC;
2190 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS;
2191 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) &&
2192 x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS;
2185 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; 2193 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC;
2186 if (x->IsJSObject() && y->IsJSObject()) return OBJECTS; 2194 if (state == UNINITIALIZED &&
2195 x->IsJSObject() && y->IsJSObject()) return OBJECTS;
2187 return GENERIC; 2196 return GENERIC;
2188 } 2197 }
2189 2198
2190 2199
2191 // Used from ic_<arch>.cc. 2200 // Used from ic_<arch>.cc.
2192 Code* CompareIC_Miss(RUNTIME_CALLING_CONVENTION) { 2201 Code* CompareIC_Miss(RUNTIME_CALLING_CONVENTION) {
2193 RUNTIME_GET_ISOLATE; 2202 RUNTIME_GET_ISOLATE;
2194 NoHandleAllocation na; 2203 NoHandleAllocation na;
2195 ASSERT(args.length() == 3); 2204 ASSERT(args.length() == 3);
2196 CompareIC ic(isolate, static_cast<Token::Value>(Smi::cast(args[2])->value())); 2205 CompareIC ic(isolate, static_cast<Token::Value>(Smi::cast(args[2])->value()));
2197 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); 2206 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2198 return ic.target(); 2207 return ic.target();
2199 } 2208 }
2200 2209
2201 2210
2202 static const Address IC_utilities[] = { 2211 static const Address IC_utilities[] = {
2203 #define ADDR(name) FUNCTION_ADDR(name), 2212 #define ADDR(name) FUNCTION_ADDR(name),
2204 IC_UTIL_LIST(ADDR) 2213 IC_UTIL_LIST(ADDR)
2205 NULL 2214 NULL
2206 #undef ADDR 2215 #undef ADDR
2207 }; 2216 };
2208 2217
2209 2218
2210 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2219 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2211 return IC_utilities[id]; 2220 return IC_utilities[id];
2212 } 2221 }
2213 2222
2214 2223
2215 } } // namespace v8::internal 2224 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698