| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 GenerateKnownObjects(masm); | 527 GenerateKnownObjects(masm); |
| 528 break; | 528 break; |
| 529 case CompareIC::GENERIC: | 529 case CompareIC::GENERIC: |
| 530 GenerateGeneric(masm); | 530 GenerateGeneric(masm); |
| 531 break; | 531 break; |
| 532 } | 532 } |
| 533 } | 533 } |
| 534 | 534 |
| 535 | 535 |
| 536 void CompareNilICStub::UpdateStatus(Handle<Object> object) { | 536 void CompareNilICStub::UpdateStatus(Handle<Object> object) { |
| 537 ASSERT(state_ != State::Generic()); | 537 ASSERT(!state_.Contains(GENERIC)); |
| 538 State old_state(state_); | 538 State old_state(state_); |
| 539 if (object->IsNull()) { | 539 if (object->IsNull()) { |
| 540 state_.Add(NULL_TYPE); | 540 state_.Add(NULL_TYPE); |
| 541 } else if (object->IsUndefined()) { | 541 } else if (object->IsUndefined()) { |
| 542 state_.Add(UNDEFINED); | 542 state_.Add(UNDEFINED); |
| 543 } else if (object->IsUndetectableObject() || | 543 } else if (object->IsUndetectableObject() || |
| 544 object->IsOddball() || | 544 object->IsOddball() || |
| 545 !object->IsHeapObject()) { | 545 !object->IsHeapObject()) { |
| 546 state_ = State::Generic(); | 546 state_.RemoveAll(); |
| 547 state_.Add(GENERIC); |
| 547 } else if (IsMonomorphic()) { | 548 } else if (IsMonomorphic()) { |
| 548 state_ = State::Generic(); | 549 state_.RemoveAll(); |
| 550 state_.Add(GENERIC); |
| 549 } else { | 551 } else { |
| 550 state_.Add(MONOMORPHIC_MAP); | 552 state_.Add(MONOMORPHIC_MAP); |
| 551 } | 553 } |
| 552 TraceTransition(old_state, state_); | 554 TraceTransition(old_state, state_); |
| 553 } | 555 } |
| 554 | 556 |
| 555 | 557 |
| 556 template<class StateType> | 558 template<class StateType> |
| 557 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { | 559 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { |
| 558 #ifdef DEBUG | 560 #ifdef DEBUG |
| (...skipping 26 matching lines...) Expand all Loading... |
| 585 } | 587 } |
| 586 | 588 |
| 587 | 589 |
| 588 void CompareNilICStub::State::Print(StringStream* stream) const { | 590 void CompareNilICStub::State::Print(StringStream* stream) const { |
| 589 stream->Add("("); | 591 stream->Add("("); |
| 590 SimpleListPrinter printer(stream); | 592 SimpleListPrinter printer(stream); |
| 591 if (IsEmpty()) printer.Add("None"); | 593 if (IsEmpty()) printer.Add("None"); |
| 592 if (Contains(UNDEFINED)) printer.Add("Undefined"); | 594 if (Contains(UNDEFINED)) printer.Add("Undefined"); |
| 593 if (Contains(NULL_TYPE)) printer.Add("Null"); | 595 if (Contains(NULL_TYPE)) printer.Add("Null"); |
| 594 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap"); | 596 if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap"); |
| 595 if (Contains(UNDETECTABLE)) printer.Add("Undetectable"); | |
| 596 if (Contains(GENERIC)) printer.Add("Generic"); | 597 if (Contains(GENERIC)) printer.Add("Generic"); |
| 597 stream->Add(")"); | 598 stream->Add(")"); |
| 598 } | 599 } |
| 599 | 600 |
| 600 | 601 |
| 601 Handle<Type> CompareNilICStub::StateToType( | 602 Handle<Type> CompareNilICStub::GetType( |
| 602 Isolate* isolate, | 603 Isolate* isolate, |
| 603 State state, | |
| 604 Handle<Map> map) { | 604 Handle<Map> map) { |
| 605 if (state.Contains(CompareNilICStub::GENERIC)) { | 605 if (state_.Contains(CompareNilICStub::GENERIC)) { |
| 606 return handle(Type::Any(), isolate); | 606 return handle(Type::Any(), isolate); |
| 607 } | 607 } |
| 608 | 608 |
| 609 Handle<Type> result(Type::None(), isolate); | 609 Handle<Type> result(Type::None(), isolate); |
| 610 if (state.Contains(CompareNilICStub::UNDEFINED)) { | 610 if (state_.Contains(CompareNilICStub::UNDEFINED)) { |
| 611 result = handle(Type::Union(result, handle(Type::Undefined(), isolate)), | 611 result = handle(Type::Union(result, handle(Type::Undefined(), isolate)), |
| 612 isolate); | 612 isolate); |
| 613 } | 613 } |
| 614 if (state.Contains(CompareNilICStub::NULL_TYPE)) { | 614 if (state_.Contains(CompareNilICStub::NULL_TYPE)) { |
| 615 result = handle(Type::Union(result, handle(Type::Null(), isolate)), | 615 result = handle(Type::Union(result, handle(Type::Null(), isolate)), |
| 616 isolate); | 616 isolate); |
| 617 } | 617 } |
| 618 if (state.Contains(CompareNilICStub::UNDETECTABLE)) { | 618 if (state_.Contains(CompareNilICStub::MONOMORPHIC_MAP)) { |
| 619 result = handle(Type::Union(result, handle(Type::Undetectable(), isolate)), | |
| 620 isolate); | |
| 621 } else if (state.Contains(CompareNilICStub::MONOMORPHIC_MAP)) { | |
| 622 Type* type = map.is_null() ? Type::Detectable() : Type::Class(map); | 619 Type* type = map.is_null() ? Type::Detectable() : Type::Class(map); |
| 623 result = handle(Type::Union(result, handle(type, isolate)), isolate); | 620 result = handle(Type::Union(result, handle(type, isolate)), isolate); |
| 624 } | 621 } |
| 625 | 622 |
| 626 return result; | 623 return result; |
| 627 } | 624 } |
| 628 | 625 |
| 629 | 626 |
| 627 Handle<Type> CompareNilICStub::GetInputType( |
| 628 Isolate* isolate, |
| 629 Handle<Map> map) { |
| 630 Handle<Type> output_type = GetType(isolate, map); |
| 631 Handle<Type> nil_type = handle(nil_value_ == kNullValue |
| 632 ? Type::Null() : Type::Undefined(), isolate); |
| 633 return handle(Type::Union(output_type, nil_type), isolate); |
| 634 } |
| 635 |
| 636 |
| 630 void InstanceofStub::PrintName(StringStream* stream) { | 637 void InstanceofStub::PrintName(StringStream* stream) { |
| 631 const char* args = ""; | 638 const char* args = ""; |
| 632 if (HasArgsInRegisters()) { | 639 if (HasArgsInRegisters()) { |
| 633 args = "_REGS"; | 640 args = "_REGS"; |
| 634 } | 641 } |
| 635 | 642 |
| 636 const char* inline_check = ""; | 643 const char* inline_check = ""; |
| 637 if (HasCallSiteInlineCheck()) { | 644 if (HasCallSiteInlineCheck()) { |
| 638 inline_check = "_INLINE"; | 645 inline_check = "_INLINE"; |
| 639 } | 646 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 InstallDescriptor(isolate, &stub3); | 922 InstallDescriptor(isolate, &stub3); |
| 916 } | 923 } |
| 917 | 924 |
| 918 InternalArrayConstructorStub::InternalArrayConstructorStub( | 925 InternalArrayConstructorStub::InternalArrayConstructorStub( |
| 919 Isolate* isolate) { | 926 Isolate* isolate) { |
| 920 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 927 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 921 } | 928 } |
| 922 | 929 |
| 923 | 930 |
| 924 } } // namespace v8::internal | 931 } } // namespace v8::internal |
| OLD | NEW |