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

Side by Side Diff: src/ic.cc

Issue 8872060: Reland 10216 - Optimize the equality check case of ICCompare stubs. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 return static_cast<State>(target->compare_state()); 2313 return static_cast<State>(target->compare_state());
2314 } 2314 }
2315 2315
2316 2316
2317 const char* CompareIC::GetStateName(State state) { 2317 const char* CompareIC::GetStateName(State state) {
2318 switch (state) { 2318 switch (state) {
2319 case UNINITIALIZED: return "UNINITIALIZED"; 2319 case UNINITIALIZED: return "UNINITIALIZED";
2320 case SMIS: return "SMIS"; 2320 case SMIS: return "SMIS";
2321 case HEAP_NUMBERS: return "HEAP_NUMBERS"; 2321 case HEAP_NUMBERS: return "HEAP_NUMBERS";
2322 case OBJECTS: return "OBJECTS"; 2322 case OBJECTS: return "OBJECTS";
2323 case KNOWN_OBJECTS: return "OBJECTS";
2323 case SYMBOLS: return "SYMBOLS"; 2324 case SYMBOLS: return "SYMBOLS";
2324 case STRINGS: return "STRINGS"; 2325 case STRINGS: return "STRINGS";
2325 case GENERIC: return "GENERIC"; 2326 case GENERIC: return "GENERIC";
2326 default: 2327 default:
2327 UNREACHABLE(); 2328 UNREACHABLE();
2328 return NULL; 2329 return NULL;
2329 } 2330 }
2330 } 2331 }
2331 2332
2332 2333
2333 CompareIC::State CompareIC::TargetState(State state, 2334 CompareIC::State CompareIC::TargetState(State state,
2334 bool has_inlined_smi_code, 2335 bool has_inlined_smi_code,
2335 Handle<Object> x, 2336 Handle<Object> x,
2336 Handle<Object> y) { 2337 Handle<Object> y) {
2337 if (!has_inlined_smi_code && state != UNINITIALIZED && state != SYMBOLS) { 2338 switch (state) {
2338 return GENERIC; 2339 case UNINITIALIZED:
2340 if (x->IsSmi() && y->IsSmi()) return SMIS;
2341 if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS;
2342 if (!Token::IsEqualityOp(op_)) return GENERIC;
2343 if (x->IsSymbol() && y->IsSymbol()) return SYMBOLS;
2344 if (x->IsString() && y->IsString()) return STRINGS;
2345 if (x->IsJSObject() && y->IsJSObject()) {
2346 if (Handle<JSObject>::cast(x)->map() ==
2347 Handle<JSObject>::cast(y)->map() &&
2348 Token::IsEqualityOp(op_)) {
2349 return KNOWN_OBJECTS;
2350 } else {
2351 return OBJECTS;
2352 }
2353 }
2354 return GENERIC;
2355 case SMIS:
2356 return has_inlined_smi_code && x->IsNumber() && y->IsNumber()
2357 ? HEAP_NUMBERS
2358 : GENERIC;
2359 case SYMBOLS:
2360 ASSERT(Token::IsEqualityOp(op_));
2361 return x->IsString() && y->IsString() ? STRINGS : GENERIC;
2362 case HEAP_NUMBERS:
2363 case STRINGS:
2364 case OBJECTS:
2365 case KNOWN_OBJECTS:
2366 case GENERIC:
2367 return GENERIC;
2368 default:
2369 UNREACHABLE();
Kevin Millikin (Chromium) 2011/12/09 09:10:31 I'd rather have this outside the switch: switch (
Rico 2011/12/09 09:28:31 Done.
2370 return NULL;
2339 } 2371 }
2340 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS;
2341 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) &&
2342 x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS;
2343 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC;
2344 if (state == UNINITIALIZED &&
2345 x->IsSymbol() && y->IsSymbol()) return SYMBOLS;
2346 if ((state == UNINITIALIZED || state == SYMBOLS) &&
2347 x->IsString() && y->IsString()) return STRINGS;
2348 if (state == UNINITIALIZED &&
2349 x->IsJSObject() && y->IsJSObject()) return OBJECTS;
2350 return GENERIC;
2351 } 2372 }
2352 2373
2353 2374
2354 // Used from ic_<arch>.cc. 2375 // Used from ic_<arch>.cc.
2355 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { 2376 RUNTIME_FUNCTION(Code*, CompareIC_Miss) {
2356 NoHandleAllocation na; 2377 NoHandleAllocation na;
2357 ASSERT(args.length() == 3); 2378 ASSERT(args.length() == 3);
2358 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); 2379 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2)));
2359 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); 2380 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2360 return ic.target(); 2381 return ic.target();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 #undef ADDR 2414 #undef ADDR
2394 }; 2415 };
2395 2416
2396 2417
2397 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2418 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2398 return IC_utilities[id]; 2419 return IC_utilities[id];
2399 } 2420 }
2400 2421
2401 2422
2402 } } // namespace v8::internal 2423 } } // namespace v8::internal
OLDNEW
« src/arm/code-stubs-arm.cc ('K') | « src/ic.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698