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

Side by Side Diff: src/ic.cc

Issue 6606006: [Isolates] Merge 6500:6700 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 9 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
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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1231
1232 return object->GetProperty(*object, &lookup, *name, &attr); 1232 return object->GetProperty(*object, &lookup, *name, &attr);
1233 } 1233 }
1234 1234
1235 // Do not use ICs for objects that require access checks (including 1235 // Do not use ICs for objects that require access checks (including
1236 // the global object). 1236 // the global object).
1237 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); 1237 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
1238 1238
1239 if (use_ic) { 1239 if (use_ic) {
1240 Code* stub = generic_stub(); 1240 Code* stub = generic_stub();
1241 if (object->IsString() && key->IsNumber()) { 1241 if (state == UNINITIALIZED) {
1242 stub = string_stub(); 1242 if (object->IsString() && key->IsNumber()) {
1243 } else if (object->IsJSObject()) { 1243 stub = string_stub();
1244 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1244 } else if (object->IsJSObject()) {
1245 if (receiver->HasExternalArrayElements()) { 1245 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1246 MaybeObject* probe = 1246 if (receiver->HasExternalArrayElements()) {
1247 isolate()->stub_cache()->ComputeKeyedLoadOrStoreExternalArray( 1247 MaybeObject* probe =
1248 *receiver, false); 1248 isolate()->stub_cache()->ComputeKeyedLoadOrStoreExternalArray(
1249 stub = 1249 *receiver, false);
1250 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); 1250 stub = probe->IsFailure() ?
1251 } else if (receiver->HasIndexedInterceptor()) { 1251 NULL : Code::cast(probe->ToObjectUnchecked());
1252 stub = indexed_interceptor_stub(); 1252 } else if (receiver->HasIndexedInterceptor()) {
1253 } else if (state == UNINITIALIZED && 1253 stub = indexed_interceptor_stub();
1254 key->IsSmi() && 1254 } else if (receiver->HasPixelElements()) {
1255 receiver->map()->has_fast_elements()) { 1255 MaybeObject* probe =
1256 MaybeObject* probe = 1256 isolate()->stub_cache()->ComputeKeyedLoadPixelArray(*receiver);
1257 isolate()->stub_cache()->ComputeKeyedLoadSpecialized(*receiver); 1257 stub = probe->IsFailure() ?
1258 stub = 1258 NULL : Code::cast(probe->ToObjectUnchecked());
1259 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); 1259 } else if (key->IsSmi() &&
1260 receiver->map()->has_fast_elements()) {
1261 MaybeObject* probe =
1262 isolate()->stub_cache()->ComputeKeyedLoadSpecialized(*receiver);
1263 stub = probe->IsFailure() ?
1264 NULL : Code::cast(probe->ToObjectUnchecked());
1265 }
1260 } 1266 }
1261 } 1267 }
1262 if (stub != NULL) set_target(stub); 1268 if (stub != NULL) set_target(stub);
1263 1269
1264 #ifdef DEBUG 1270 #ifdef DEBUG
1265 TraceIC("KeyedLoadIC", key, state, target()); 1271 TraceIC("KeyedLoadIC", key, state, target());
1266 #endif // DEBUG 1272 #endif // DEBUG
1267 1273
1268 // For JSObjects with fast elements that are not value wrappers 1274 // For JSObjects with fast elements that are not value wrappers
1269 // and that do not have indexed interceptors, we initialize the 1275 // and that do not have indexed interceptors, we initialize the
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 ::v8::internal::TypeInfo left_type = 2109 ::v8::internal::TypeInfo left_type =
2104 ::v8::internal::TypeInfo::TypeFromValue(left); 2110 ::v8::internal::TypeInfo::TypeFromValue(left);
2105 ::v8::internal::TypeInfo right_type = 2111 ::v8::internal::TypeInfo right_type =
2106 ::v8::internal::TypeInfo::TypeFromValue(right); 2112 ::v8::internal::TypeInfo::TypeFromValue(right);
2107 2113
2108 if (left_type.IsSmi() && right_type.IsSmi()) { 2114 if (left_type.IsSmi() && right_type.IsSmi()) {
2109 return SMI; 2115 return SMI;
2110 } 2116 }
2111 2117
2112 if (left_type.IsInteger32() && right_type.IsInteger32()) { 2118 if (left_type.IsInteger32() && right_type.IsInteger32()) {
2119 // Platforms with 32-bit Smis have no distinct INT32 type.
2120 if (kSmiValueSize == 32) return SMI;
2113 return INT32; 2121 return INT32;
2114 } 2122 }
2115 2123
2116 if (left_type.IsNumber() && right_type.IsNumber()) { 2124 if (left_type.IsNumber() && right_type.IsNumber()) {
2117 return HEAP_NUMBER; 2125 return HEAP_NUMBER;
2118 } 2126 }
2119 2127
2120 if (left_type.IsString() || right_type.IsString()) { 2128 if (left_type.IsString() || right_type.IsString()) {
2121 // Patching for fast string ADD makes sense even if only one of the 2129 // Patching for fast string ADD makes sense even if only one of the
2122 // arguments is a string. 2130 // arguments is a string.
(...skipping 24 matching lines...) Expand all
2147 static_cast<TRBinaryOpIC::TypeInfo>(Smi::cast(args[4])->value()); 2155 static_cast<TRBinaryOpIC::TypeInfo>(Smi::cast(args[4])->value());
2148 2156
2149 TRBinaryOpIC::TypeInfo type = TRBinaryOpIC::GetTypeInfo(left, right); 2157 TRBinaryOpIC::TypeInfo type = TRBinaryOpIC::GetTypeInfo(left, right);
2150 type = TRBinaryOpIC::JoinTypes(type, previous_type); 2158 type = TRBinaryOpIC::JoinTypes(type, previous_type);
2151 TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED; 2159 TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED;
2152 if (type == TRBinaryOpIC::STRING && op != Token::ADD) { 2160 if (type == TRBinaryOpIC::STRING && op != Token::ADD) {
2153 type = TRBinaryOpIC::GENERIC; 2161 type = TRBinaryOpIC::GENERIC;
2154 } 2162 }
2155 if (type == TRBinaryOpIC::SMI && 2163 if (type == TRBinaryOpIC::SMI &&
2156 previous_type == TRBinaryOpIC::SMI) { 2164 previous_type == TRBinaryOpIC::SMI) {
2157 if (op == Token::DIV || op == Token::MUL) { 2165 if (op == Token::DIV || op == Token::MUL || kSmiValueSize == 32) {
2158 // Arithmetic on two Smi inputs has yielded a heap number. 2166 // Arithmetic on two Smi inputs has yielded a heap number.
2159 // That is the only way to get here from the Smi stub. 2167 // That is the only way to get here from the Smi stub.
2168 // With 32-bit Smis, all overflows give heap numbers, but with
2169 // 31-bit Smis, most operations overflow to int32 results.
2160 result_type = TRBinaryOpIC::HEAP_NUMBER; 2170 result_type = TRBinaryOpIC::HEAP_NUMBER;
2161 } else { 2171 } else {
2162 // Other operations on SMIs that overflow yield int32s. 2172 // Other operations on SMIs that overflow yield int32s.
2163 result_type = TRBinaryOpIC::INT32; 2173 result_type = TRBinaryOpIC::INT32;
2164 } 2174 }
2165 } 2175 }
2166 if (type == TRBinaryOpIC::INT32 && 2176 if (type == TRBinaryOpIC::INT32 &&
2167 previous_type == TRBinaryOpIC::INT32) { 2177 previous_type == TRBinaryOpIC::INT32) {
2168 // We must be here because an operation on two INT32 types overflowed. 2178 // We must be here because an operation on two INT32 types overflowed.
2169 result_type = TRBinaryOpIC::HEAP_NUMBER; 2179 result_type = TRBinaryOpIC::HEAP_NUMBER;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 #undef ADDR 2315 #undef ADDR
2306 }; 2316 };
2307 2317
2308 2318
2309 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2319 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2310 return IC_utilities[id]; 2320 return IC_utilities[id];
2311 } 2321 }
2312 2322
2313 2323
2314 } } // namespace v8::internal 2324 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/isolate.h » ('j') | src/isolate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698