OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 | 579 |
580 void JSEntryStub::FinishCode(Handle<Code> code) { | 580 void JSEntryStub::FinishCode(Handle<Code> code) { |
581 Handle<FixedArray> handler_table = | 581 Handle<FixedArray> handler_table = |
582 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); | 582 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); |
583 handler_table->set(0, Smi::FromInt(handler_offset_)); | 583 handler_table->set(0, Smi::FromInt(handler_offset_)); |
584 code->set_handler_table(*handler_table); | 584 code->set_handler_table(*handler_table); |
585 } | 585 } |
586 | 586 |
587 | 587 |
588 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( | 588 void LoadFastElementStub::InitializeInterfaceDescriptor( |
589 CodeStubInterfaceDescriptor* descriptor) { | 589 CodeStubInterfaceDescriptor* descriptor) { |
590 Register registers[] = { InterfaceDescriptor::ContextRegister(), | 590 Register registers[] = { InterfaceDescriptor::ContextRegister(), |
591 LoadIC::ReceiverRegister(), | 591 LoadIC::ReceiverRegister(), |
592 LoadIC::NameRegister() }; | 592 LoadIC::NameRegister() }; |
593 STATIC_ASSERT(LoadIC::kParameterCount == 2); | 593 STATIC_ASSERT(LoadIC::kParameterCount == 2); |
594 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 594 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
595 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure)); | 595 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure)); |
596 } | 596 } |
597 | 597 |
598 | 598 |
599 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( | 599 void LoadDictionaryElementStub::InitializeInterfaceDescriptor( |
600 CodeStubInterfaceDescriptor* descriptor) { | 600 CodeStubInterfaceDescriptor* descriptor) { |
601 Register registers[] = { InterfaceDescriptor::ContextRegister(), | 601 Register registers[] = { InterfaceDescriptor::ContextRegister(), |
602 LoadIC::ReceiverRegister(), | 602 LoadIC::ReceiverRegister(), |
603 LoadIC::NameRegister() }; | 603 LoadIC::NameRegister() }; |
604 STATIC_ASSERT(LoadIC::kParameterCount == 2); | 604 STATIC_ASSERT(LoadIC::kParameterCount == 2); |
605 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 605 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
606 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure)); | 606 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure)); |
607 } | 607 } |
608 | 608 |
609 | 609 |
610 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( | 610 void KeyedLoadGenericStub::InitializeInterfaceDescriptor( |
611 CodeStubInterfaceDescriptor* descriptor) { | 611 CodeStubInterfaceDescriptor* descriptor) { |
612 Register registers[] = { InterfaceDescriptor::ContextRegister(), | 612 Register registers[] = { InterfaceDescriptor::ContextRegister(), |
613 LoadIC::ReceiverRegister(), | 613 LoadIC::ReceiverRegister(), |
614 LoadIC::NameRegister() }; | 614 LoadIC::NameRegister() }; |
615 STATIC_ASSERT(LoadIC::kParameterCount == 2); | 615 STATIC_ASSERT(LoadIC::kParameterCount == 2); |
616 descriptor->Initialize( | 616 descriptor->Initialize( |
617 ARRAY_SIZE(registers), registers, | 617 ARRAY_SIZE(registers), registers, |
618 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry); | 618 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry); |
619 } | 619 } |
620 | 620 |
621 | 621 |
622 void LoadFieldStub::InitializeInterfaceDescriptor( | 622 void LoadFieldStub::InitializeInterfaceDescriptor( |
623 CodeStubInterfaceDescriptor* descriptor) { | 623 CodeStubInterfaceDescriptor* descriptor) { |
624 Register registers[] = { InterfaceDescriptor::ContextRegister(), | 624 Register registers[] = { InterfaceDescriptor::ContextRegister(), |
625 LoadIC::ReceiverRegister() }; | 625 LoadIC::ReceiverRegister() }; |
626 descriptor->Initialize(ARRAY_SIZE(registers), registers); | 626 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
627 } | 627 } |
628 | 628 |
629 | 629 |
630 void StringLengthStub::InitializeInterfaceDescriptor( | 630 void StringLengthStub::InitializeInterfaceDescriptor( |
631 CodeStubInterfaceDescriptor* descriptor) { | 631 CodeStubInterfaceDescriptor* descriptor) { |
632 Register registers[] = { InterfaceDescriptor::ContextRegister(), | 632 Register registers[] = { InterfaceDescriptor::ContextRegister(), |
633 LoadIC::ReceiverRegister(), | 633 LoadIC::ReceiverRegister(), |
634 LoadIC::NameRegister() }; | 634 LoadIC::NameRegister() }; |
635 descriptor->Initialize(ARRAY_SIZE(registers), registers); | 635 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
636 } | 636 } |
637 | 637 |
638 | 638 |
639 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( | 639 void StoreFastElementStub::InitializeInterfaceDescriptor( |
640 CodeStubInterfaceDescriptor* descriptor) { | 640 CodeStubInterfaceDescriptor* descriptor) { |
641 Register registers[] = { InterfaceDescriptor::ContextRegister(), | 641 Register registers[] = { InterfaceDescriptor::ContextRegister(), |
642 KeyedStoreIC::ReceiverRegister(), | 642 KeyedStoreIC::ReceiverRegister(), |
643 KeyedStoreIC::NameRegister(), | 643 KeyedStoreIC::NameRegister(), |
644 KeyedStoreIC::ValueRegister() }; | 644 KeyedStoreIC::ValueRegister() }; |
645 descriptor->Initialize( | 645 descriptor->Initialize( |
646 ARRAY_SIZE(registers), registers, | 646 ARRAY_SIZE(registers), registers, |
647 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure)); | 647 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure)); |
648 } | 648 } |
649 | 649 |
(...skipping 14 matching lines...) Expand all Loading... |
664 CodeStubInterfaceDescriptor* descriptor) { | 664 CodeStubInterfaceDescriptor* descriptor) { |
665 Register registers[] = { InterfaceDescriptor::ContextRegister(), | 665 Register registers[] = { InterfaceDescriptor::ContextRegister(), |
666 StoreIC::ReceiverRegister(), | 666 StoreIC::ReceiverRegister(), |
667 StoreIC::NameRegister(), | 667 StoreIC::NameRegister(), |
668 StoreIC::ValueRegister() }; | 668 StoreIC::ValueRegister() }; |
669 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 669 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
670 FUNCTION_ADDR(StoreIC_MissFromStubFailure)); | 670 FUNCTION_ADDR(StoreIC_MissFromStubFailure)); |
671 } | 671 } |
672 | 672 |
673 | 673 |
674 void KeyedLoadDictionaryElementPlatformStub::Generate( | 674 void LoadDictionaryElementPlatformStub::Generate(MacroAssembler* masm) { |
675 MacroAssembler* masm) { | 675 ElementHandlerCompiler::GenerateLoadDictionaryElement(masm); |
676 IndexedHandlerCompiler::GenerateLoadDictionaryElement(masm); | |
677 } | 676 } |
678 | 677 |
679 | 678 |
680 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 679 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
681 CreateAllocationSiteStub stub(isolate); | 680 CreateAllocationSiteStub stub(isolate); |
682 stub.GetCode(); | 681 stub.GetCode(); |
683 } | 682 } |
684 | 683 |
685 | 684 |
686 void KeyedStoreElementStub::Generate(MacroAssembler* masm) { | 685 void StoreElementStub::Generate(MacroAssembler* masm) { |
687 switch (elements_kind_) { | 686 switch (elements_kind_) { |
688 case FAST_ELEMENTS: | 687 case FAST_ELEMENTS: |
689 case FAST_HOLEY_ELEMENTS: | 688 case FAST_HOLEY_ELEMENTS: |
690 case FAST_SMI_ELEMENTS: | 689 case FAST_SMI_ELEMENTS: |
691 case FAST_HOLEY_SMI_ELEMENTS: | 690 case FAST_HOLEY_SMI_ELEMENTS: |
692 case FAST_DOUBLE_ELEMENTS: | 691 case FAST_DOUBLE_ELEMENTS: |
693 case FAST_HOLEY_DOUBLE_ELEMENTS: | 692 case FAST_HOLEY_DOUBLE_ELEMENTS: |
694 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 693 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
695 case EXTERNAL_##TYPE##_ELEMENTS: \ | 694 case EXTERNAL_##TYPE##_ELEMENTS: \ |
696 case TYPE##_ELEMENTS: | 695 case TYPE##_ELEMENTS: |
697 | 696 |
698 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 697 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
699 #undef TYPED_ARRAY_CASE | 698 #undef TYPED_ARRAY_CASE |
700 UNREACHABLE(); | 699 UNREACHABLE(); |
701 break; | 700 break; |
702 case DICTIONARY_ELEMENTS: | 701 case DICTIONARY_ELEMENTS: |
703 IndexedHandlerCompiler::GenerateStoreDictionaryElement(masm); | 702 ElementHandlerCompiler::GenerateStoreDictionaryElement(masm); |
704 break; | 703 break; |
705 case SLOPPY_ARGUMENTS_ELEMENTS: | 704 case SLOPPY_ARGUMENTS_ELEMENTS: |
706 UNREACHABLE(); | 705 UNREACHABLE(); |
707 break; | 706 break; |
708 } | 707 } |
709 } | 708 } |
710 | 709 |
711 | 710 |
712 void ArgumentsAccessStub::PrintName(OStream& os) const { // NOLINT | 711 void ArgumentsAccessStub::PrintName(OStream& os) const { // NOLINT |
713 os << "ArgumentsAccessStub_"; | 712 os << "ArgumentsAccessStub_"; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 | 933 |
935 | 934 |
936 // static | 935 // static |
937 void RegExpConstructResultStub::InstallDescriptors(Isolate* isolate) { | 936 void RegExpConstructResultStub::InstallDescriptors(Isolate* isolate) { |
938 RegExpConstructResultStub stub(isolate); | 937 RegExpConstructResultStub stub(isolate); |
939 InstallDescriptor(isolate, &stub); | 938 InstallDescriptor(isolate, &stub); |
940 } | 939 } |
941 | 940 |
942 | 941 |
943 // static | 942 // static |
944 void KeyedLoadGenericElementStub::InstallDescriptors(Isolate* isolate) { | 943 void KeyedLoadGenericStub::InstallDescriptors(Isolate* isolate) { |
945 KeyedLoadGenericElementStub stub(isolate); | 944 KeyedLoadGenericStub stub(isolate); |
946 InstallDescriptor(isolate, &stub); | 945 InstallDescriptor(isolate, &stub); |
947 } | 946 } |
948 | 947 |
949 | 948 |
950 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 949 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
951 : PlatformCodeStub(isolate), argument_count_(ANY) { | 950 : PlatformCodeStub(isolate), argument_count_(ANY) { |
952 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 951 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
953 } | 952 } |
954 | 953 |
955 | 954 |
(...skipping 22 matching lines...) Expand all Loading... |
978 InstallDescriptor(isolate, &stub3); | 977 InstallDescriptor(isolate, &stub3); |
979 } | 978 } |
980 | 979 |
981 InternalArrayConstructorStub::InternalArrayConstructorStub( | 980 InternalArrayConstructorStub::InternalArrayConstructorStub( |
982 Isolate* isolate) : PlatformCodeStub(isolate) { | 981 Isolate* isolate) : PlatformCodeStub(isolate) { |
983 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 982 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
984 } | 983 } |
985 | 984 |
986 | 985 |
987 } } // namespace v8::internal | 986 } } // namespace v8::internal |
OLD | NEW |