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

Side by Side Diff: src/code-stubs.cc

Issue 16361015: Migrate Compare ICs to new type rep (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years, 6 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/code-stubs.h ('k') | src/code-stubs-hydrogen.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 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 GenerateKnownObjects(masm); 424 GenerateKnownObjects(masm);
425 break; 425 break;
426 case CompareIC::GENERIC: 426 case CompareIC::GENERIC:
427 GenerateGeneric(masm); 427 GenerateGeneric(masm);
428 break; 428 break;
429 } 429 }
430 } 430 }
431 431
432 432
433 void CompareNilICStub::Record(Handle<Object> object) { 433 void CompareNilICStub::Record(Handle<Object> object) {
434 ASSERT(types_ != Types::FullCompare()); 434 ASSERT(state_ != State::Generic());
435 if (object->IsNull()) { 435 if (object->IsNull()) {
436 types_.Add(NULL_TYPE); 436 state_.Add(NULL_TYPE);
437 } else if (object->IsUndefined()) { 437 } else if (object->IsUndefined()) {
438 types_.Add(UNDEFINED); 438 state_.Add(UNDEFINED);
439 } else if (object->IsUndetectableObject() || 439 } else if (object->IsUndetectableObject() ||
440 object->IsOddball() || 440 object->IsOddball() ||
441 !object->IsHeapObject()) { 441 !object->IsHeapObject()) {
442 types_ = Types::FullCompare(); 442 state_ = State::Generic();
443 } else if (IsMonomorphic()) { 443 } else if (IsMonomorphic()) {
444 types_ = Types::FullCompare(); 444 state_ = State::Generic();
445 } else { 445 } else {
446 types_.Add(MONOMORPHIC_MAP); 446 state_.Add(MONOMORPHIC_MAP);
447 } 447 }
448 } 448 }
449 449
450 450
451 void CompareNilICStub::Types::TraceTransition(Types to) const { 451 void CompareNilICStub::State::TraceTransition(State to) const {
452 #ifdef DEBUG 452 #ifdef DEBUG
453 if (!FLAG_trace_ic) return; 453 if (!FLAG_trace_ic) return;
454 char buffer[100]; 454 char buffer[100];
455 NoAllocationStringAllocator allocator(buffer, 455 NoAllocationStringAllocator allocator(buffer,
456 static_cast<unsigned>(sizeof(buffer))); 456 static_cast<unsigned>(sizeof(buffer)));
457 StringStream stream(&allocator); 457 StringStream stream(&allocator);
458 stream.Add("[CompareNilIC : "); 458 stream.Add("[CompareNilIC : ");
459 Print(&stream); 459 Print(&stream);
460 stream.Add("=>"); 460 stream.Add("=>");
461 to.Print(&stream); 461 to.Print(&stream);
462 stream.Add("]\n"); 462 stream.Add("]\n");
463 stream.OutputToStdOut(); 463 stream.OutputToStdOut();
464 #endif 464 #endif
465 } 465 }
466 466
467 467
468 void CompareNilICStub::PrintName(StringStream* stream) { 468 void CompareNilICStub::PrintName(StringStream* stream) {
469 stream->Add("CompareNilICStub_"); 469 stream->Add("CompareNilICStub_");
470 types_.Print(stream); 470 state_.Print(stream);
471 stream->Add((nil_value_ == kNullValue) ? "(NullValue|": 471 stream->Add((nil_value_ == kNullValue) ? "(NullValue|":
472 "(UndefinedValue|"); 472 "(UndefinedValue|");
473 } 473 }
474 474
475 475
476 void CompareNilICStub::Types::Print(StringStream* stream) const { 476 void CompareNilICStub::State::Print(StringStream* stream) const {
477 stream->Add("("); 477 stream->Add("(");
478 SimpleListPrinter printer(stream); 478 SimpleListPrinter printer(stream);
479 if (IsEmpty()) printer.Add("None"); 479 if (IsEmpty()) printer.Add("None");
480 if (Contains(UNDEFINED)) printer.Add("Undefined"); 480 if (Contains(UNDEFINED)) printer.Add("Undefined");
481 if (Contains(NULL_TYPE)) printer.Add("Null"); 481 if (Contains(NULL_TYPE)) printer.Add("Null");
482 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap"); 482 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap");
483 if (Contains(UNDETECTABLE)) printer.Add("Undetectable"); 483 if (Contains(UNDETECTABLE)) printer.Add("Undetectable");
484 if (Contains(GENERIC)) printer.Add("Generic");
484 stream->Add(")"); 485 stream->Add(")");
485 } 486 }
486 487
487 488
489 Handle<Type> CompareNilICStub::StateToType(
490 Isolate* isolate,
491 State state,
492 Handle<Map> map) {
493 if (state.Contains(CompareNilICStub::GENERIC)) {
494 return handle(Type::Any(), isolate);
495 }
496
497 Handle<Type> result(Type::None(), isolate);
498 if (state.Contains(CompareNilICStub::UNDEFINED)) {
499 result = handle(Type::Union(result, handle(Type::Undefined(), isolate)),
500 isolate);
501 }
502 if (state.Contains(CompareNilICStub::NULL_TYPE)) {
503 result = handle(Type::Union(result, handle(Type::Null(), isolate)),
504 isolate);
505 }
506 if (state.Contains(CompareNilICStub::UNDETECTABLE)) {
507 result = handle(Type::Union(result, handle(Type::Undetectable(), isolate)),
508 isolate);
509 } else if (state.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
510 Type* type = map.is_null() ? Type::Detectable() : Type::Class(map);
511 result = handle(Type::Union(result, handle(type, isolate)), isolate);
512 }
513
514 return result;
515 }
516
517
488 void InstanceofStub::PrintName(StringStream* stream) { 518 void InstanceofStub::PrintName(StringStream* stream) {
489 const char* args = ""; 519 const char* args = "";
490 if (HasArgsInRegisters()) { 520 if (HasArgsInRegisters()) {
491 args = "_REGS"; 521 args = "_REGS";
492 } 522 }
493 523
494 const char* inline_check = ""; 524 const char* inline_check = "";
495 if (HasCallSiteInlineCheck()) { 525 if (HasCallSiteInlineCheck()) {
496 inline_check = "_INLINE"; 526 inline_check = "_INLINE";
497 } 527 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 InstallDescriptor(isolate, &stub3); 828 InstallDescriptor(isolate, &stub3);
799 } 829 }
800 830
801 InternalArrayConstructorStub::InternalArrayConstructorStub( 831 InternalArrayConstructorStub::InternalArrayConstructorStub(
802 Isolate* isolate) { 832 Isolate* isolate) {
803 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 833 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
804 } 834 }
805 835
806 836
807 } } // namespace v8::internal 837 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698