| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 PrintBaseName(stream); | 212 PrintBaseName(stream); |
| 213 PrintState(stream); | 213 PrintState(stream); |
| 214 } | 214 } |
| 215 | 215 |
| 216 | 216 |
| 217 // static | 217 // static |
| 218 void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate) { | 218 void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate) { |
| 219 // Generate the uninitialized versions of the stub. | 219 // Generate the uninitialized versions of the stub. |
| 220 for (int op = Token::BIT_OR; op <= Token::MOD; ++op) { | 220 for (int op = Token::BIT_OR; op <= Token::MOD; ++op) { |
| 221 for (int mode = NO_OVERWRITE; mode <= OVERWRITE_RIGHT; ++mode) { | 221 for (int mode = NO_OVERWRITE; mode <= OVERWRITE_RIGHT; ++mode) { |
| 222 BinaryOpICStub stub(static_cast<Token::Value>(op), | 222 BinaryOpICStub stub(isolate, |
| 223 static_cast<Token::Value>(op), |
| 223 static_cast<OverwriteMode>(mode)); | 224 static_cast<OverwriteMode>(mode)); |
| 224 stub.GetCode(isolate); | 225 stub.GetCode(isolate); |
| 225 } | 226 } |
| 226 } | 227 } |
| 227 | 228 |
| 228 // Generate special versions of the stub. | 229 // Generate special versions of the stub. |
| 229 BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime); | 230 BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime); |
| 230 } | 231 } |
| 231 | 232 |
| 232 | 233 |
| 233 void BinaryOpICStub::PrintState(StringStream* stream) { | 234 void BinaryOpICStub::PrintState(StringStream* stream) { |
| 234 state_.Print(stream); | 235 state_.Print(stream); |
| 235 } | 236 } |
| 236 | 237 |
| 237 | 238 |
| 238 // static | 239 // static |
| 239 void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate, | 240 void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate, |
| 240 const BinaryOpIC::State& state) { | 241 const BinaryOpIC::State& state) { |
| 241 BinaryOpICStub stub(state); | 242 BinaryOpICStub stub(isolate, state); |
| 242 stub.GetCode(isolate); | 243 stub.GetCode(isolate); |
| 243 } | 244 } |
| 244 | 245 |
| 245 | 246 |
| 246 // static | 247 // static |
| 247 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 248 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
| 248 // Generate special versions of the stub. | 249 // Generate special versions of the stub. |
| 249 BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime); | 250 BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime); |
| 250 } | 251 } |
| 251 | 252 |
| 252 | 253 |
| 253 void BinaryOpICWithAllocationSiteStub::PrintState(StringStream* stream) { | 254 void BinaryOpICWithAllocationSiteStub::PrintState(StringStream* stream) { |
| 254 state_.Print(stream); | 255 state_.Print(stream); |
| 255 } | 256 } |
| 256 | 257 |
| 257 | 258 |
| 258 // static | 259 // static |
| 259 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime( | 260 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime( |
| 260 Isolate* isolate, const BinaryOpIC::State& state) { | 261 Isolate* isolate, const BinaryOpIC::State& state) { |
| 261 if (state.CouldCreateAllocationMementos()) { | 262 if (state.CouldCreateAllocationMementos()) { |
| 262 BinaryOpICWithAllocationSiteStub stub(state); | 263 BinaryOpICWithAllocationSiteStub stub(isolate, state); |
| 263 stub.GetCode(isolate); | 264 stub.GetCode(isolate); |
| 264 } | 265 } |
| 265 } | 266 } |
| 266 | 267 |
| 267 | 268 |
| 268 void StringAddStub::PrintBaseName(StringStream* stream) { | 269 void StringAddStub::PrintBaseName(StringStream* stream) { |
| 269 stream->Add("StringAddStub"); | 270 stream->Add("StringAddStub"); |
| 270 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { | 271 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { |
| 271 stream->Add("_CheckBoth"); | 272 stream->Add("_CheckBoth"); |
| 272 } else if ((flags() & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { | 273 } else if ((flags() & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 } | 534 } |
| 534 | 535 |
| 535 | 536 |
| 536 void KeyedLoadDictionaryElementPlatformStub::Generate( | 537 void KeyedLoadDictionaryElementPlatformStub::Generate( |
| 537 MacroAssembler* masm) { | 538 MacroAssembler* masm) { |
| 538 KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); | 539 KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); |
| 539 } | 540 } |
| 540 | 541 |
| 541 | 542 |
| 542 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 543 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
| 543 CreateAllocationSiteStub stub; | 544 CreateAllocationSiteStub stub(isolate); |
| 544 stub.GetCode(isolate); | 545 stub.GetCode(isolate); |
| 545 } | 546 } |
| 546 | 547 |
| 547 | 548 |
| 548 void KeyedStoreElementStub::Generate(MacroAssembler* masm) { | 549 void KeyedStoreElementStub::Generate(MacroAssembler* masm) { |
| 549 switch (elements_kind_) { | 550 switch (elements_kind_) { |
| 550 case FAST_ELEMENTS: | 551 case FAST_ELEMENTS: |
| 551 case FAST_HOLEY_ELEMENTS: | 552 case FAST_HOLEY_ELEMENTS: |
| 552 case FAST_SMI_ELEMENTS: | 553 case FAST_SMI_ELEMENTS: |
| 553 case FAST_HOLEY_SMI_ELEMENTS: | 554 case FAST_HOLEY_SMI_ELEMENTS: |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 } | 690 } |
| 690 | 691 |
| 691 | 692 |
| 692 bool ToBooleanStub::Types::CanBeUndetectable() const { | 693 bool ToBooleanStub::Types::CanBeUndetectable() const { |
| 693 return Contains(ToBooleanStub::SPEC_OBJECT) | 694 return Contains(ToBooleanStub::SPEC_OBJECT) |
| 694 || Contains(ToBooleanStub::STRING); | 695 || Contains(ToBooleanStub::STRING); |
| 695 } | 696 } |
| 696 | 697 |
| 697 | 698 |
| 698 void StubFailureTrampolineStub::GenerateAheadOfTime(Isolate* isolate) { | 699 void StubFailureTrampolineStub::GenerateAheadOfTime(Isolate* isolate) { |
| 699 StubFailureTrampolineStub stub1(NOT_JS_FUNCTION_STUB_MODE); | 700 StubFailureTrampolineStub stub1(isolate, NOT_JS_FUNCTION_STUB_MODE); |
| 700 StubFailureTrampolineStub stub2(JS_FUNCTION_STUB_MODE); | 701 StubFailureTrampolineStub stub2(isolate, JS_FUNCTION_STUB_MODE); |
| 701 stub1.GetCode(isolate); | 702 stub1.GetCode(isolate); |
| 702 stub2.GetCode(isolate); | 703 stub2.GetCode(isolate); |
| 703 } | 704 } |
| 704 | 705 |
| 705 | 706 |
| 706 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, | 707 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, |
| 707 intptr_t stack_pointer, | 708 intptr_t stack_pointer, |
| 708 Isolate* isolate) { | 709 Isolate* isolate) { |
| 709 FunctionEntryHook entry_hook = isolate->function_entry_hook(); | 710 FunctionEntryHook entry_hook = isolate->function_entry_hook(); |
| 710 ASSERT(entry_hook != NULL); | 711 ASSERT(entry_hook != NULL); |
| 711 entry_hook(function, stack_pointer); | 712 entry_hook(function, stack_pointer); |
| 712 } | 713 } |
| 713 | 714 |
| 714 | 715 |
| 715 static void InstallDescriptor(Isolate* isolate, HydrogenCodeStub* stub) { | 716 static void InstallDescriptor(Isolate* isolate, HydrogenCodeStub* stub) { |
| 716 int major_key = stub->MajorKey(); | 717 int major_key = stub->MajorKey(); |
| 717 CodeStubInterfaceDescriptor* descriptor = | 718 CodeStubInterfaceDescriptor* descriptor = |
| 718 isolate->code_stub_interface_descriptor(major_key); | 719 isolate->code_stub_interface_descriptor(major_key); |
| 719 if (!descriptor->initialized()) { | 720 if (!descriptor->initialized()) { |
| 720 stub->InitializeInterfaceDescriptor(isolate, descriptor); | 721 stub->InitializeInterfaceDescriptor(isolate, descriptor); |
| 721 } | 722 } |
| 722 } | 723 } |
| 723 | 724 |
| 724 | 725 |
| 725 void ArrayConstructorStubBase::InstallDescriptors(Isolate* isolate) { | 726 void ArrayConstructorStubBase::InstallDescriptors(Isolate* isolate) { |
| 726 ArrayNoArgumentConstructorStub stub1(GetInitialFastElementsKind()); | 727 ArrayNoArgumentConstructorStub stub1(isolate, GetInitialFastElementsKind()); |
| 727 InstallDescriptor(isolate, &stub1); | 728 InstallDescriptor(isolate, &stub1); |
| 728 ArraySingleArgumentConstructorStub stub2(GetInitialFastElementsKind()); | 729 ArraySingleArgumentConstructorStub stub2(isolate, |
| 730 GetInitialFastElementsKind()); |
| 729 InstallDescriptor(isolate, &stub2); | 731 InstallDescriptor(isolate, &stub2); |
| 730 ArrayNArgumentsConstructorStub stub3(GetInitialFastElementsKind()); | 732 ArrayNArgumentsConstructorStub stub3(isolate, GetInitialFastElementsKind()); |
| 731 InstallDescriptor(isolate, &stub3); | 733 InstallDescriptor(isolate, &stub3); |
| 732 } | 734 } |
| 733 | 735 |
| 734 | 736 |
| 735 void NumberToStringStub::InstallDescriptors(Isolate* isolate) { | 737 void NumberToStringStub::InstallDescriptors(Isolate* isolate) { |
| 736 NumberToStringStub stub; | 738 NumberToStringStub stub(isolate); |
| 737 InstallDescriptor(isolate, &stub); | 739 InstallDescriptor(isolate, &stub); |
| 738 } | 740 } |
| 739 | 741 |
| 740 | 742 |
| 741 void FastNewClosureStub::InstallDescriptors(Isolate* isolate) { | 743 void FastNewClosureStub::InstallDescriptors(Isolate* isolate) { |
| 742 FastNewClosureStub stub(STRICT, false); | 744 FastNewClosureStub stub(isolate, STRICT, false); |
| 743 InstallDescriptor(isolate, &stub); | 745 InstallDescriptor(isolate, &stub); |
| 744 } | 746 } |
| 745 | 747 |
| 746 | 748 |
| 747 void FastNewContextStub::InstallDescriptors(Isolate* isolate) { | 749 void FastNewContextStub::InstallDescriptors(Isolate* isolate) { |
| 748 FastNewContextStub stub(FastNewContextStub::kMaximumSlots); | 750 FastNewContextStub stub(isolate, FastNewContextStub::kMaximumSlots); |
| 749 InstallDescriptor(isolate, &stub); | 751 InstallDescriptor(isolate, &stub); |
| 750 } | 752 } |
| 751 | 753 |
| 752 | 754 |
| 753 // static | 755 // static |
| 754 void FastCloneShallowArrayStub::InstallDescriptors(Isolate* isolate) { | 756 void FastCloneShallowArrayStub::InstallDescriptors(Isolate* isolate) { |
| 755 FastCloneShallowArrayStub stub(FastCloneShallowArrayStub::CLONE_ELEMENTS, | 757 FastCloneShallowArrayStub stub(isolate, |
| 758 FastCloneShallowArrayStub::CLONE_ELEMENTS, |
| 756 DONT_TRACK_ALLOCATION_SITE, 0); | 759 DONT_TRACK_ALLOCATION_SITE, 0); |
| 757 InstallDescriptor(isolate, &stub); | 760 InstallDescriptor(isolate, &stub); |
| 758 } | 761 } |
| 759 | 762 |
| 760 | 763 |
| 761 // static | 764 // static |
| 762 void BinaryOpICStub::InstallDescriptors(Isolate* isolate) { | 765 void BinaryOpICStub::InstallDescriptors(Isolate* isolate) { |
| 763 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE); | 766 BinaryOpICStub stub(isolate, Token::ADD, NO_OVERWRITE); |
| 764 InstallDescriptor(isolate, &stub); | 767 InstallDescriptor(isolate, &stub); |
| 765 } | 768 } |
| 766 | 769 |
| 767 | 770 |
| 768 // static | 771 // static |
| 769 void BinaryOpWithAllocationSiteStub::InstallDescriptors(Isolate* isolate) { | 772 void BinaryOpWithAllocationSiteStub::InstallDescriptors(Isolate* isolate) { |
| 770 BinaryOpWithAllocationSiteStub stub(Token::ADD, NO_OVERWRITE); | 773 BinaryOpWithAllocationSiteStub stub(isolate, Token::ADD, NO_OVERWRITE); |
| 771 InstallDescriptor(isolate, &stub); | 774 InstallDescriptor(isolate, &stub); |
| 772 } | 775 } |
| 773 | 776 |
| 774 | 777 |
| 775 // static | 778 // static |
| 776 void StringAddStub::InstallDescriptors(Isolate* isolate) { | 779 void StringAddStub::InstallDescriptors(Isolate* isolate) { |
| 777 StringAddStub stub(STRING_ADD_CHECK_NONE, NOT_TENURED); | 780 StringAddStub stub(isolate, STRING_ADD_CHECK_NONE, NOT_TENURED); |
| 778 InstallDescriptor(isolate, &stub); | 781 InstallDescriptor(isolate, &stub); |
| 779 } | 782 } |
| 780 | 783 |
| 781 | 784 |
| 782 // static | 785 // static |
| 783 void RegExpConstructResultStub::InstallDescriptors(Isolate* isolate) { | 786 void RegExpConstructResultStub::InstallDescriptors(Isolate* isolate) { |
| 784 RegExpConstructResultStub stub; | 787 RegExpConstructResultStub stub(isolate); |
| 785 InstallDescriptor(isolate, &stub); | 788 InstallDescriptor(isolate, &stub); |
| 786 } | 789 } |
| 787 | 790 |
| 788 | 791 |
| 789 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 792 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
| 790 : argument_count_(ANY) { | 793 : PlatformCodeStub(isolate), argument_count_(ANY) { |
| 791 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 794 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 792 } | 795 } |
| 793 | 796 |
| 794 | 797 |
| 795 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, | 798 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, |
| 796 int argument_count) { | 799 int argument_count) |
| 800 : PlatformCodeStub(isolate) { |
| 797 if (argument_count == 0) { | 801 if (argument_count == 0) { |
| 798 argument_count_ = NONE; | 802 argument_count_ = NONE; |
| 799 } else if (argument_count == 1) { | 803 } else if (argument_count == 1) { |
| 800 argument_count_ = ONE; | 804 argument_count_ = ONE; |
| 801 } else if (argument_count >= 2) { | 805 } else if (argument_count >= 2) { |
| 802 argument_count_ = MORE_THAN_ONE; | 806 argument_count_ = MORE_THAN_ONE; |
| 803 } else { | 807 } else { |
| 804 UNREACHABLE(); | 808 UNREACHABLE(); |
| 805 } | 809 } |
| 806 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 810 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 807 } | 811 } |
| 808 | 812 |
| 809 | 813 |
| 810 void InternalArrayConstructorStubBase::InstallDescriptors(Isolate* isolate) { | 814 void InternalArrayConstructorStubBase::InstallDescriptors(Isolate* isolate) { |
| 811 InternalArrayNoArgumentConstructorStub stub1(FAST_ELEMENTS); | 815 InternalArrayNoArgumentConstructorStub stub1(isolate, FAST_ELEMENTS); |
| 812 InstallDescriptor(isolate, &stub1); | 816 InstallDescriptor(isolate, &stub1); |
| 813 InternalArraySingleArgumentConstructorStub stub2(FAST_ELEMENTS); | 817 InternalArraySingleArgumentConstructorStub stub2(isolate, FAST_ELEMENTS); |
| 814 InstallDescriptor(isolate, &stub2); | 818 InstallDescriptor(isolate, &stub2); |
| 815 InternalArrayNArgumentsConstructorStub stub3(FAST_ELEMENTS); | 819 InternalArrayNArgumentsConstructorStub stub3(isolate, FAST_ELEMENTS); |
| 816 InstallDescriptor(isolate, &stub3); | 820 InstallDescriptor(isolate, &stub3); |
| 817 } | 821 } |
| 818 | 822 |
| 819 InternalArrayConstructorStub::InternalArrayConstructorStub( | 823 InternalArrayConstructorStub::InternalArrayConstructorStub( |
| 820 Isolate* isolate) { | 824 Isolate* isolate) : PlatformCodeStub(isolate) { |
| 821 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 825 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 822 } | 826 } |
| 823 | 827 |
| 824 | 828 |
| 825 } } // namespace v8::internal | 829 } } // namespace v8::internal |
| OLD | NEW |