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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
411 CompareNilICStub::Types CompareNilICStub::GetPatchedICFlags( | 411 void CompareNilICStub::Record(Handle<Object> object) { |
412 Code::ExtraICState extra_ic_state, | 412 ASSERT(types_ != Types::FullCompare()); |
413 Handle<Object> object, | 413 if (equality_kind_ == kStrictEquality) { |
414 bool* already_monomorphic) { | 414 // When testing for strict equality only one value will evaluate to true |
415 Types types = TypesField::decode(extra_ic_state); | 415 types_.RemoveAll(); |
416 NilValue nil = NilValueField::decode(extra_ic_state); | 416 types_.Add((nil_value_ == kNullValue) ? NULL_TYPE: |
417 EqualityKind kind = EqualityKindField::decode(extra_ic_state); | 417 UNDEFINED); |
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 { | |
425 return CompareNilICStub::kCompareAgainstUndefined; | |
426 } | |
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 |
448 | 435 |
| 436 void CompareNilICStub::PrintName(StringStream* stream) { |
| 437 stream->Add("CompareNilICStub_"); |
| 438 types_.Print(stream); |
| 439 stream->Add((nil_value_ == kNullValue) ? "(NullValue|": |
| 440 "(UndefinedValue|"); |
| 441 stream->Add((equality_kind_ == kStrictEquality) ? "StrictEquality)": |
| 442 "NonStrictEquality)"); |
| 443 } |
| 444 |
| 445 |
| 446 void CompareNilICStub::Types::Print(StringStream* stream) const { |
| 447 stream->Add("("); |
| 448 SimpleListPrinter printer(stream); |
| 449 if (IsEmpty()) printer.Add("None"); |
| 450 if (Contains(UNDEFINED)) printer.Add("Undefined"); |
| 451 if (Contains(NULL_TYPE)) printer.Add("Null"); |
| 452 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap"); |
| 453 if (Contains(UNDETECTABLE)) printer.Add("Undetectable"); |
| 454 stream->Add(")"); |
| 455 } |
| 456 |
| 457 |
449 void InstanceofStub::PrintName(StringStream* stream) { | 458 void InstanceofStub::PrintName(StringStream* stream) { |
450 const char* args = ""; | 459 const char* args = ""; |
451 if (HasArgsInRegisters()) { | 460 if (HasArgsInRegisters()) { |
452 args = "_REGS"; | 461 args = "_REGS"; |
453 } | 462 } |
454 | 463 |
455 const char* inline_check = ""; | 464 const char* inline_check = ""; |
456 if (HasCallSiteInlineCheck()) { | 465 if (HasCallSiteInlineCheck()) { |
457 inline_check = "_INLINE"; | 466 inline_check = "_INLINE"; |
458 } | 467 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 } | 554 } |
546 | 555 |
547 | 556 |
548 void ToBooleanStub::PrintName(StringStream* stream) { | 557 void ToBooleanStub::PrintName(StringStream* stream) { |
549 stream->Add("ToBooleanStub_"); | 558 stream->Add("ToBooleanStub_"); |
550 types_.Print(stream); | 559 types_.Print(stream); |
551 } | 560 } |
552 | 561 |
553 | 562 |
554 void ToBooleanStub::Types::Print(StringStream* stream) const { | 563 void ToBooleanStub::Types::Print(StringStream* stream) const { |
555 if (IsEmpty()) stream->Add("None"); | 564 stream->Add("("); |
556 if (Contains(UNDEFINED)) stream->Add("Undefined"); | 565 SimpleListPrinter printer(stream); |
557 if (Contains(BOOLEAN)) stream->Add("Bool"); | 566 if (IsEmpty()) printer.Add("None"); |
558 if (Contains(NULL_TYPE)) stream->Add("Null"); | 567 if (Contains(UNDEFINED)) printer.Add("Undefined"); |
559 if (Contains(SMI)) stream->Add("Smi"); | 568 if (Contains(BOOLEAN)) printer.Add("Bool"); |
560 if (Contains(SPEC_OBJECT)) stream->Add("SpecObject"); | 569 if (Contains(NULL_TYPE)) printer.Add("Null"); |
561 if (Contains(STRING)) stream->Add("String"); | 570 if (Contains(SMI)) printer.Add("Smi"); |
562 if (Contains(SYMBOL)) stream->Add("Symbol"); | 571 if (Contains(SPEC_OBJECT)) printer.Add("SpecObject"); |
563 if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber"); | 572 if (Contains(STRING)) printer.Add("String"); |
| 573 if (Contains(SYMBOL)) printer.Add("Symbol"); |
| 574 if (Contains(HEAP_NUMBER)) printer.Add("HeapNumber"); |
| 575 stream->Add(")"); |
564 } | 576 } |
565 | 577 |
566 | 578 |
567 void ToBooleanStub::Types::TraceTransition(Types to) const { | 579 void ToBooleanStub::Types::TraceTransition(Types to) const { |
568 if (!FLAG_trace_ic) return; | 580 if (!FLAG_trace_ic) return; |
569 char buffer[100]; | 581 char buffer[100]; |
570 NoAllocationStringAllocator allocator(buffer, | 582 NoAllocationStringAllocator allocator(buffer, |
571 static_cast<unsigned>(sizeof(buffer))); | 583 static_cast<unsigned>(sizeof(buffer))); |
572 StringStream stream(&allocator); | 584 StringStream stream(&allocator); |
573 stream.Add("[ToBooleanIC ("); | 585 stream.Add("[ToBooleanIC ("); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } else if (argument_count >= 2) { | 743 } else if (argument_count >= 2) { |
732 argument_count_ = MORE_THAN_ONE; | 744 argument_count_ = MORE_THAN_ONE; |
733 } else { | 745 } else { |
734 UNREACHABLE(); | 746 UNREACHABLE(); |
735 } | 747 } |
736 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 748 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
737 } | 749 } |
738 | 750 |
739 | 751 |
740 } } // namespace v8::internal | 752 } } // namespace v8::internal |
OLD | NEW |