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

Side by Side Diff: src/interpreter/interpreter-assembler.cc

Issue 1989363004: [turbofan] Add FixedArray peephole optimizations to CodeStubAssembler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Final review feedback Created 4 years, 7 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
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/compiler/test-code-stub-assembler.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/interpreter-assembler.h" 5 #include "src/interpreter/interpreter-assembler.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 Bind(&loop); 713 Bind(&loop);
714 { 714 {
715 Node* index = var_index.value(); 715 Node* index = var_index.value();
716 Node* condition = Int32LessThan(index, RegisterCount()); 716 Node* condition = Int32LessThan(index, RegisterCount());
717 GotoUnless(condition, &done_loop); 717 GotoUnless(condition, &done_loop);
718 718
719 Node* reg_index = 719 Node* reg_index =
720 Int32Sub(Int32Constant(Register(0).ToOperand()), index); 720 Int32Sub(Int32Constant(Register(0).ToOperand()), index);
721 Node* value = LoadRegister(ChangeInt32ToIntPtr(reg_index)); 721 Node* value = LoadRegister(ChangeInt32ToIntPtr(reg_index));
722 722
723 StoreFixedArrayElementInt32Index(array, index, value); 723 StoreFixedArrayElement(array, index, value);
724 724
725 var_index.Bind(Int32Add(index, Int32Constant(1))); 725 var_index.Bind(Int32Add(index, Int32Constant(1)));
726 Goto(&loop); 726 Goto(&loop);
727 } 727 }
728 Bind(&done_loop); 728 Bind(&done_loop);
729 729
730 return array; 730 return array;
731 } 731 }
732 732
733 Node* InterpreterAssembler::ImportRegisterFile(Node* array) { 733 Node* InterpreterAssembler::ImportRegisterFile(Node* array) {
734 if (FLAG_debug_code) { 734 if (FLAG_debug_code) {
735 Node* array_size = SmiUntag(LoadFixedArrayBaseLength(array)); 735 Node* array_size = SmiUntag(LoadFixedArrayBaseLength(array));
736 AbortIfWordNotEqual( 736 AbortIfWordNotEqual(
737 array_size, RegisterCount(), kInvalidRegisterFileInGenerator); 737 array_size, RegisterCount(), kInvalidRegisterFileInGenerator);
738 } 738 }
739 739
740 Variable var_index(this, MachineRepresentation::kWord32); 740 Variable var_index(this, MachineRepresentation::kWord32);
741 var_index.Bind(Int32Constant(0)); 741 var_index.Bind(Int32Constant(0));
742 742
743 // Iterate over array and write values into register file. Also erase the 743 // Iterate over array and write values into register file. Also erase the
744 // array contents to not keep them alive artificially. 744 // array contents to not keep them alive artificially.
745 Label loop(this, &var_index), done_loop(this); 745 Label loop(this, &var_index), done_loop(this);
746 Goto(&loop); 746 Goto(&loop);
747 Bind(&loop); 747 Bind(&loop);
748 { 748 {
749 Node* index = var_index.value(); 749 Node* index = var_index.value();
750 Node* condition = Int32LessThan(index, RegisterCount()); 750 Node* condition = Int32LessThan(index, RegisterCount());
751 GotoUnless(condition, &done_loop); 751 GotoUnless(condition, &done_loop);
752 752
753 Node* value = LoadFixedArrayElementInt32Index(array, index); 753 Node* value = LoadFixedArrayElement(array, index);
754 754
755 Node* reg_index = 755 Node* reg_index =
756 Int32Sub(Int32Constant(Register(0).ToOperand()), index); 756 Int32Sub(Int32Constant(Register(0).ToOperand()), index);
757 StoreRegister(value, ChangeInt32ToIntPtr(reg_index)); 757 StoreRegister(value, ChangeInt32ToIntPtr(reg_index));
758 758
759 StoreFixedArrayElementInt32Index(array, index, StaleRegisterConstant()); 759 StoreFixedArrayElement(array, index, StaleRegisterConstant());
760 760
761 var_index.Bind(Int32Add(index, Int32Constant(1))); 761 var_index.Bind(Int32Add(index, Int32Constant(1)));
762 Goto(&loop); 762 Goto(&loop);
763 } 763 }
764 Bind(&done_loop); 764 Bind(&done_loop);
765 765
766 return array; 766 return array;
767 } 767 }
768 768
769 } // namespace interpreter 769 } // namespace interpreter
770 } // namespace internal 770 } // namespace internal
771 } // namespace v8 771 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/compiler/test-code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698