OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 private: | 49 private: |
50 SaveFPRegsMode save_doubles_; | 50 SaveFPRegsMode save_doubles_; |
51 | 51 |
52 Major MajorKey() { return StoreBufferOverflow; } | 52 Major MajorKey() { return StoreBufferOverflow; } |
53 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } | 53 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } |
54 }; | 54 }; |
55 | 55 |
56 | 56 |
57 class StringHelper : public AllStatic { | 57 class StringHelper : public AllStatic { |
58 public: | 58 public: |
59 // Generate code for copying characters using a simple loop. This should only | |
60 // be used in places where the number of characters is small and the | |
61 // additional setup and checking in GenerateCopyCharactersREP adds too much | |
62 // overhead. Copying of overlapping regions is not supported. | |
63 static void GenerateCopyCharacters(MacroAssembler* masm, | |
64 Register dest, | |
65 Register src, | |
66 Register count, | |
67 bool ascii); | |
68 | |
69 // Generate code for copying characters using the rep movs instruction. | 59 // Generate code for copying characters using the rep movs instruction. |
70 // Copies rcx characters from rsi to rdi. Copying of overlapping regions is | 60 // Copies rcx characters from rsi to rdi. Copying of overlapping regions is |
71 // not supported. | 61 // not supported. |
72 static void GenerateCopyCharactersREP(MacroAssembler* masm, | 62 static void GenerateCopyCharactersREP(MacroAssembler* masm, |
73 Register dest, // Must be rdi. | 63 Register dest, // Must be rdi. |
74 Register src, // Must be rsi. | 64 Register src, // Must be rsi. |
75 Register count, // Must be rcx. | 65 Register count, // Must be rcx. |
76 bool ascii); | 66 bool ascii); |
77 | 67 |
78 | 68 |
79 // Probe the string table for a two character string. If the string is | |
80 // not found by probing a jump to the label not_found is performed. This jump | |
81 // does not guarantee that the string is not in the string table. If the | |
82 // string is found the code falls through with the string in register rax. | |
83 static void GenerateTwoCharacterStringTableProbe(MacroAssembler* masm, | |
84 Register c1, | |
85 Register c2, | |
86 Register scratch1, | |
87 Register scratch2, | |
88 Register scratch3, | |
89 Register scratch4, | |
90 Label* not_found); | |
91 | |
92 // Generate string hash. | 69 // Generate string hash. |
93 static void GenerateHashInit(MacroAssembler* masm, | 70 static void GenerateHashInit(MacroAssembler* masm, |
94 Register hash, | 71 Register hash, |
95 Register character, | 72 Register character, |
96 Register scratch); | 73 Register scratch); |
97 static void GenerateHashAddCharacter(MacroAssembler* masm, | 74 static void GenerateHashAddCharacter(MacroAssembler* masm, |
98 Register hash, | 75 Register hash, |
99 Register character, | 76 Register character, |
100 Register scratch); | 77 Register scratch); |
101 static void GenerateHashGetHash(MacroAssembler* masm, | 78 static void GenerateHashGetHash(MacroAssembler* masm, |
102 Register hash, | 79 Register hash, |
103 Register scratch); | 80 Register scratch); |
104 | 81 |
105 private: | 82 private: |
106 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); | 83 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
107 }; | 84 }; |
108 | 85 |
109 | 86 |
110 class StringAddStub: public PlatformCodeStub { | |
111 public: | |
112 explicit StringAddStub(StringAddFlags flags) : flags_(flags) {} | |
113 | |
114 private: | |
115 Major MajorKey() { return StringAdd; } | |
116 int MinorKey() { return flags_; } | |
117 | |
118 void Generate(MacroAssembler* masm); | |
119 | |
120 void GenerateConvertArgument(MacroAssembler* masm, | |
121 int stack_offset, | |
122 Register arg, | |
123 Register scratch1, | |
124 Register scratch2, | |
125 Register scratch3, | |
126 Label* slow); | |
127 | |
128 void GenerateRegisterArgsPush(MacroAssembler* masm); | |
129 void GenerateRegisterArgsPop(MacroAssembler* masm, Register temp); | |
130 | |
131 const StringAddFlags flags_; | |
132 }; | |
133 | |
134 | |
135 class SubStringStub: public PlatformCodeStub { | 87 class SubStringStub: public PlatformCodeStub { |
136 public: | 88 public: |
137 SubStringStub() {} | 89 SubStringStub() {} |
138 | 90 |
139 private: | 91 private: |
140 Major MajorKey() { return SubString; } | 92 Major MajorKey() { return SubString; } |
141 int MinorKey() { return 0; } | 93 int MinorKey() { return 0; } |
142 | 94 |
143 void Generate(MacroAssembler* masm); | 95 void Generate(MacroAssembler* masm); |
144 }; | 96 }; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 RememberedSetAction remembered_set_action_; | 429 RememberedSetAction remembered_set_action_; |
478 SaveFPRegsMode save_fp_regs_mode_; | 430 SaveFPRegsMode save_fp_regs_mode_; |
479 Label slow_; | 431 Label slow_; |
480 RegisterAllocation regs_; | 432 RegisterAllocation regs_; |
481 }; | 433 }; |
482 | 434 |
483 | 435 |
484 } } // namespace v8::internal | 436 } } // namespace v8::internal |
485 | 437 |
486 #endif // V8_X64_CODE_STUBS_X64_H_ | 438 #endif // V8_X64_CODE_STUBS_X64_H_ |
OLD | NEW |