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

Side by Side Diff: src/ic.cc

Issue 8883023: Revert 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
« no previous file with comments | « 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 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";
2324 case SYMBOLS: return "SYMBOLS"; 2323 case SYMBOLS: return "SYMBOLS";
2325 case STRINGS: return "STRINGS"; 2324 case STRINGS: return "STRINGS";
2326 case GENERIC: return "GENERIC"; 2325 case GENERIC: return "GENERIC";
2327 default: 2326 default:
2328 UNREACHABLE(); 2327 UNREACHABLE();
2329 return NULL; 2328 return NULL;
2330 } 2329 }
2331 } 2330 }
2332 2331
2333 2332
2334 CompareIC::State CompareIC::TargetState(State state, 2333 CompareIC::State CompareIC::TargetState(State state,
2335 bool has_inlined_smi_code, 2334 bool has_inlined_smi_code,
2336 Handle<Object> x, 2335 Handle<Object> x,
2337 Handle<Object> y) { 2336 Handle<Object> y) {
2338 switch (state) { 2337 if (!has_inlined_smi_code && state != UNINITIALIZED && state != SYMBOLS) {
2339 case UNINITIALIZED: 2338 return GENERIC;
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 } 2339 }
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;
2369 } 2351 }
2370 2352
2371 2353
2372 // Used from ic_<arch>.cc. 2354 // Used from ic_<arch>.cc.
2373 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { 2355 RUNTIME_FUNCTION(Code*, CompareIC_Miss) {
2374 NoHandleAllocation na; 2356 NoHandleAllocation na;
2375 ASSERT(args.length() == 3); 2357 ASSERT(args.length() == 3);
2376 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); 2358 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2)));
2377 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); 2359 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2378 return ic.target(); 2360 return ic.target();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 #undef ADDR 2393 #undef ADDR
2412 }; 2394 };
2413 2395
2414 2396
2415 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2397 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2416 return IC_utilities[id]; 2398 return IC_utilities[id];
2417 } 2399 }
2418 2400
2419 2401
2420 } } // namespace v8::internal 2402 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698