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

Side by Side Diff: src/ic.cc

Issue 12296026: ES6 symbols: Implement Symbol intrinsic and basic functionality (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed more comments Created 7 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
« no previous file with comments | « src/ic.h ('k') | src/ic-inl.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 static bool TryRemoveInvalidPrototypeDependentStub(Code* target, 172 static bool TryRemoveInvalidPrototypeDependentStub(Code* target,
173 Object* receiver, 173 Object* receiver,
174 Object* name) { 174 Object* name) {
175 InlineCacheHolderFlag cache_holder = 175 InlineCacheHolderFlag cache_holder =
176 Code::ExtractCacheHolderFromFlags(target->flags()); 176 Code::ExtractCacheHolderFromFlags(target->flags());
177 177
178 if (cache_holder == OWN_MAP && !receiver->IsJSObject()) { 178 if (cache_holder == OWN_MAP && !receiver->IsJSObject()) {
179 // The stub was generated for JSObject but called for non-JSObject. 179 // The stub was generated for JSObject but called for non-JSObject.
180 // IC::GetCodeCacheHolder is not applicable. 180 // IC::GetCodeCacheHolder is not applicable.
181 return false; 181 return false;
182 } else if (cache_holder == PROTOTYPE_MAP && 182 } else if (cache_holder == DELEGATE_MAP &&
183 receiver->GetPrototype()->IsNull()) { 183 receiver->GetDelegate()->IsNull()) {
184 // IC::GetCodeCacheHolder is not applicable. 184 // IC::GetCodeCacheHolder is not applicable.
185 return false; 185 return false;
186 } 186 }
187 Map* map = IC::GetCodeCacheHolder(receiver, cache_holder)->map(); 187 Map* map = IC::GetCodeCacheHolder(receiver, cache_holder)->map();
188 188
189 // Decide whether the inline cache failed because of changes to the 189 // Decide whether the inline cache failed because of changes to the
190 // receiver itself or changes to one of its prototypes. 190 // receiver itself or changes to one of its prototypes.
191 // 191 //
192 // If there are changes to the receiver itself, the map of the 192 // If there are changes to the receiver itself, the map of the
193 // receiver will have changed and the current target will not be in 193 // receiver will have changed and the current target will not be in
(...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 2364
2365 const char* CompareIC::GetStateName(State state) { 2365 const char* CompareIC::GetStateName(State state) {
2366 switch (state) { 2366 switch (state) {
2367 case UNINITIALIZED: return "UNINITIALIZED"; 2367 case UNINITIALIZED: return "UNINITIALIZED";
2368 case SMI: return "SMI"; 2368 case SMI: return "SMI";
2369 case HEAP_NUMBER: return "HEAP_NUMBER"; 2369 case HEAP_NUMBER: return "HEAP_NUMBER";
2370 case OBJECT: return "OBJECTS"; 2370 case OBJECT: return "OBJECTS";
2371 case KNOWN_OBJECTS: return "KNOWN_OBJECTS"; 2371 case KNOWN_OBJECTS: return "KNOWN_OBJECTS";
2372 case INTERNALIZED_STRING: return "INTERNALIZED_STRING"; 2372 case INTERNALIZED_STRING: return "INTERNALIZED_STRING";
2373 case STRING: return "STRING"; 2373 case STRING: return "STRING";
2374 case UNIQUE_NAME: return "UNIQUE_NAME";
2374 case GENERIC: return "GENERIC"; 2375 case GENERIC: return "GENERIC";
2375 default: 2376 default:
2376 UNREACHABLE(); 2377 UNREACHABLE();
2377 return NULL; 2378 return NULL;
2378 } 2379 }
2379 } 2380 }
2380 2381
2381 2382
2382 static CompareIC::State InputState(CompareIC::State old_state, 2383 static CompareIC::State InputState(CompareIC::State old_state,
2383 Handle<Object> value) { 2384 Handle<Object> value) {
2384 switch (old_state) { 2385 switch (old_state) {
2385 case CompareIC::UNINITIALIZED: 2386 case CompareIC::UNINITIALIZED:
2386 if (value->IsSmi()) return CompareIC::SMI; 2387 if (value->IsSmi()) return CompareIC::SMI;
2387 if (value->IsHeapNumber()) return CompareIC::HEAP_NUMBER; 2388 if (value->IsHeapNumber()) return CompareIC::HEAP_NUMBER;
2388 if (value->IsInternalizedString()) return CompareIC::INTERNALIZED_STRING; 2389 if (value->IsInternalizedString()) return CompareIC::INTERNALIZED_STRING;
2389 if (value->IsString()) return CompareIC::STRING; 2390 if (value->IsString()) return CompareIC::STRING;
2391 if (value->IsSymbol()) return CompareIC::UNIQUE_NAME;
2390 if (value->IsJSObject()) return CompareIC::OBJECT; 2392 if (value->IsJSObject()) return CompareIC::OBJECT;
2391 break; 2393 break;
2392 case CompareIC::SMI: 2394 case CompareIC::SMI:
2393 if (value->IsSmi()) return CompareIC::SMI; 2395 if (value->IsSmi()) return CompareIC::SMI;
2394 if (value->IsHeapNumber()) return CompareIC::HEAP_NUMBER; 2396 if (value->IsHeapNumber()) return CompareIC::HEAP_NUMBER;
2395 break; 2397 break;
2396 case CompareIC::HEAP_NUMBER: 2398 case CompareIC::HEAP_NUMBER:
2397 if (value->IsNumber()) return CompareIC::HEAP_NUMBER; 2399 if (value->IsNumber()) return CompareIC::HEAP_NUMBER;
2398 break; 2400 break;
2399 case CompareIC::INTERNALIZED_STRING: 2401 case CompareIC::INTERNALIZED_STRING:
2400 if (value->IsInternalizedString()) return CompareIC::INTERNALIZED_STRING; 2402 if (value->IsInternalizedString()) return CompareIC::INTERNALIZED_STRING;
2401 if (value->IsString()) return CompareIC::STRING; 2403 if (value->IsString()) return CompareIC::STRING;
2404 if (value->IsSymbol()) return CompareIC::UNIQUE_NAME;
2402 break; 2405 break;
2403 case CompareIC::STRING: 2406 case CompareIC::STRING:
2404 if (value->IsInternalizedString() || value->IsString()) 2407 if (value->IsString()) return CompareIC::STRING;
2405 return CompareIC::STRING; 2408 break;
2409 case CompareIC::UNIQUE_NAME:
2410 if (value->IsUniqueName()) return CompareIC::UNIQUE_NAME;
2406 break; 2411 break;
2407 case CompareIC::OBJECT: 2412 case CompareIC::OBJECT:
2408 if (value->IsJSObject()) return CompareIC::OBJECT; 2413 if (value->IsJSObject()) return CompareIC::OBJECT;
2409 break; 2414 break;
2410 case CompareIC::GENERIC: 2415 case CompareIC::GENERIC:
2411 break; 2416 break;
2412 case CompareIC::KNOWN_OBJECTS: 2417 case CompareIC::KNOWN_OBJECTS:
2413 UNREACHABLE(); 2418 UNREACHABLE();
2414 break; 2419 break;
2415 } 2420 }
(...skipping 19 matching lines...) Expand all
2435 return HEAP_NUMBER; 2440 return HEAP_NUMBER;
2436 } 2441 }
2437 } 2442 }
2438 if (x->IsInternalizedString() && y->IsInternalizedString()) { 2443 if (x->IsInternalizedString() && y->IsInternalizedString()) {
2439 // We compare internalized strings as plain ones if we need to determine 2444 // We compare internalized strings as plain ones if we need to determine
2440 // the order in a non-equality compare. 2445 // the order in a non-equality compare.
2441 return Token::IsEqualityOp(op_) ? INTERNALIZED_STRING : STRING; 2446 return Token::IsEqualityOp(op_) ? INTERNALIZED_STRING : STRING;
2442 } 2447 }
2443 if (x->IsString() && y->IsString()) return STRING; 2448 if (x->IsString() && y->IsString()) return STRING;
2444 if (!Token::IsEqualityOp(op_)) return GENERIC; 2449 if (!Token::IsEqualityOp(op_)) return GENERIC;
2450 if (x->IsUniqueName() && y->IsUniqueName()) return UNIQUE_NAME;
2445 if (x->IsJSObject() && y->IsJSObject()) { 2451 if (x->IsJSObject() && y->IsJSObject()) {
2446 if (Handle<JSObject>::cast(x)->map() == 2452 if (Handle<JSObject>::cast(x)->map() ==
2447 Handle<JSObject>::cast(y)->map() && 2453 Handle<JSObject>::cast(y)->map()) {
2448 Token::IsEqualityOp(op_)) {
2449 return KNOWN_OBJECTS; 2454 return KNOWN_OBJECTS;
2450 } else { 2455 } else {
2451 return OBJECT; 2456 return OBJECT;
2452 } 2457 }
2453 } 2458 }
2454 return GENERIC; 2459 return GENERIC;
2455 case SMI: 2460 case SMI:
2456 return x->IsNumber() && y->IsNumber() 2461 return x->IsNumber() && y->IsNumber() ? HEAP_NUMBER : GENERIC;
2457 ? HEAP_NUMBER
2458 : GENERIC;
2459 case INTERNALIZED_STRING: 2462 case INTERNALIZED_STRING:
2460 ASSERT(Token::IsEqualityOp(op_)); 2463 ASSERT(Token::IsEqualityOp(op_));
2461 return x->IsString() && y->IsString() ? STRING : GENERIC; 2464 if (x->IsString() && y->IsString()) return STRING;
2465 if (x->IsUniqueName() && y->IsUniqueName()) return UNIQUE_NAME;
2466 return GENERIC;
2462 case HEAP_NUMBER: 2467 case HEAP_NUMBER:
2468 // If the failure was due to one side changing from smi to heap number,
2469 // then keep the state (if other changed at the same time, we will get
2470 // a second miss and then go to generic).
2463 if (old_left == SMI && x->IsHeapNumber()) return HEAP_NUMBER; 2471 if (old_left == SMI && x->IsHeapNumber()) return HEAP_NUMBER;
2464 if (old_right == SMI && y->IsHeapNumber()) return HEAP_NUMBER; 2472 if (old_right == SMI && y->IsHeapNumber()) return HEAP_NUMBER;
2465 case STRING: 2473 case STRING:
2474 case UNIQUE_NAME:
2466 case OBJECT: 2475 case OBJECT:
2467 case KNOWN_OBJECTS: 2476 case KNOWN_OBJECTS:
2468 case GENERIC: 2477 case GENERIC:
2469 return GENERIC; 2478 return GENERIC;
2470 } 2479 }
2471 UNREACHABLE(); 2480 UNREACHABLE();
2472 return GENERIC; // Make the compiler happy. 2481 return GENERIC; // Make the compiler happy.
2473 } 2482 }
2474 2483
2475 2484
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 #undef ADDR 2562 #undef ADDR
2554 }; 2563 };
2555 2564
2556 2565
2557 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2566 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2558 return IC_utilities[id]; 2567 return IC_utilities[id];
2559 } 2568 }
2560 2569
2561 2570
2562 } } // namespace v8::internal 2571 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/ic-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698