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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 case CompareIC::KNOWN_OBJECT: | 400 case CompareIC::KNOWN_OBJECT: |
| 401 ASSERT(*known_map_ != NULL); | 401 ASSERT(*known_map_ != NULL); |
| 402 GenerateKnownObjects(masm); | 402 GenerateKnownObjects(masm); |
| 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 void CompareNilICStub::Record(Handle<Object> object) { |
| 411 CompareNilICStub::Types CompareNilICStub::GetPatchedICFlags( | 411 ASSERT(!types_.IsFullCompare()); |
| 412 Code::ExtraICState extra_ic_state, | 412 if (equality_kind_ == kStrictEquality) { |
| 413 Handle<Object> object, | 413 if (nil_value_ == kNullValue) { |
|
Sven Panne
2013/05/14 09:18:42
Use a ternary. More importantly: Why do we *set* t
| |
| 414 bool* already_monomorphic) { | 414 types_.SetTo(NULL_TYPE); |
| 415 Types types = TypesField::decode(extra_ic_state); | |
| 416 NilValue nil = NilValueField::decode(extra_ic_state); | |
| 417 EqualityKind kind = EqualityKindField::decode(extra_ic_state); | |
| 418 ASSERT(types != CompareNilICStub::kFullCompare); | |
| 419 *already_monomorphic = | |
| 420 (types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0; | |
| 421 if (kind == kStrictEquality) { | |
| 422 if (nil == kNullValue) { | |
| 423 return CompareNilICStub::kCompareAgainstNull; | |
| 424 } else { | 415 } else { |
| 425 return CompareNilICStub::kCompareAgainstUndefined; | 416 types_.SetTo(UNDEFINED); |
| 426 } | 417 } |
| 427 } else { | 418 } else { |
| 428 if (object->IsNull()) { | 419 if (object->IsNull()) { |
| 429 types = static_cast<CompareNilICStub::Types>( | 420 types_.Add(NULL_TYPE); |
| 430 types | CompareNilICStub::kCompareAgainstNull); | |
| 431 } else if (object->IsUndefined()) { | 421 } else if (object->IsUndefined()) { |
| 432 types = static_cast<CompareNilICStub::Types>( | 422 types_.Add(UNDEFINED); |
| 433 types | CompareNilICStub::kCompareAgainstUndefined); | |
| 434 } else if (object->IsUndetectableObject() || | 423 } else if (object->IsUndetectableObject() || |
| 435 object->IsOddball() || | 424 object->IsOddball() || |
| 436 !object->IsHeapObject()) { | 425 !object->IsHeapObject()) { |
| 437 types = CompareNilICStub::kFullCompare; | 426 types_ = Types::FullCompare(); |
| 438 } else if ((types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0) { | 427 } else if (IsMonomorphic()) { |
| 439 types = CompareNilICStub::kFullCompare; | 428 types_ = Types::FullCompare(); |
| 440 } else { | 429 } else { |
| 441 types = static_cast<CompareNilICStub::Types>( | 430 types_.Add(MONOMORPHIC_MAP); |
| 442 types | CompareNilICStub::kCompareAgainstMonomorphicMap); | |
| 443 } | 431 } |
| 444 } | 432 } |
| 445 return types; | |
| 446 } | 433 } |
| 447 | 434 |
| 435 void CompareNilICStub::Types::SetTo(Type type) { | |
| 436 RemoveAll(); | |
| 437 Add(type); | |
| 438 } | |
| 439 | |
| 440 void CompareNilICStub::PrintName(StringStream* stream) { | |
| 441 stream->Add("CompareNilICStub_"); | |
| 442 types_.Print(stream); | |
| 443 if (nil_value_ == kNullValue) { | |
|
Sven Panne
2013/05/14 09:18:42
Use a ternary ?: here...
| |
| 444 stream->Add("(NullValue|"); | |
| 445 } else { | |
| 446 stream->Add("(UndefinedValue|"); | |
| 447 } | |
| 448 if (equality_kind_ == kStrictEquality) { | |
|
Sven Panne
2013/05/14 09:18:42
... and here, and merge the stream->Add() calls. M
| |
| 449 stream->Add("StrictEquality)"); | |
| 450 } else { | |
| 451 stream->Add("NonStrictEquality)"); | |
| 452 } | |
| 453 } | |
| 454 | |
| 455 void CompareNilICStub::Types::Print(StringStream* stream) const { | |
| 456 stream->Add("("); | |
| 457 if (IsEmpty()) stream->Add("None,"); | |
| 458 if (Contains(UNDEFINED)) stream->Add("Undefined,"); | |
| 459 if (Contains(NULL_TYPE)) stream->Add("Null,"); | |
| 460 if (Contains(MONOMORPHIC_MAP)) stream->Add("MonomorphicMap,"); | |
| 461 if (Contains(UNDETECTABLE)) stream->Add("Undetectable,"); | |
| 462 stream->Remove(1); | |
|
Sven Panne
2013/05/14 09:18:42
Although it looks like a cunning idea at first, re
oliv
2013/05/14 13:28:11
ok, ic
| |
| 463 stream->Add(")"); | |
| 464 } | |
| 448 | 465 |
| 449 void InstanceofStub::PrintName(StringStream* stream) { | 466 void InstanceofStub::PrintName(StringStream* stream) { |
| 450 const char* args = ""; | 467 const char* args = ""; |
| 451 if (HasArgsInRegisters()) { | 468 if (HasArgsInRegisters()) { |
| 452 args = "_REGS"; | 469 args = "_REGS"; |
| 453 } | 470 } |
| 454 | 471 |
| 455 const char* inline_check = ""; | 472 const char* inline_check = ""; |
| 456 if (HasCallSiteInlineCheck()) { | 473 if (HasCallSiteInlineCheck()) { |
| 457 inline_check = "_INLINE"; | 474 inline_check = "_INLINE"; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 } | 562 } |
| 546 | 563 |
| 547 | 564 |
| 548 void ToBooleanStub::PrintName(StringStream* stream) { | 565 void ToBooleanStub::PrintName(StringStream* stream) { |
| 549 stream->Add("ToBooleanStub_"); | 566 stream->Add("ToBooleanStub_"); |
| 550 types_.Print(stream); | 567 types_.Print(stream); |
| 551 } | 568 } |
| 552 | 569 |
| 553 | 570 |
| 554 void ToBooleanStub::Types::Print(StringStream* stream) const { | 571 void ToBooleanStub::Types::Print(StringStream* stream) const { |
| 555 if (IsEmpty()) stream->Add("None"); | 572 stream->Add("("); |
| 556 if (Contains(UNDEFINED)) stream->Add("Undefined"); | 573 if (IsEmpty()) stream->Add("None,"); |
| 557 if (Contains(BOOLEAN)) stream->Add("Bool"); | 574 if (Contains(UNDEFINED)) stream->Add("Undefined,"); |
| 558 if (Contains(NULL_TYPE)) stream->Add("Null"); | 575 if (Contains(BOOLEAN)) stream->Add("Bool,"); |
| 559 if (Contains(SMI)) stream->Add("Smi"); | 576 if (Contains(NULL_TYPE)) stream->Add("Null,"); |
| 560 if (Contains(SPEC_OBJECT)) stream->Add("SpecObject"); | 577 if (Contains(SMI)) stream->Add("Smi,"); |
| 561 if (Contains(STRING)) stream->Add("String"); | 578 if (Contains(SPEC_OBJECT)) stream->Add("SpecObject,"); |
| 562 if (Contains(SYMBOL)) stream->Add("Symbol"); | 579 if (Contains(STRING)) stream->Add("String,"); |
| 563 if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber"); | 580 if (Contains(SYMBOL)) stream->Add("Symbol,"); |
| 581 if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber,"); | |
| 582 stream->Remove(1); | |
|
Sven Panne
2013/05/14 09:18:42
Same comment as in the other Print() function.
| |
| 583 stream->Add(")"); | |
| 564 } | 584 } |
| 565 | 585 |
| 566 | 586 |
| 567 void ToBooleanStub::Types::TraceTransition(Types to) const { | 587 void ToBooleanStub::Types::TraceTransition(Types to) const { |
| 568 if (!FLAG_trace_ic) return; | 588 if (!FLAG_trace_ic) return; |
| 569 char buffer[100]; | 589 char buffer[100]; |
| 570 NoAllocationStringAllocator allocator(buffer, | 590 NoAllocationStringAllocator allocator(buffer, |
| 571 static_cast<unsigned>(sizeof(buffer))); | 591 static_cast<unsigned>(sizeof(buffer))); |
| 572 StringStream stream(&allocator); | 592 StringStream stream(&allocator); |
| 573 stream.Add("[ToBooleanIC ("); | 593 stream.Add("[ToBooleanIC ("); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 731 } else if (argument_count >= 2) { | 751 } else if (argument_count >= 2) { |
| 732 argument_count_ = MORE_THAN_ONE; | 752 argument_count_ = MORE_THAN_ONE; |
| 733 } else { | 753 } else { |
| 734 UNREACHABLE(); | 754 UNREACHABLE(); |
| 735 } | 755 } |
| 736 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 756 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 737 } | 757 } |
| 738 | 758 |
| 739 | 759 |
| 740 } } // namespace v8::internal | 760 } } // namespace v8::internal |
| OLD | NEW |