OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // uncaptured. In either case succeed immediately. | 270 // uncaptured. In either case succeed immediately. |
271 __ j(equal, &fallthrough); | 271 __ j(equal, &fallthrough); |
272 | 272 |
273 if (mode_ == ASCII) { | 273 if (mode_ == ASCII) { |
274 Label success; | 274 Label success; |
275 Label fail; | 275 Label fail; |
276 Label loop_increment; | 276 Label loop_increment; |
277 // Save register contents to make the registers available below. | 277 // Save register contents to make the registers available below. |
278 __ push(edi); | 278 __ push(edi); |
279 __ push(backtrack_stackpointer()); | 279 __ push(backtrack_stackpointer()); |
280 // After this, the eax, ebx, ecx, edx and edi registers are available. | 280 // After this, the eax, ecx, and edi registers are available. |
281 | 281 |
282 __ add(edx, Operand(esi)); // Start of capture | 282 __ add(edx, Operand(esi)); // Start of capture |
283 __ add(edi, Operand(esi)); // Start of text to match against capture. | 283 __ add(edi, Operand(esi)); // Start of text to match against capture. |
284 __ add(ebx, Operand(edi)); // End of text to match against capture. | 284 __ add(ebx, Operand(edi)); // End of text to match against capture. |
285 | 285 |
286 Label loop; | 286 Label loop; |
287 __ bind(&loop); | 287 __ bind(&loop); |
288 __ movzx_b(eax, Operand(edi, 0)); | 288 __ movzx_b(eax, Operand(edi, 0)); |
289 __ cmpb_al(Operand(edx, 0)); | 289 __ cmpb_al(Operand(edx, 0)); |
290 __ j(equal, &loop_increment); | 290 __ j(equal, &loop_increment); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 341 |
342 // Set byte_length. | 342 // Set byte_length. |
343 __ mov(Operand(esp, 3 * kPointerSize), ebx); | 343 __ mov(Operand(esp, 3 * kPointerSize), ebx); |
344 // Set byte_offset2. | 344 // Set byte_offset2. |
345 // Found by adding negative string-end offset of current position (edi) | 345 // Found by adding negative string-end offset of current position (edi) |
346 // to String** offset of end of string. | 346 // to String** offset of end of string. |
347 __ mov(ecx, Operand(ebp, kInputEndOffset)); | 347 __ mov(ecx, Operand(ebp, kInputEndOffset)); |
348 __ add(edi, Operand(ecx)); | 348 __ add(edi, Operand(ecx)); |
349 __ mov(Operand(esp, 2 * kPointerSize), edi); | 349 __ mov(Operand(esp, 2 * kPointerSize), edi); |
350 // Set byte_offset1. | 350 // Set byte_offset1. |
351 // Start of capture, where eax already holds string-end negative offset. | 351 // Start of capture, where edx already holds string-end negative offset. |
352 __ add(eax, Operand(ecx)); | 352 __ add(edx, Operand(ecx)); |
353 __ mov(Operand(esp, 1 * kPointerSize), eax); | 353 __ mov(Operand(esp, 1 * kPointerSize), edx); |
354 // Set buffer. Original String** parameter to regexp code. | 354 // Set buffer. Original String** parameter to regexp code. |
355 __ mov(eax, Operand(ebp, kInputBuffer)); | 355 __ mov(eax, Operand(ebp, kInputBuffer)); |
356 __ mov(Operand(esp, 0 * kPointerSize), eax); | 356 __ mov(Operand(esp, 0 * kPointerSize), eax); |
357 | 357 |
358 Address function_address = FUNCTION_ADDR(&CaseInsensitiveCompareUC16); | 358 Address function_address = FUNCTION_ADDR(&CaseInsensitiveCompareUC16); |
359 CallCFunction(function_address, four_arguments); | 359 CallCFunction(function_address, four_arguments); |
360 // Pop original values before reacting on result value. | 360 // Pop original values before reacting on result value. |
361 __ pop(ebx); | 361 __ pop(ebx); |
362 __ pop(backtrack_stackpointer()); | 362 __ pop(backtrack_stackpointer()); |
363 __ pop(edi); | 363 __ pop(edi); |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 void RegExpMacroAssemblerIA32::WriteStackPointerToRegister(int reg) { | 972 void RegExpMacroAssemblerIA32::WriteStackPointerToRegister(int reg) { |
973 __ mov(register_location(reg), backtrack_stackpointer()); | 973 __ mov(register_location(reg), backtrack_stackpointer()); |
974 } | 974 } |
975 | 975 |
976 | 976 |
977 // Private methods: | 977 // Private methods: |
978 | 978 |
979 | 979 |
980 static unibrow::Mapping<unibrow::Ecma262Canonicalize> canonicalize; | 980 static unibrow::Mapping<unibrow::Ecma262Canonicalize> canonicalize; |
981 | 981 |
982 | |
983 RegExpMacroAssemblerIA32::Result RegExpMacroAssemblerIA32::Execute( | 982 RegExpMacroAssemblerIA32::Result RegExpMacroAssemblerIA32::Execute( |
984 Code* code, | 983 Code* code, |
985 Address* input, | 984 Address* input, |
986 int start_offset, | 985 int start_offset, |
987 int end_offset, | 986 int end_offset, |
988 int* output, | 987 int* output, |
989 bool at_start) { | 988 bool at_start) { |
990 typedef int (*matcher)(Address*, int, int, int*, int, void*); | 989 typedef int (*matcher)(Address*, int, int, int*, int, void*); |
991 matcher matcher_func = FUNCTION_CAST<matcher>(code->entry()); | 990 matcher matcher_func = FUNCTION_CAST<matcher>(code->entry()); |
992 | 991 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 | 1242 |
1244 | 1243 |
1245 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, | 1244 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, |
1246 ArraySlice* buffer) { | 1245 ArraySlice* buffer) { |
1247 __ mov(reg, buffer->array()); | 1246 __ mov(reg, buffer->array()); |
1248 __ add(Operand(reg), Immediate(buffer->base_offset())); | 1247 __ add(Operand(reg), Immediate(buffer->base_offset())); |
1249 } | 1248 } |
1250 | 1249 |
1251 #undef __ | 1250 #undef __ |
1252 }} // namespace v8::internal | 1251 }} // namespace v8::internal |
OLD | NEW |