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

Side by Side Diff: src/arm/regexp-macro-assembler-arm.cc

Issue 1114001: Refactoring of RegExp interface to better support calling several times in a row. (Closed)
Patch Set: Fix type that snuck into the commit. Created 10 years, 9 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 | « no previous file | src/ia32/codegen-ia32.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 __ bind(&stack_ok); 641 __ bind(&stack_ok);
642 642
643 // Allocate space on stack for registers. 643 // Allocate space on stack for registers.
644 __ sub(sp, sp, Operand(num_registers_ * kPointerSize)); 644 __ sub(sp, sp, Operand(num_registers_ * kPointerSize));
645 // Load string end. 645 // Load string end.
646 __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); 646 __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd));
647 // Load input start. 647 // Load input start.
648 __ ldr(r0, MemOperand(frame_pointer(), kInputStart)); 648 __ ldr(r0, MemOperand(frame_pointer(), kInputStart));
649 // Find negative length (offset of start relative to end). 649 // Find negative length (offset of start relative to end).
650 __ sub(current_input_offset(), r0, end_of_input_address()); 650 __ sub(current_input_offset(), r0, end_of_input_address());
651 // Set r0 to address of char before start of input 651 // Set r0 to address of char before start of input
Erik Corry 2010/03/19 11:04:11 start of input -> match start position.
Lasse Reichstein 2010/03/19 11:25:42 Actually "start of the input string". This is the
652 // (effectively string position -1). 652 // (effectively string position -1).
653 __ ldr(r1, MemOperand(frame_pointer(), kStartIndex));
653 __ sub(r0, current_input_offset(), Operand(char_size())); 654 __ sub(r0, current_input_offset(), Operand(char_size()));
655 __ sub(r0, r0, Operand(r1, LSL, (mode_ == UC16) ? 1 : 0));
654 // Store this value in a local variable, for use when clearing 656 // Store this value in a local variable, for use when clearing
655 // position registers. 657 // position registers.
656 __ str(r0, MemOperand(frame_pointer(), kInputStartMinusOne)); 658 __ str(r0, MemOperand(frame_pointer(), kInputStartMinusOne));
657 659
658 // Determine whether the start index is zero, that is at the start of the 660 // Determine whether the start index is zero, that is at the start of the
659 // string, and store that value in a local variable. 661 // string, and store that value in a local variable.
660 __ ldr(r1, MemOperand(frame_pointer(), kStartIndex));
661 __ tst(r1, Operand(r1)); 662 __ tst(r1, Operand(r1));
662 __ mov(r1, Operand(1), LeaveCC, eq); 663 __ mov(r1, Operand(1), LeaveCC, eq);
663 __ mov(r1, Operand(0), LeaveCC, ne); 664 __ mov(r1, Operand(0), LeaveCC, ne);
664 __ str(r1, MemOperand(frame_pointer(), kAtStart)); 665 __ str(r1, MemOperand(frame_pointer(), kAtStart));
665 666
666 if (num_saved_registers_ > 0) { // Always is, if generated from a regexp. 667 if (num_saved_registers_ > 0) { // Always is, if generated from a regexp.
667 // Fill saved registers with initial value = start offset - 1 668 // Fill saved registers with initial value = start offset - 1
668 669
669 // Address of register 0. 670 // Address of register 0.
670 __ add(r1, frame_pointer(), Operand(kRegisterZero)); 671 __ add(r1, frame_pointer(), Operand(kRegisterZero));
(...skipping 22 matching lines...) Expand all
693 694
694 695
695 // Exit code: 696 // Exit code:
696 if (success_label_.is_linked()) { 697 if (success_label_.is_linked()) {
697 // Save captures when successful. 698 // Save captures when successful.
698 __ bind(&success_label_); 699 __ bind(&success_label_);
699 if (num_saved_registers_ > 0) { 700 if (num_saved_registers_ > 0) {
700 // copy captures to output 701 // copy captures to output
701 __ ldr(r1, MemOperand(frame_pointer(), kInputStart)); 702 __ ldr(r1, MemOperand(frame_pointer(), kInputStart));
702 __ ldr(r0, MemOperand(frame_pointer(), kRegisterOutput)); 703 __ ldr(r0, MemOperand(frame_pointer(), kRegisterOutput));
704 __ ldr(r2, MemOperand(frame_pointer(), kStartIndex));
703 __ sub(r1, end_of_input_address(), r1); 705 __ sub(r1, end_of_input_address(), r1);
704 // r1 is length of input in bytes. 706 // r1 is length of input in bytes.
705 if (mode_ == UC16) { 707 if (mode_ == UC16) {
706 __ mov(r1, Operand(r1, LSR, 1)); 708 __ mov(r1, Operand(r1, LSR, 1));
707 } 709 }
708 // r1 is length of input in characters. 710 // r1 is length of input in characters.
711 __ add(r1, r1, Operand(r2));
712 // r1 is length of string in characters.
709 713
710 ASSERT_EQ(0, num_saved_registers_ % 2); 714 ASSERT_EQ(0, num_saved_registers_ % 2);
711 // Always an even number of capture registers. This allows us to 715 // Always an even number of capture registers. This allows us to
712 // unroll the loop once to add an operation between a load of a register 716 // unroll the loop once to add an operation between a load of a register
713 // and the following use of that register. 717 // and the following use of that register.
714 for (int i = 0; i < num_saved_registers_; i += 2) { 718 for (int i = 0; i < num_saved_registers_; i += 2) {
715 __ ldr(r2, register_location(i)); 719 __ ldr(r2, register_location(i));
716 __ ldr(r3, register_location(i + 1)); 720 __ ldr(r3, register_location(i + 1));
717 if (mode_ == UC16) { 721 if (mode_ == UC16) {
718 __ add(r2, r1, Operand(r2, ASR, 1)); 722 __ add(r2, r1, Operand(r2, ASR, 1));
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 __ mov(r0, sp); 1261 __ mov(r0, sp);
1258 __ Call(r5); 1262 __ Call(r5);
1259 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); 1263 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
1260 } 1264 }
1261 1265
1262 #undef __ 1266 #undef __
1263 1267
1264 #endif // V8_NATIVE_REGEXP 1268 #endif // V8_NATIVE_REGEXP
1265 1269
1266 }} // namespace v8::internal 1270 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698