Chromium Code Reviews| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 break; | 403 break; |
| 404 case CompareIC::GENERIC: | 404 case CompareIC::GENERIC: |
| 405 GenerateGeneric(masm); | 405 GenerateGeneric(masm); |
| 406 break; | 406 break; |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 | 409 |
| 410 | 410 |
| 411 void CompareNilICStub::Record(Handle<Object> object) { | 411 void CompareNilICStub::Record(Handle<Object> object) { |
| 412 ASSERT(types_ != Types::FullCompare()); | 412 ASSERT(types_ != Types::FullCompare()); |
| 413 Types old_types(types_); | |
| 413 if (equality_kind_ == kStrictEquality) { | 414 if (equality_kind_ == kStrictEquality) { |
| 414 // When testing for strict equality only one value will evaluate to true | 415 // When testing for strict equality only one value will evaluate to true |
| 415 types_.RemoveAll(); | 416 types_.RemoveAll(); |
| 416 types_.Add((nil_value_ == kNullValue) ? NULL_TYPE: | 417 types_.Add((nil_value_ == kNullValue) ? NULL_TYPE: |
| 417 UNDEFINED); | 418 UNDEFINED); |
| 418 } else { | 419 } else { |
| 419 if (object->IsNull()) { | 420 if (object->IsNull()) { |
| 420 types_.Add(NULL_TYPE); | 421 types_.Add(NULL_TYPE); |
| 421 } else if (object->IsUndefined()) { | 422 } else if (object->IsUndefined()) { |
| 422 types_.Add(UNDEFINED); | 423 types_.Add(UNDEFINED); |
| 423 } else if (object->IsUndetectableObject() || | 424 } else if (object->IsUndetectableObject() || |
| 424 object->IsOddball() || | 425 object->IsOddball() || |
| 425 !object->IsHeapObject()) { | 426 !object->IsHeapObject()) { |
| 426 types_ = Types::FullCompare(); | 427 types_ = Types::FullCompare(); |
| 427 } else if (IsMonomorphic()) { | 428 } else if (IsMonomorphic()) { |
| 428 types_ = Types::FullCompare(); | 429 types_ = Types::FullCompare(); |
| 429 } else { | 430 } else { |
| 430 types_.Add(MONOMORPHIC_MAP); | 431 types_.Add(MONOMORPHIC_MAP); |
| 431 } | 432 } |
| 432 } | 433 } |
| 434 old_types.TraceTransition(types_); | |
|
Sven Panne
2013/05/24 09:02:44
For consistency, call the tracing in CompareNilIC:
| |
| 433 } | 435 } |
| 434 | 436 |
| 435 | 437 |
| 438 void CompareNilICStub::Types::TraceTransition(Types to) const { | |
| 439 if (!FLAG_trace_ic) return; | |
| 440 char buffer[100]; | |
| 441 NoAllocationStringAllocator allocator(buffer, | |
| 442 static_cast<unsigned>(sizeof(buffer))); | |
| 443 StringStream stream(&allocator); | |
| 444 stream.Add("[CompareNilIC ("); | |
|
Sven Panne
2013/05/24 09:02:44
Nit: To make things gradually more consistent, rem
| |
| 445 Print(&stream); | |
| 446 stream.Add("->"); | |
| 447 to.Print(&stream); | |
| 448 stream.Add(")]\n"); | |
| 449 stream.OutputToStdOut(); | |
| 450 } | |
| 451 | |
| 452 | |
| 436 void CompareNilICStub::PrintName(StringStream* stream) { | 453 void CompareNilICStub::PrintName(StringStream* stream) { |
| 437 stream->Add("CompareNilICStub_"); | 454 stream->Add("CompareNilICStub_"); |
| 438 types_.Print(stream); | 455 types_.Print(stream); |
| 439 stream->Add((nil_value_ == kNullValue) ? "(NullValue|": | 456 stream->Add((nil_value_ == kNullValue) ? "(NullValue|": |
| 440 "(UndefinedValue|"); | 457 "(UndefinedValue|"); |
| 441 stream->Add((equality_kind_ == kStrictEquality) ? "StrictEquality)": | 458 stream->Add((equality_kind_ == kStrictEquality) ? "StrictEquality)": |
| 442 "NonStrictEquality)"); | 459 "NonStrictEquality)"); |
| 443 } | 460 } |
| 444 | 461 |
| 445 | 462 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 } else if (argument_count >= 2) { | 760 } else if (argument_count >= 2) { |
| 744 argument_count_ = MORE_THAN_ONE; | 761 argument_count_ = MORE_THAN_ONE; |
| 745 } else { | 762 } else { |
| 746 UNREACHABLE(); | 763 UNREACHABLE(); |
| 747 } | 764 } |
| 748 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 765 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 749 } | 766 } |
| 750 | 767 |
| 751 | 768 |
| 752 } } // namespace v8::internal | 769 } } // namespace v8::internal |
| OLD | NEW |