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

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

Issue 554078: Don't pass the "at start" parameter to native RegExp... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.h ('k') | src/x64/simulator-x64.h » ('j') | no next file with comments »
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 * If changed to use r12+, they should be saved as callee-save registers. 64 * If changed to use r12+, they should be saved as callee-save registers.
65 * 65 *
66 * Each call to a C++ method should retain these registers. 66 * Each call to a C++ method should retain these registers.
67 * 67 *
68 * The stack will have the following content, in some order, indexable from the 68 * The stack will have the following content, in some order, indexable from the
69 * frame pointer (see, e.g., kStackHighEnd): 69 * frame pointer (see, e.g., kStackHighEnd):
70 * - direct_call (if 1, direct call from JavaScript code, if 0 call 70 * - direct_call (if 1, direct call from JavaScript code, if 0 call
71 * through the runtime system) 71 * through the runtime system)
72 * - stack_area_base (High end of the memory area to use as 72 * - stack_area_base (High end of the memory area to use as
73 * backtracking stack) 73 * backtracking stack)
74 * - at_start (if 1, we are starting at the start of the
75 * string, otherwise 0)
76 * - int* capture_array (int[num_saved_registers_], for output). 74 * - int* capture_array (int[num_saved_registers_], for output).
77 * - end of input (Address of end of string) 75 * - end of input (Address of end of string)
78 * - start of input (Address of first character in string) 76 * - start of input (Address of first character in string)
79 * - start index (character index of start) 77 * - start index (character index of start)
80 * - String* input_string (input string) 78 * - String* input_string (input string)
81 * - return address 79 * - return address
82 * - backup of callee save registers (rbx, possibly rsi and rdi). 80 * - backup of callee save registers (rbx, possibly rsi and rdi).
83 * - Offset of location before start of input (effectively character 81 * - Offset of location before start of input (effectively character
84 * position -1). Used to initialize capture registers to a non-position. 82 * position -1). Used to initialize capture registers to a non-position.
83 * - At start of string (if 1, we are starting at the start of the
84 * string, otherwise 0)
85 * - register 0 rbp[-n] (Only positions must be stored in the first 85 * - register 0 rbp[-n] (Only positions must be stored in the first
86 * - register 1 rbp[-n-8] num_saved_registers_ registers) 86 * - register 1 rbp[-n-8] num_saved_registers_ registers)
87 * - ... 87 * - ...
88 * 88 *
89 * The first num_saved_registers_ registers are initialized to point to 89 * The first num_saved_registers_ registers are initialized to point to
90 * "character -1" in the string (i.e., char_size() bytes before the first 90 * "character -1" in the string (i.e., char_size() bytes before the first
91 * character of the string). The remaining registers starts out uninitialized. 91 * character of the string). The remaining registers starts out uninitialized.
92 * 92 *
93 * The first seven values must be provided by the calling code by 93 * The first seven values must be provided by the calling code by
94 * calling the code's entry address cast to a function pointer with the 94 * calling the code's entry address cast to a function pointer with the
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 __ push(rdi); 654 __ push(rdi);
655 __ push(rbx); 655 __ push(rbx);
656 #else 656 #else
657 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9 (and then on stack). 657 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9 (and then on stack).
658 // Push register parameters on stack for reference. 658 // Push register parameters on stack for reference.
659 ASSERT_EQ(kInputString, -1 * kPointerSize); 659 ASSERT_EQ(kInputString, -1 * kPointerSize);
660 ASSERT_EQ(kStartIndex, -2 * kPointerSize); 660 ASSERT_EQ(kStartIndex, -2 * kPointerSize);
661 ASSERT_EQ(kInputStart, -3 * kPointerSize); 661 ASSERT_EQ(kInputStart, -3 * kPointerSize);
662 ASSERT_EQ(kInputEnd, -4 * kPointerSize); 662 ASSERT_EQ(kInputEnd, -4 * kPointerSize);
663 ASSERT_EQ(kRegisterOutput, -5 * kPointerSize); 663 ASSERT_EQ(kRegisterOutput, -5 * kPointerSize);
664 ASSERT_EQ(kAtStart, -6 * kPointerSize); 664 ASSERT_EQ(kStackHighEnd, -6 * kPointerSize);
665 __ push(rdi); 665 __ push(rdi);
666 __ push(rsi); 666 __ push(rsi);
667 __ push(rdx); 667 __ push(rdx);
668 __ push(rcx); 668 __ push(rcx);
669 __ push(r8); 669 __ push(r8);
670 __ push(r9); 670 __ push(r9);
671 671
672 __ push(rbx); // Callee-save 672 __ push(rbx); // Callee-save
673 #endif 673 #endif
674 __ push(Immediate(0)); // Make room for "input start - 1" constant. 674 __ push(Immediate(0)); // Make room for "input start - 1" constant.
675 __ push(Immediate(0)); // Make room for "at start" constant.
675 676
676 // Check if we have space on the stack for registers. 677 // Check if we have space on the stack for registers.
677 Label stack_limit_hit; 678 Label stack_limit_hit;
678 Label stack_ok; 679 Label stack_ok;
679 680
680 ExternalReference stack_limit = 681 ExternalReference stack_limit =
681 ExternalReference::address_of_stack_limit(); 682 ExternalReference::address_of_stack_limit();
682 __ movq(rcx, rsp); 683 __ movq(rcx, rsp);
683 __ movq(kScratchRegister, stack_limit); 684 __ movq(kScratchRegister, stack_limit);
684 __ subq(rcx, Operand(kScratchRegister, 0)); 685 __ subq(rcx, Operand(kScratchRegister, 0));
(...skipping 24 matching lines...) Expand all
709 // Load input position. 710 // Load input position.
710 __ movq(rdi, Operand(rbp, kInputStart)); 711 __ movq(rdi, Operand(rbp, kInputStart));
711 // Set up rdi to be negative offset from string end. 712 // Set up rdi to be negative offset from string end.
712 __ subq(rdi, rsi); 713 __ subq(rdi, rsi);
713 // Set rax to address of char before start of input 714 // Set rax to address of char before start of input
714 // (effectively string position -1). 715 // (effectively string position -1).
715 __ lea(rax, Operand(rdi, -char_size())); 716 __ lea(rax, Operand(rdi, -char_size()));
716 // Store this value in a local variable, for use when clearing 717 // Store this value in a local variable, for use when clearing
717 // position registers. 718 // position registers.
718 __ movq(Operand(rbp, kInputStartMinusOne), rax); 719 __ movq(Operand(rbp, kInputStartMinusOne), rax);
720
721 // Determine whether the start index is zero, that is at the start of the
722 // string, and store that value in a local variable.
723 __ movq(rbx, Operand(rbp, kStartIndex));
724 __ xor_(rcx, rcx); // setcc only operates on cl (lower byte of rcx).
725 __ testq(rbx, rbx);
726 __ setcc(zero, rcx); // 1 if 0 (start of string), 0 if positive.
727 __ movq(Operand(rbp, kAtStart), rcx);
728
719 if (num_saved_registers_ > 0) { 729 if (num_saved_registers_ > 0) {
720 // Fill saved registers with initial value = start offset - 1 730 // Fill saved registers with initial value = start offset - 1
721 // Fill in stack push order, to avoid accessing across an unwritten 731 // Fill in stack push order, to avoid accessing across an unwritten
722 // page (a problem on Windows). 732 // page (a problem on Windows).
723 __ movq(rcx, Immediate(kRegisterZero)); 733 __ movq(rcx, Immediate(kRegisterZero));
724 Label init_loop; 734 Label init_loop;
725 __ bind(&init_loop); 735 __ bind(&init_loop);
726 __ movq(Operand(rbp, rcx, times_1, 0), rax); 736 __ movq(Operand(rbp, rcx, times_1, 0), rax);
727 __ subq(rcx, Immediate(kPointerSize)); 737 __ subq(rcx, Immediate(kPointerSize));
728 __ cmpq(rcx, 738 __ cmpq(rcx,
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 Operand(rsi, rdi, times_1, cp_offset * sizeof(uc16))); 1327 Operand(rsi, rdi, times_1, cp_offset * sizeof(uc16)));
1318 } 1328 }
1319 } 1329 }
1320 } 1330 }
1321 1331
1322 #undef __ 1332 #undef __
1323 1333
1324 #endif // V8_NATIVE_REGEXP 1334 #endif // V8_NATIVE_REGEXP
1325 1335
1326 }} // namespace v8::internal 1336 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.h ('k') | src/x64/simulator-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698