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

Side by Side Diff: src/ic/ic-state.cc

Issue 1347063004: [ic] Introduce BOOLEAN state for CompareIC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « src/ic/ic-state.h ('k') | src/mips/code-stubs-mips.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ic/ic-state.h" 5 #include "src/ic/ic-state.h"
6 6
7 #include "src/ic/ic.h" 7 #include "src/ic/ic.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 UNREACHABLE(); 352 UNREACHABLE();
353 return NULL; 353 return NULL;
354 } 354 }
355 355
356 356
357 const char* CompareICState::GetStateName(State state) { 357 const char* CompareICState::GetStateName(State state) {
358 switch (state) { 358 switch (state) {
359 case UNINITIALIZED: 359 case UNINITIALIZED:
360 return "UNINITIALIZED"; 360 return "UNINITIALIZED";
361 case BOOLEAN:
362 return "BOOLEAN";
361 case SMI: 363 case SMI:
362 return "SMI"; 364 return "SMI";
363 case NUMBER: 365 case NUMBER:
364 return "NUMBER"; 366 return "NUMBER";
365 case INTERNALIZED_STRING: 367 case INTERNALIZED_STRING:
366 return "INTERNALIZED_STRING"; 368 return "INTERNALIZED_STRING";
367 case STRING: 369 case STRING:
368 return "STRING"; 370 return "STRING";
369 case UNIQUE_NAME: 371 case UNIQUE_NAME:
370 return "UNIQUE_NAME"; 372 return "UNIQUE_NAME";
371 case OBJECT: 373 case OBJECT:
372 return "OBJECT"; 374 return "OBJECT";
373 case KNOWN_OBJECT: 375 case KNOWN_OBJECT:
374 return "KNOWN_OBJECT"; 376 return "KNOWN_OBJECT";
375 case GENERIC: 377 case GENERIC:
376 return "GENERIC"; 378 return "GENERIC";
377 } 379 }
378 UNREACHABLE(); 380 UNREACHABLE();
379 return NULL; 381 return NULL;
380 } 382 }
381 383
382 384
383 Type* CompareICState::StateToType(Zone* zone, State state, Handle<Map> map) { 385 Type* CompareICState::StateToType(Zone* zone, State state, Handle<Map> map) {
384 switch (state) { 386 switch (state) {
385 case UNINITIALIZED: 387 case UNINITIALIZED:
386 return Type::None(zone); 388 return Type::None(zone);
389 case BOOLEAN:
390 return Type::Boolean(zone);
387 case SMI: 391 case SMI:
388 return Type::SignedSmall(zone); 392 return Type::SignedSmall(zone);
389 case NUMBER: 393 case NUMBER:
390 return Type::Number(zone); 394 return Type::Number(zone);
391 case STRING: 395 case STRING:
392 return Type::String(zone); 396 return Type::String(zone);
393 case INTERNALIZED_STRING: 397 case INTERNALIZED_STRING:
394 return Type::InternalizedString(zone); 398 return Type::InternalizedString(zone);
395 case UNIQUE_NAME: 399 case UNIQUE_NAME:
396 return Type::UniqueName(zone); 400 return Type::UniqueName(zone);
397 case OBJECT: 401 case OBJECT:
398 return Type::Receiver(zone); 402 return Type::Receiver(zone);
399 case KNOWN_OBJECT: 403 case KNOWN_OBJECT:
400 return map.is_null() ? Type::Receiver(zone) : Type::Class(map, zone); 404 return map.is_null() ? Type::Receiver(zone) : Type::Class(map, zone);
401 case GENERIC: 405 case GENERIC:
402 return Type::Any(zone); 406 return Type::Any(zone);
403 } 407 }
404 UNREACHABLE(); 408 UNREACHABLE();
405 return NULL; 409 return NULL;
406 } 410 }
407 411
408 412
409 CompareICState::State CompareICState::NewInputState(State old_state, 413 CompareICState::State CompareICState::NewInputState(State old_state,
410 Handle<Object> value) { 414 Handle<Object> value) {
411 switch (old_state) { 415 switch (old_state) {
412 case UNINITIALIZED: 416 case UNINITIALIZED:
417 if (value->IsBoolean()) return BOOLEAN;
413 if (value->IsSmi()) return SMI; 418 if (value->IsSmi()) return SMI;
414 if (value->IsHeapNumber()) return NUMBER; 419 if (value->IsHeapNumber()) return NUMBER;
415 if (value->IsInternalizedString()) return INTERNALIZED_STRING; 420 if (value->IsInternalizedString()) return INTERNALIZED_STRING;
416 if (value->IsString()) return STRING; 421 if (value->IsString()) return STRING;
417 if (value->IsSymbol()) return UNIQUE_NAME; 422 if (value->IsSymbol()) return UNIQUE_NAME;
418 if (value->IsJSObject()) return OBJECT; 423 if (value->IsJSObject()) return OBJECT;
419 break; 424 break;
425 case BOOLEAN:
426 if (value->IsBoolean()) return BOOLEAN;
427 break;
420 case SMI: 428 case SMI:
421 if (value->IsSmi()) return SMI; 429 if (value->IsSmi()) return SMI;
422 if (value->IsHeapNumber()) return NUMBER; 430 if (value->IsHeapNumber()) return NUMBER;
423 break; 431 break;
424 case NUMBER: 432 case NUMBER:
425 if (value->IsNumber()) return NUMBER; 433 if (value->IsNumber()) return NUMBER;
426 break; 434 break;
427 case INTERNALIZED_STRING: 435 case INTERNALIZED_STRING:
428 if (value->IsInternalizedString()) return INTERNALIZED_STRING; 436 if (value->IsInternalizedString()) return INTERNALIZED_STRING;
429 if (value->IsString()) return STRING; 437 if (value->IsString()) return STRING;
(...skipping 17 matching lines...) Expand all
447 return GENERIC; 455 return GENERIC;
448 } 456 }
449 457
450 458
451 // static 459 // static
452 CompareICState::State CompareICState::TargetState( 460 CompareICState::State CompareICState::TargetState(
453 State old_state, State old_left, State old_right, Token::Value op, 461 State old_state, State old_left, State old_right, Token::Value op,
454 bool has_inlined_smi_code, Handle<Object> x, Handle<Object> y) { 462 bool has_inlined_smi_code, Handle<Object> x, Handle<Object> y) {
455 switch (old_state) { 463 switch (old_state) {
456 case UNINITIALIZED: 464 case UNINITIALIZED:
465 if (x->IsBoolean() && y->IsBoolean()) return BOOLEAN;
457 if (x->IsSmi() && y->IsSmi()) return SMI; 466 if (x->IsSmi() && y->IsSmi()) return SMI;
458 if (x->IsNumber() && y->IsNumber()) return NUMBER; 467 if (x->IsNumber() && y->IsNumber()) return NUMBER;
459 if (Token::IsOrderedRelationalCompareOp(op)) { 468 if (Token::IsOrderedRelationalCompareOp(op)) {
460 // Ordered comparisons treat undefined as NaN, so the 469 // Ordered comparisons treat undefined as NaN, so the
461 // NUMBER stub will do the right thing. 470 // NUMBER stub will do the right thing.
462 if ((x->IsNumber() && y->IsUndefined()) || 471 if ((x->IsNumber() && y->IsUndefined()) ||
463 (y->IsNumber() && x->IsUndefined())) { 472 (y->IsNumber() && x->IsUndefined())) {
464 return NUMBER; 473 return NUMBER;
465 } 474 }
466 } 475 }
(...skipping 26 matching lines...) Expand all
493 // then keep the state (if other changed at the same time, we will get 502 // then keep the state (if other changed at the same time, we will get
494 // a second miss and then go to generic). 503 // a second miss and then go to generic).
495 if (old_left == SMI && x->IsHeapNumber()) return NUMBER; 504 if (old_left == SMI && x->IsHeapNumber()) return NUMBER;
496 if (old_right == SMI && y->IsHeapNumber()) return NUMBER; 505 if (old_right == SMI && y->IsHeapNumber()) return NUMBER;
497 return GENERIC; 506 return GENERIC;
498 case KNOWN_OBJECT: 507 case KNOWN_OBJECT:
499 if (x->IsJSObject() && y->IsJSObject()) { 508 if (x->IsJSObject() && y->IsJSObject()) {
500 return Token::IsEqualityOp(op) ? OBJECT : GENERIC; 509 return Token::IsEqualityOp(op) ? OBJECT : GENERIC;
501 } 510 }
502 return GENERIC; 511 return GENERIC;
512 case BOOLEAN:
503 case STRING: 513 case STRING:
504 case UNIQUE_NAME: 514 case UNIQUE_NAME:
505 case OBJECT: 515 case OBJECT:
506 case GENERIC: 516 case GENERIC:
507 return GENERIC; 517 return GENERIC;
508 } 518 }
509 UNREACHABLE(); 519 UNREACHABLE();
510 return GENERIC; // Make the compiler happy. 520 return GENERIC; // Make the compiler happy.
511 } 521 }
522
512 } // namespace internal 523 } // namespace internal
513 } // namespace v8 524 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic-state.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698