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

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: Rebased 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
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() ||
Jakob Kummerow 2013/06/11 17:58:07 nit: I kinda preferred the old indentation here, b
rossberg 2013/06/12 17:21:32 Done. (That actually was an unintended side-effect
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, State state, Handle<Map> map) {
Jakob Kummerow 2013/06/11 17:58:07 nit: one line per argument please
rossberg 2013/06/12 17:21:32 Done, but, seriously? :)
491 if (state.Contains(CompareNilICStub::GENERIC)) {
492 return handle(Type::Any(), isolate);
493 }
494
495 Handle<Type> result(Type::None(), isolate);
496 if (state.Contains(CompareNilICStub::UNDEFINED)) {
497 result = handle(Type::Union(result, handle(Type::Undefined(), isolate)),
498 isolate);
499 }
500 if (state.Contains(CompareNilICStub::NULL_TYPE)) {
501 result = handle(Type::Union(result, handle(Type::Null(), isolate)),
502 isolate);
503 }
504 if (state.Contains(CompareNilICStub::UNDETECTABLE)) {
505 result = handle(Type::Union(result, handle(Type::Undetectable(), isolate)),
506 isolate);
507 } else if (state.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
508 Type* type = map.is_null() ? Type::Detectable() : Type::Class(map);
509 result = handle(Type::Union(result, handle(type, isolate)), isolate);
510 }
511
512 return result;
513 }
514
515
488 void InstanceofStub::PrintName(StringStream* stream) { 516 void InstanceofStub::PrintName(StringStream* stream) {
489 const char* args = ""; 517 const char* args = "";
490 if (HasArgsInRegisters()) { 518 if (HasArgsInRegisters()) {
491 args = "_REGS"; 519 args = "_REGS";
492 } 520 }
493 521
494 const char* inline_check = ""; 522 const char* inline_check = "";
495 if (HasCallSiteInlineCheck()) { 523 if (HasCallSiteInlineCheck()) {
496 inline_check = "_INLINE"; 524 inline_check = "_INLINE";
497 } 525 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 InstallDescriptor(isolate, &stub3); 826 InstallDescriptor(isolate, &stub3);
799 } 827 }
800 828
801 InternalArrayConstructorStub::InternalArrayConstructorStub( 829 InternalArrayConstructorStub::InternalArrayConstructorStub(
802 Isolate* isolate) { 830 Isolate* isolate) {
803 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 831 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
804 } 832 }
805 833
806 834
807 } } // namespace v8::internal 835 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698