Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 157543002: A64: Synchronize with r18581. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 HValue* GetArgumentsLength() { 74 HValue* GetArgumentsLength() {
75 // This is initialized in BuildGraph() 75 // This is initialized in BuildGraph()
76 ASSERT(arguments_length_ != NULL); 76 ASSERT(arguments_length_ != NULL);
77 return arguments_length_; 77 return arguments_length_;
78 } 78 }
79 CompilationInfo* info() { return &info_; } 79 CompilationInfo* info() { return &info_; }
80 HydrogenCodeStub* stub() { return info_.code_stub(); } 80 HydrogenCodeStub* stub() { return info_.code_stub(); }
81 HContext* context() { return context_; } 81 HContext* context() { return context_; }
82 Isolate* isolate() { return info_.isolate(); } 82 Isolate* isolate() { return info_.isolate(); }
83 83
84 class ArrayContextChecker {
85 public:
86 ArrayContextChecker(HGraphBuilder* builder, HValue* constructor,
87 HValue* array_function)
88 : checker_(builder) {
89 checker_.If<HCompareObjectEqAndBranch, HValue*>(constructor,
90 array_function);
91 checker_.Then();
92 }
93
94 ~ArrayContextChecker() {
95 checker_.ElseDeopt("Array constructor called from different context");
96 checker_.End();
97 }
98 private:
99 IfBuilder checker_;
100 };
101
102 enum ArgumentClass { 84 enum ArgumentClass {
103 NONE, 85 NONE,
104 SINGLE, 86 SINGLE,
105 MULTIPLE 87 MULTIPLE
106 }; 88 };
107 89
108 HValue* BuildArrayConstructor(ElementsKind kind, 90 HValue* BuildArrayConstructor(ElementsKind kind,
109 ContextCheckMode context_mode,
110 AllocationSiteOverrideMode override_mode, 91 AllocationSiteOverrideMode override_mode,
111 ArgumentClass argument_class); 92 ArgumentClass argument_class);
112 HValue* BuildInternalArrayConstructor(ElementsKind kind, 93 HValue* BuildInternalArrayConstructor(ElementsKind kind,
113 ArgumentClass argument_class); 94 ArgumentClass argument_class);
114 95
115 void BuildInstallOptimizedCode(HValue* js_function, HValue* native_context, 96 void BuildInstallOptimizedCode(HValue* js_function, HValue* native_context,
116 HValue* code_object); 97 HValue* code_object);
117 void BuildInstallCode(HValue* js_function, HValue* shared_info); 98 void BuildInstallCode(HValue* js_function, HValue* shared_info);
118 void BuildInstallFromOptimizedCodeMap(HValue* js_function, 99 void BuildInstallFromOptimizedCodeMap(HValue* js_function,
119 HValue* shared_info, 100 HValue* shared_info,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 316
336 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) { 317 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) {
337 return DoGenerateCode(isolate, this); 318 return DoGenerateCode(isolate, this);
338 } 319 }
339 320
340 321
341 template <> 322 template <>
342 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { 323 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() {
343 info()->MarkAsSavesCallerDoubles(); 324 info()->MarkAsSavesCallerDoubles();
344 HValue* number = GetParameter(NumberToStringStub::kNumber); 325 HValue* number = GetParameter(NumberToStringStub::kNumber);
345 return BuildNumberToString(number, handle(Type::Number(), isolate())); 326 return BuildNumberToString(number, Type::Number(isolate()));
346 } 327 }
347 328
348 329
349 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) { 330 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) {
350 return DoGenerateCode(isolate, this); 331 return DoGenerateCode(isolate, this);
351 } 332 }
352 333
353 334
354 template <> 335 template <>
355 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { 336 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 HObjectAccess::ForAllocationSiteOffset( 484 HObjectAccess::ForAllocationSiteOffset(
504 AllocationSite::kTransitionInfoOffset), 485 AllocationSite::kTransitionInfoOffset),
505 initial_elements_kind); 486 initial_elements_kind);
506 487
507 // Unlike literals, constructed arrays don't have nested sites 488 // Unlike literals, constructed arrays don't have nested sites
508 Add<HStoreNamedField>(object, 489 Add<HStoreNamedField>(object,
509 HObjectAccess::ForAllocationSiteOffset( 490 HObjectAccess::ForAllocationSiteOffset(
510 AllocationSite::kNestedSiteOffset), 491 AllocationSite::kNestedSiteOffset),
511 graph()->GetConstant0()); 492 graph()->GetConstant0());
512 493
513 // Pretenuring calculation fields. 494 // Pretenuring calculation field.
514 Add<HStoreNamedField>(object, 495 Add<HStoreNamedField>(object,
515 HObjectAccess::ForAllocationSiteOffset( 496 HObjectAccess::ForAllocationSiteOffset(
516 AllocationSite::kMementoFoundCountOffset), 497 AllocationSite::kPretenureDataOffset),
517 graph()->GetConstant0()); 498 graph()->GetConstant0());
518 499
500 // Pretenuring memento creation count field.
519 Add<HStoreNamedField>(object, 501 Add<HStoreNamedField>(object,
520 HObjectAccess::ForAllocationSiteOffset( 502 HObjectAccess::ForAllocationSiteOffset(
521 AllocationSite::kMementoCreateCountOffset), 503 AllocationSite::kPretenureCreateCountOffset),
522 graph()->GetConstant0());
523
524 Add<HStoreNamedField>(object,
525 HObjectAccess::ForAllocationSiteOffset(
526 AllocationSite::kPretenureDecisionOffset),
527 graph()->GetConstant0()); 504 graph()->GetConstant0());
528 505
529 // Store an empty fixed array for the code dependency. 506 // Store an empty fixed array for the code dependency.
530 HConstant* empty_fixed_array = 507 HConstant* empty_fixed_array =
531 Add<HConstant>(isolate()->factory()->empty_fixed_array()); 508 Add<HConstant>(isolate()->factory()->empty_fixed_array());
532 HStoreNamedField* store = Add<HStoreNamedField>( 509 HStoreNamedField* store = Add<HStoreNamedField>(
533 object, 510 object,
534 HObjectAccess::ForAllocationSiteOffset( 511 HObjectAccess::ForAllocationSiteOffset(
535 AllocationSite::kDependentCodeOffset), 512 AllocationSite::kDependentCodeOffset),
536 empty_fixed_array); 513 empty_fixed_array);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return GetParameter(0); 642 return GetParameter(0);
666 } 643 }
667 644
668 645
669 Handle<Code> TransitionElementsKindStub::GenerateCode(Isolate* isolate) { 646 Handle<Code> TransitionElementsKindStub::GenerateCode(Isolate* isolate) {
670 return DoGenerateCode(isolate, this); 647 return DoGenerateCode(isolate, this);
671 } 648 }
672 649
673 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor( 650 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor(
674 ElementsKind kind, 651 ElementsKind kind,
675 ContextCheckMode context_mode,
676 AllocationSiteOverrideMode override_mode, 652 AllocationSiteOverrideMode override_mode,
677 ArgumentClass argument_class) { 653 ArgumentClass argument_class) {
678 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor); 654 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor);
679 if (context_mode == CONTEXT_CHECK_REQUIRED) {
680 HInstruction* array_function = BuildGetArrayFunction();
681 ArrayContextChecker checker(this, constructor, array_function);
682 }
683
684 HValue* property_cell = GetParameter(ArrayConstructorStubBase::kPropertyCell); 655 HValue* property_cell = GetParameter(ArrayConstructorStubBase::kPropertyCell);
685 // Walk through the property cell to the AllocationSite 656 // Walk through the property cell to the AllocationSite
686 HValue* alloc_site = Add<HLoadNamedField>(property_cell, 657 HValue* alloc_site = Add<HLoadNamedField>(property_cell,
687 HObjectAccess::ForCellValue()); 658 HObjectAccess::ForCellValue());
688 JSArrayBuilder array_builder(this, kind, alloc_site, constructor, 659 JSArrayBuilder array_builder(this, kind, alloc_site, constructor,
689 override_mode); 660 override_mode);
690 HValue* result = NULL; 661 HValue* result = NULL;
691 switch (argument_class) { 662 switch (argument_class) {
692 case NONE: 663 case NONE:
693 result = array_builder.AllocateEmptyArray(); 664 result = array_builder.AllocateEmptyArray();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 751
781 Add<HStoreKeyed>(elements, key, argument, kind); 752 Add<HStoreKeyed>(elements, key, argument, kind);
782 builder.EndBody(); 753 builder.EndBody();
783 return new_object; 754 return new_object;
784 } 755 }
785 756
786 757
787 template <> 758 template <>
788 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() { 759 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() {
789 ElementsKind kind = casted_stub()->elements_kind(); 760 ElementsKind kind = casted_stub()->elements_kind();
790 ContextCheckMode context_mode = casted_stub()->context_mode();
791 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 761 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
792 return BuildArrayConstructor(kind, context_mode, override_mode, NONE); 762 return BuildArrayConstructor(kind, override_mode, NONE);
793 } 763 }
794 764
795 765
796 Handle<Code> ArrayNoArgumentConstructorStub::GenerateCode(Isolate* isolate) { 766 Handle<Code> ArrayNoArgumentConstructorStub::GenerateCode(Isolate* isolate) {
797 return DoGenerateCode(isolate, this); 767 return DoGenerateCode(isolate, this);
798 } 768 }
799 769
800 770
801 template <> 771 template <>
802 HValue* CodeStubGraphBuilder<ArraySingleArgumentConstructorStub>:: 772 HValue* CodeStubGraphBuilder<ArraySingleArgumentConstructorStub>::
803 BuildCodeStub() { 773 BuildCodeStub() {
804 ElementsKind kind = casted_stub()->elements_kind(); 774 ElementsKind kind = casted_stub()->elements_kind();
805 ContextCheckMode context_mode = casted_stub()->context_mode();
806 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 775 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
807 return BuildArrayConstructor(kind, context_mode, override_mode, SINGLE); 776 return BuildArrayConstructor(kind, override_mode, SINGLE);
808 } 777 }
809 778
810 779
811 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode( 780 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode(
812 Isolate* isolate) { 781 Isolate* isolate) {
813 return DoGenerateCode(isolate, this); 782 return DoGenerateCode(isolate, this);
814 } 783 }
815 784
816 785
817 template <> 786 template <>
818 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() { 787 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() {
819 ElementsKind kind = casted_stub()->elements_kind(); 788 ElementsKind kind = casted_stub()->elements_kind();
820 ContextCheckMode context_mode = casted_stub()->context_mode();
821 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 789 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
822 return BuildArrayConstructor(kind, context_mode, override_mode, MULTIPLE); 790 return BuildArrayConstructor(kind, override_mode, MULTIPLE);
823 } 791 }
824 792
825 793
826 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode(Isolate* isolate) { 794 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode(Isolate* isolate) {
827 return DoGenerateCode(isolate, this); 795 return DoGenerateCode(isolate, this);
828 } 796 }
829 797
830 798
831 template <> 799 template <>
832 HValue* CodeStubGraphBuilder<InternalArrayNoArgumentConstructorStub>:: 800 HValue* CodeStubGraphBuilder<InternalArrayNoArgumentConstructorStub>::
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { 885 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) {
918 // For the generic add stub a fast case for string addition is performance 886 // For the generic add stub a fast case for string addition is performance
919 // critical. 887 // critical.
920 if (left_type->Maybe(Type::String())) { 888 if (left_type->Maybe(Type::String())) {
921 IfBuilder if_leftisstring(this); 889 IfBuilder if_leftisstring(this);
922 if_leftisstring.If<HIsStringAndBranch>(left); 890 if_leftisstring.If<HIsStringAndBranch>(left);
923 if_leftisstring.Then(); 891 if_leftisstring.Then();
924 { 892 {
925 Push(BuildBinaryOperation( 893 Push(BuildBinaryOperation(
926 state.op(), left, right, 894 state.op(), left, right,
927 handle(Type::String(), isolate()), right_type, 895 Type::String(isolate()), right_type,
928 result_type, state.fixed_right_arg(), 896 result_type, state.fixed_right_arg(),
929 allocation_mode)); 897 allocation_mode));
930 } 898 }
931 if_leftisstring.Else(); 899 if_leftisstring.Else();
932 { 900 {
933 Push(BuildBinaryOperation( 901 Push(BuildBinaryOperation(
934 state.op(), left, right, 902 state.op(), left, right,
935 left_type, right_type, result_type, 903 left_type, right_type, result_type,
936 state.fixed_right_arg(), allocation_mode)); 904 state.fixed_right_arg(), allocation_mode));
937 } 905 }
938 if_leftisstring.End(); 906 if_leftisstring.End();
939 result = Pop(); 907 result = Pop();
940 } else { 908 } else {
941 IfBuilder if_rightisstring(this); 909 IfBuilder if_rightisstring(this);
942 if_rightisstring.If<HIsStringAndBranch>(right); 910 if_rightisstring.If<HIsStringAndBranch>(right);
943 if_rightisstring.Then(); 911 if_rightisstring.Then();
944 { 912 {
945 Push(BuildBinaryOperation( 913 Push(BuildBinaryOperation(
946 state.op(), left, right, 914 state.op(), left, right,
947 left_type, handle(Type::String(), isolate()), 915 left_type, Type::String(isolate()),
948 result_type, state.fixed_right_arg(), 916 result_type, state.fixed_right_arg(),
949 allocation_mode)); 917 allocation_mode));
950 } 918 }
951 if_rightisstring.Else(); 919 if_rightisstring.Else();
952 { 920 {
953 Push(BuildBinaryOperation( 921 Push(BuildBinaryOperation(
954 state.op(), left, right, 922 state.op(), left, right,
955 left_type, right_type, result_type, 923 left_type, right_type, result_type,
956 state.fixed_right_arg(), allocation_mode)); 924 state.fixed_right_arg(), allocation_mode));
957 } 925 }
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 return BuildUncheckedDictionaryElementLoad(receiver, key); 1342 return BuildUncheckedDictionaryElementLoad(receiver, key);
1375 } 1343 }
1376 1344
1377 1345
1378 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { 1346 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) {
1379 return DoGenerateCode(isolate, this); 1347 return DoGenerateCode(isolate, this);
1380 } 1348 }
1381 1349
1382 1350
1383 } } // namespace v8::internal 1351 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698