OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 8453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8464 __ mov(ebx, Operand(esp, kPreviousIndexOffset)); | 8464 __ mov(ebx, Operand(esp, kPreviousIndexOffset)); |
8465 __ mov(ecx, Operand(esp, kJSRegExpOffset)); | 8465 __ mov(ecx, Operand(esp, kJSRegExpOffset)); |
8466 __ SmiUntag(ebx); // Previous index from smi. | 8466 __ SmiUntag(ebx); // Previous index from smi. |
8467 | 8467 |
8468 // eax: subject string | 8468 // eax: subject string |
8469 // ebx: previous index | 8469 // ebx: previous index |
8470 // edx: code | 8470 // edx: code |
8471 // All checks done. Now push arguments for native regexp code. | 8471 // All checks done. Now push arguments for native regexp code. |
8472 __ IncrementCounter(&Counters::regexp_entry_native, 1); | 8472 __ IncrementCounter(&Counters::regexp_entry_native, 1); |
8473 | 8473 |
8474 // Argument 8: Indicate that this is a direct call from JavaScript. | 8474 // Argument 7: Indicate that this is a direct call from JavaScript. |
8475 __ push(Immediate(1)); | 8475 __ push(Immediate(1)); |
8476 | 8476 |
8477 // Argument 7: Start (high end) of backtracking stack memory area. | 8477 // Argument 6: Start (high end) of backtracking stack memory area. |
8478 __ mov(ecx, Operand::StaticVariable(address_of_regexp_stack_memory_address)); | 8478 __ mov(ecx, Operand::StaticVariable(address_of_regexp_stack_memory_address)); |
8479 __ add(ecx, Operand::StaticVariable(address_of_regexp_stack_memory_size)); | 8479 __ add(ecx, Operand::StaticVariable(address_of_regexp_stack_memory_size)); |
8480 __ push(ecx); | 8480 __ push(ecx); |
8481 | 8481 |
8482 // Argument 6: At start of string? | |
8483 __ xor_(Operand(ecx), ecx); // setcc only operated on cl (lower byte of ecx). | |
8484 __ test(ebx, Operand(ebx)); | |
8485 __ setcc(zero, ecx); // 1 if 0 (start of string), 0 if positive. | |
8486 __ push(ecx); | |
8487 | |
8488 // Argument 5: static offsets vector buffer. | 8482 // Argument 5: static offsets vector buffer. |
8489 __ push(Immediate(ExternalReference::address_of_static_offsets_vector())); | 8483 __ push(Immediate(ExternalReference::address_of_static_offsets_vector())); |
8490 | 8484 |
8491 // Argument 4: End of string data | 8485 // Argument 4: End of string data |
8492 // Argument 3: Start of string data | 8486 // Argument 3: Start of string data |
8493 Label push_two_byte, push_rest; | 8487 Label push_two_byte, push_rest; |
8494 __ test(edi, Operand(edi)); | 8488 __ test(edi, Operand(edi)); |
8495 __ mov(edi, FieldOperand(eax, String::kLengthOffset)); | 8489 __ mov(edi, FieldOperand(eax, String::kLengthOffset)); |
8496 __ j(zero, &push_two_byte); | 8490 __ j(zero, &push_two_byte); |
8497 __ lea(ecx, FieldOperand(eax, edi, times_1, SeqAsciiString::kHeaderSize)); | 8491 __ lea(ecx, FieldOperand(eax, edi, times_1, SeqAsciiString::kHeaderSize)); |
(...skipping 14 matching lines...) Expand all Loading... |
8512 // Argument 2: Previous index. | 8506 // Argument 2: Previous index. |
8513 __ push(ebx); | 8507 __ push(ebx); |
8514 | 8508 |
8515 // Argument 1: Subject string. | 8509 // Argument 1: Subject string. |
8516 __ push(eax); | 8510 __ push(eax); |
8517 | 8511 |
8518 // Locate the code entry and call it. | 8512 // Locate the code entry and call it. |
8519 __ add(Operand(edx), Immediate(Code::kHeaderSize - kHeapObjectTag)); | 8513 __ add(Operand(edx), Immediate(Code::kHeaderSize - kHeapObjectTag)); |
8520 __ call(Operand(edx)); | 8514 __ call(Operand(edx)); |
8521 // Remove arguments. | 8515 // Remove arguments. |
8522 __ add(Operand(esp), Immediate(8 * kPointerSize)); | 8516 __ add(Operand(esp), Immediate(7 * kPointerSize)); |
8523 | 8517 |
8524 // Check the result. | 8518 // Check the result. |
8525 Label success; | 8519 Label success; |
8526 __ cmp(eax, NativeRegExpMacroAssembler::SUCCESS); | 8520 __ cmp(eax, NativeRegExpMacroAssembler::SUCCESS); |
8527 __ j(equal, &success, taken); | 8521 __ j(equal, &success, taken); |
8528 Label failure; | 8522 Label failure; |
8529 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); | 8523 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); |
8530 __ j(equal, &failure, taken); | 8524 __ j(equal, &failure, taken); |
8531 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); | 8525 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); |
8532 // If not exception it can only be retry. Handle that in the runtime system. | 8526 // If not exception it can only be retry. Handle that in the runtime system. |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9988 | 9982 |
9989 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 9983 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
9990 // tagged as a small integer. | 9984 // tagged as a small integer. |
9991 __ bind(&runtime); | 9985 __ bind(&runtime); |
9992 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); | 9986 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); |
9993 } | 9987 } |
9994 | 9988 |
9995 #undef __ | 9989 #undef __ |
9996 | 9990 |
9997 } } // namespace v8::internal | 9991 } } // namespace v8::internal |
OLD | NEW |