OLD | NEW |
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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(types_ != Types::FullCompare()); |
435 if (equality_kind_ == kStrictEquality) { | 435 if (object->IsNull()) { |
436 // When testing for strict equality only one value will evaluate to true | 436 types_.Add(NULL_TYPE); |
437 types_.RemoveAll(); | 437 } else if (object->IsUndefined()) { |
438 types_.Add((nil_value_ == kNullValue) ? NULL_TYPE: | 438 types_.Add(UNDEFINED); |
439 UNDEFINED); | 439 } else if (object->IsUndetectableObject() || |
| 440 object->IsOddball() || |
| 441 !object->IsHeapObject()) { |
| 442 types_ = Types::FullCompare(); |
| 443 } else if (IsMonomorphic()) { |
| 444 types_ = Types::FullCompare(); |
440 } else { | 445 } else { |
441 if (object->IsNull()) { | 446 types_.Add(MONOMORPHIC_MAP); |
442 types_.Add(NULL_TYPE); | |
443 } else if (object->IsUndefined()) { | |
444 types_.Add(UNDEFINED); | |
445 } else if (object->IsUndetectableObject() || | |
446 object->IsOddball() || | |
447 !object->IsHeapObject()) { | |
448 types_ = Types::FullCompare(); | |
449 } else if (IsMonomorphic()) { | |
450 types_ = Types::FullCompare(); | |
451 } else { | |
452 types_.Add(MONOMORPHIC_MAP); | |
453 } | |
454 } | 447 } |
455 } | 448 } |
456 | 449 |
457 | 450 |
458 void CompareNilICStub::Types::TraceTransition(Types to) const { | 451 void CompareNilICStub::Types::TraceTransition(Types to) const { |
459 #ifdef DEBUG | 452 #ifdef DEBUG |
460 if (!FLAG_trace_ic) return; | 453 if (!FLAG_trace_ic) return; |
461 char buffer[100]; | 454 char buffer[100]; |
462 NoAllocationStringAllocator allocator(buffer, | 455 NoAllocationStringAllocator allocator(buffer, |
463 static_cast<unsigned>(sizeof(buffer))); | 456 static_cast<unsigned>(sizeof(buffer))); |
464 StringStream stream(&allocator); | 457 StringStream stream(&allocator); |
465 stream.Add("[CompareNilIC : "); | 458 stream.Add("[CompareNilIC : "); |
466 Print(&stream); | 459 Print(&stream); |
467 stream.Add("=>"); | 460 stream.Add("=>"); |
468 to.Print(&stream); | 461 to.Print(&stream); |
469 stream.Add("]\n"); | 462 stream.Add("]\n"); |
470 stream.OutputToStdOut(); | 463 stream.OutputToStdOut(); |
471 #endif | 464 #endif |
472 } | 465 } |
473 | 466 |
474 | 467 |
475 void CompareNilICStub::PrintName(StringStream* stream) { | 468 void CompareNilICStub::PrintName(StringStream* stream) { |
476 stream->Add("CompareNilICStub_"); | 469 stream->Add("CompareNilICStub_"); |
477 types_.Print(stream); | 470 types_.Print(stream); |
478 stream->Add((nil_value_ == kNullValue) ? "(NullValue|": | 471 stream->Add((nil_value_ == kNullValue) ? "(NullValue|": |
479 "(UndefinedValue|"); | 472 "(UndefinedValue|"); |
480 stream->Add((equality_kind_ == kStrictEquality) ? "StrictEquality)": | |
481 "NonStrictEquality)"); | |
482 } | 473 } |
483 | 474 |
484 | 475 |
485 void CompareNilICStub::Types::Print(StringStream* stream) const { | 476 void CompareNilICStub::Types::Print(StringStream* stream) const { |
486 stream->Add("("); | 477 stream->Add("("); |
487 SimpleListPrinter printer(stream); | 478 SimpleListPrinter printer(stream); |
488 if (IsEmpty()) printer.Add("None"); | 479 if (IsEmpty()) printer.Add("None"); |
489 if (Contains(UNDEFINED)) printer.Add("Undefined"); | 480 if (Contains(UNDEFINED)) printer.Add("Undefined"); |
490 if (Contains(NULL_TYPE)) printer.Add("Null"); | 481 if (Contains(NULL_TYPE)) printer.Add("Null"); |
491 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap"); | 482 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap"); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 InstallDescriptor(isolate, &stub3); | 798 InstallDescriptor(isolate, &stub3); |
808 } | 799 } |
809 | 800 |
810 InternalArrayConstructorStub::InternalArrayConstructorStub( | 801 InternalArrayConstructorStub::InternalArrayConstructorStub( |
811 Isolate* isolate) { | 802 Isolate* isolate) { |
812 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 803 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
813 } | 804 } |
814 | 805 |
815 | 806 |
816 } } // namespace v8::internal | 807 } } // namespace v8::internal |
OLD | NEW |