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

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 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
« src/heap.h ('K') | « src/ic.h ('k') | src/mark-compact.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 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 switch (state) {
2333 return GENERIC; 2334 case UNINITIALIZED:
2335 if (x->IsSmi() && y->IsSmi()) return SMIS;
2336 if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS;
2337 if (!Token::IsEqualityOp(op_)) return GENERIC;
2338 if (x->IsSymbol() && y->IsSymbol()) return SYMBOLS;
2339 if (x->IsString() && y->IsString()) return STRINGS;
2340 if (x->IsJSObject() && y->IsJSObject()) {
2341 if (Handle<JSObject>::cast(x)->map() ==
2342 Handle<JSObject>::cast(y)->map() &&
2343 Token::IsEqualityOp(op_)) {
2344 return KNOWN_OBJECTS;
2345 } else {
2346 return OBJECTS;
2347 }
2348 }
2349 return GENERIC;
2350 case SMIS:
2351 return has_inlined_smi_code && x->IsNumber() && y->IsNumber()
2352 ? HEAP_NUMBERS
2353 : GENERIC;
2354 case SYMBOLS:
2355 ASSERT(Token::IsEqualityOp(op_));
2356 return x->IsString() && y->IsString() ? STRINGS : GENERIC;
2357 case HEAP_NUMBERS:
2358 case STRINGS:
2359 case OBJECTS:
2360 case KNOWN_OBJECTS:
2361 case GENERIC:
2362 return GENERIC;
2334 } 2363 }
2335 if (state == UNINITIALIZED && x->IsSmi() && y->IsSmi()) return SMIS;
2336 if ((state == UNINITIALIZED || (state == SMIS && has_inlined_smi_code)) &&
2337 x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS;
2338 if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return GENERIC;
2339 if (state == UNINITIALIZED &&
2340 x->IsSymbol() && y->IsSymbol()) return SYMBOLS;
2341 if ((state == UNINITIALIZED || state == SYMBOLS) &&
2342 x->IsString() && y->IsString()) return STRINGS;
2343 if (state == UNINITIALIZED &&
2344 x->IsJSObject() && y->IsJSObject()) return OBJECTS;
2345 return GENERIC;
2346 } 2364 }
2347 2365
2348 2366
2349 // Used from ic_<arch>.cc. 2367 // Used from ic_<arch>.cc.
2350 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { 2368 RUNTIME_FUNCTION(Code*, CompareIC_Miss) {
2351 NoHandleAllocation na; 2369 NoHandleAllocation na;
2352 ASSERT(args.length() == 3); 2370 ASSERT(args.length() == 3);
2353 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); 2371 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2)));
2354 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); 2372 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2355 return ic.target(); 2373 return ic.target();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 #undef ADDR 2406 #undef ADDR
2389 }; 2407 };
2390 2408
2391 2409
2392 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2410 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2393 return IC_utilities[id]; 2411 return IC_utilities[id];
2394 } 2412 }
2395 2413
2396 2414
2397 } } // namespace v8::internal 2415 } } // namespace v8::internal
OLDNEW
« src/heap.h ('K') | « src/ic.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698