OLD | NEW |
1 // Copyright 2008-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2008-2009 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 | 127 |
128 | 128 |
129 int RegExpMacroAssemblerIA32::stack_limit_slack() { | 129 int RegExpMacroAssemblerIA32::stack_limit_slack() { |
130 return RegExpStack::kStackLimitSlack; | 130 return RegExpStack::kStackLimitSlack; |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 void RegExpMacroAssemblerIA32::AdvanceCurrentPosition(int by) { | 134 void RegExpMacroAssemblerIA32::AdvanceCurrentPosition(int by) { |
135 if (by != 0) { | 135 if (by != 0) { |
136 Label inside_string; | |
137 __ add(Operand(edi), Immediate(by * char_size())); | 136 __ add(Operand(edi), Immediate(by * char_size())); |
138 } | 137 } |
139 } | 138 } |
140 | 139 |
141 | 140 |
142 void RegExpMacroAssemblerIA32::AdvanceRegister(int reg, int by) { | 141 void RegExpMacroAssemblerIA32::AdvanceRegister(int reg, int by) { |
143 ASSERT(reg >= 0); | 142 ASSERT(reg >= 0); |
144 ASSERT(reg < num_registers_); | 143 ASSERT(reg < num_registers_); |
145 if (by != 0) { | 144 if (by != 0) { |
146 __ add(register_location(reg), Immediate(by)); | 145 __ add(register_location(reg), Immediate(by)); |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 void RegExpMacroAssemblerIA32::ReadCurrentPositionFromRegister(int reg) { | 956 void RegExpMacroAssemblerIA32::ReadCurrentPositionFromRegister(int reg) { |
958 __ mov(edi, register_location(reg)); | 957 __ mov(edi, register_location(reg)); |
959 } | 958 } |
960 | 959 |
961 | 960 |
962 void RegExpMacroAssemblerIA32::ReadStackPointerFromRegister(int reg) { | 961 void RegExpMacroAssemblerIA32::ReadStackPointerFromRegister(int reg) { |
963 __ mov(backtrack_stackpointer(), register_location(reg)); | 962 __ mov(backtrack_stackpointer(), register_location(reg)); |
964 __ add(backtrack_stackpointer(), Operand(ebp, kStackHighEnd)); | 963 __ add(backtrack_stackpointer(), Operand(ebp, kStackHighEnd)); |
965 } | 964 } |
966 | 965 |
| 966 void RegExpMacroAssemblerIA32::SetCurrentPositionFromEnd(int by) { |
| 967 NearLabel after_position; |
| 968 __ cmp(edi, -by * char_size()); |
| 969 __ j(greater_equal, &after_position); |
| 970 __ mov(edi, -by * char_size()); |
| 971 // On RegExp code entry (where this operation is used), the character before |
| 972 // the current position is expected to be already loaded. |
| 973 // We have advanced the position, so it's safe to read backwards. |
| 974 LoadCurrentCharacterUnchecked(-1, 1); |
| 975 __ bind(&after_position); |
| 976 } |
967 | 977 |
968 void RegExpMacroAssemblerIA32::SetRegister(int register_index, int to) { | 978 void RegExpMacroAssemblerIA32::SetRegister(int register_index, int to) { |
969 ASSERT(register_index >= num_saved_registers_); // Reserved for positions! | 979 ASSERT(register_index >= num_saved_registers_); // Reserved for positions! |
970 __ mov(register_location(register_index), Immediate(to)); | 980 __ mov(register_location(register_index), Immediate(to)); |
971 } | 981 } |
972 | 982 |
973 | 983 |
974 void RegExpMacroAssemblerIA32::Succeed() { | 984 void RegExpMacroAssemblerIA32::Succeed() { |
975 __ jmp(&success_label_); | 985 __ jmp(&success_label_); |
976 } | 986 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 } | 1246 } |
1237 | 1247 |
1238 | 1248 |
1239 #undef __ | 1249 #undef __ |
1240 | 1250 |
1241 #endif // V8_INTERPRETED_REGEXP | 1251 #endif // V8_INTERPRETED_REGEXP |
1242 | 1252 |
1243 }} // namespace v8::internal | 1253 }} // namespace v8::internal |
1244 | 1254 |
1245 #endif // V8_TARGET_ARCH_IA32 | 1255 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |