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

Side by Side Diff: src/ic.cc

Issue 8520006: Optimize the equality check case of ICCompare stubs. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 1 month 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 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 return static_cast<State>(target->compare_state()); 2308 return static_cast<State>(target->compare_state());
2309 } 2309 }
2310 2310
2311 2311
2312 const char* CompareIC::GetStateName(State state) { 2312 const char* CompareIC::GetStateName(State state) {
2313 switch (state) { 2313 switch (state) {
2314 case UNINITIALIZED: return "UNINITIALIZED"; 2314 case UNINITIALIZED: return "UNINITIALIZED";
2315 case SMIS: return "SMIS"; 2315 case SMIS: return "SMIS";
2316 case HEAP_NUMBERS: return "HEAP_NUMBERS"; 2316 case HEAP_NUMBERS: return "HEAP_NUMBERS";
2317 case OBJECTS: return "OBJECTS"; 2317 case OBJECTS: return "OBJECTS";
2318 case KNOWN_OBJECTS: return "OBJECTS";
2318 case SYMBOLS: return "SYMBOLS"; 2319 case SYMBOLS: return "SYMBOLS";
2319 case STRINGS: return "STRINGS"; 2320 case STRINGS: return "STRINGS";
2320 case GENERIC: return "GENERIC"; 2321 case GENERIC: return "GENERIC";
2321 default: 2322 default:
2322 UNREACHABLE(); 2323 UNREACHABLE();
2323 return NULL; 2324 return NULL;
2324 } 2325 }
2325 } 2326 }
2326 2327
2327 2328
2328 CompareIC::State CompareIC::TargetState(State state, 2329 CompareIC::State CompareIC::TargetState(State state,
2329 bool has_inlined_smi_code, 2330 bool has_inlined_smi_code,
2330 Handle<Object> x, 2331 Handle<Object> x,
2331 Handle<Object> y) { 2332 Handle<Object> y) {
2332 if (!has_inlined_smi_code && state != UNINITIALIZED && state != SYMBOLS) { 2333 if (!has_inlined_smi_code && state != UNINITIALIZED && state != SYMBOLS) {
2333 return GENERIC; 2334 return GENERIC;
2334 } 2335 }
2335 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS; 2336 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) {
Kevin Millikin (Chromium) 2011/11/10 19:08:42 I don't like this function. It's really hard to f
Rico 2011/11/11 08:49:11 Done.
2337 return SMIS;
2338 }
2336 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) && 2339 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) &&
2337 x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; 2340 x->IsNumber() && y->IsNumber()) {
2338 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC; 2341 return HEAP_NUMBERS;
2342 }
2343 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) {
2344 return GENERIC;
2345 }
2339 if (state == UNINITIALIZED && 2346 if (state == UNINITIALIZED &&
2340 x->IsSymbol() && y->IsSymbol()) return SYMBOLS; 2347 x->IsSymbol() && y->IsSymbol()) {
2348 return SYMBOLS;
2349 }
2341 if ((state == UNINITIALIZED || state == SYMBOLS) && 2350 if ((state == UNINITIALIZED || state == SYMBOLS) &&
2342 x->IsString() && y->IsString()) return STRINGS; 2351 x->IsString() && y->IsString()) {
2343 if (state == UNINITIALIZED && 2352 return STRINGS;
2344 x->IsJSObject() && y->IsJSObject()) return OBJECTS; 2353 }
2354 if (state == UNINITIALIZED && x->IsJSObject() && y->IsJSObject()) {
2355 if (Handle<JSObject>::cast(x)->map() == Handle<JSObject>::cast(y)->map() &&
2356 op_ == Token::EQ) {
2357 return KNOWN_OBJECTS;
2358 } else {
2359 return OBJECTS;
2360 }
2361 }
2345 return GENERIC; 2362 return GENERIC;
2346 } 2363 }
2347 2364
2348 2365
2349 // Used from ic_<arch>.cc. 2366 // Used from ic_<arch>.cc.
2350 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { 2367 RUNTIME_FUNCTION(Code*, CompareIC_Miss) {
2351 NoHandleAllocation na; 2368 NoHandleAllocation na;
2352 ASSERT(args.length() == 3); 2369 ASSERT(args.length() == 3);
2353 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); 2370 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2)));
2354 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); 2371 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 #undef ADDR 2405 #undef ADDR
2389 }; 2406 };
2390 2407
2391 2408
2392 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2409 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2393 return IC_utilities[id]; 2410 return IC_utilities[id];
2394 } 2411 }
2395 2412
2396 2413
2397 } } // namespace v8::internal 2414 } } // namespace v8::internal
OLDNEW
« src/ia32/ic-ia32.cc ('K') | « src/ic.h ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698