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

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

Issue 6614010: [Isolates] Merge 6700:7030 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.h ('k') | src/arm/simulator-arm.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 * LoadCurrentCharacter before using any of the dispatch methods. 50 * LoadCurrentCharacter before using any of the dispatch methods.
51 * - r8 : points to tip of backtrack stack 51 * - r8 : points to tip of backtrack stack
52 * - r9 : Unused, might be used by C code and expected unchanged. 52 * - r9 : Unused, might be used by C code and expected unchanged.
53 * - r10 : End of input (points to byte after last character in input). 53 * - r10 : End of input (points to byte after last character in input).
54 * - r11 : Frame pointer. Used to access arguments, local variables and 54 * - r11 : Frame pointer. Used to access arguments, local variables and
55 * RegExp registers. 55 * RegExp registers.
56 * - r12 : IP register, used by assembler. Very volatile. 56 * - r12 : IP register, used by assembler. Very volatile.
57 * - r13/sp : points to tip of C stack. 57 * - r13/sp : points to tip of C stack.
58 * 58 *
59 * The remaining registers are free for computations. 59 * The remaining registers are free for computations.
60 * Each call to a public method should retain this convention.
60 * 61 *
61 * Each call to a public method should retain this convention.
62 * The stack will have the following structure: 62 * The stack will have the following structure:
63 * - Isolate* isolate (Address of the current isolate) 63 * - fp[52] Isolate* isolate (Address of the current isolate)
64 * - direct_call (if 1, direct call from JavaScript code, if 0 call 64 * - fp[48] direct_call (if 1, direct call from JavaScript code,
65 * through the runtime system) 65 * if 0, call through the runtime system).
66 * - stack_area_base (High end of the memory area to use as 66 * - fp[44] stack_area_base (High end of the memory area to use as
67 * backtracking stack) 67 * backtracking stack).
68 * - int* capture_array (int[num_saved_registers_], for output). 68 * - fp[40] int* capture_array (int[num_saved_registers_], for output).
69 * --- sp when called --- 69 * - fp[36] secondary link/return address used by native call.
70 * - link address 70 * --- sp when called ---
71 * - backup of registers r4..r11 71 * - fp[32] return address (lr).
72 * - end of input (Address of end of string) 72 * - fp[28] old frame pointer (r11).
73 * - start of input (Address of first character in string) 73 * - fp[0..24] backup of registers r4..r10.
74 * - start index (character index of start) 74 * --- frame pointer ----
75 * --- frame pointer ---- 75 * - fp[-4] end of input (Address of end of string).
76 * - void* input_string (location of a handle containing the string) 76 * - fp[-8] start of input (Address of first character in string).
77 * - Offset of location before start of input (effectively character 77 * - fp[-12] start index (character index of start).
78 * position -1). Used to initialize capture registers to a non-position. 78 * - fp[-16] void* input_string (location of a handle containing the string).
79 * - At start (if 1, we are starting at the start of the 79 * - fp[-20] Offset of location before start of input (effectively character
80 * string, otherwise 0) 80 * position -1). Used to initialize capture registers to a
81 * - register 0 (Only positions must be stored in the first 81 * non-position.
82 * - register 1 num_saved_registers_ registers) 82 * - fp[-24] At start (if 1, we are starting at the start of the
83 * - ... 83 * string, otherwise 0)
84 * - register num_registers-1 84 * - fp[-28] register 0 (Only positions must be stored in the first
85 * --- sp --- 85 * - register 1 num_saved_registers_ registers)
86 * - ...
87 * - register num_registers-1
88 * --- sp ---
86 * 89 *
87 * The first num_saved_registers_ registers are initialized to point to 90 * The first num_saved_registers_ registers are initialized to point to
88 * "character -1" in the string (i.e., char_size() bytes before the first 91 * "character -1" in the string (i.e., char_size() bytes before the first
89 * character of the string). The remaining registers start out as garbage. 92 * character of the string). The remaining registers start out as garbage.
90 * 93 *
91 * The data up to the return address must be placed there by the calling 94 * The data up to the return address must be placed there by the calling
92 * code, by calling the code entry as cast to a function with the signature: 95 * code and the remaining arguments are passed in registers, e.g. by calling the
96 * code entry as cast to a function with the signature:
93 * int (*match)(String* input_string, 97 * int (*match)(String* input_string,
94 * int start_index, 98 * int start_index,
95 * Address start, 99 * Address start,
96 * Address end, 100 * Address end,
101 * Address secondary_return_address, // Only used by native call.
97 * int* capture_output_array, 102 * int* capture_output_array,
98 * bool at_start,
99 * byte* stack_area_base, 103 * byte* stack_area_base,
100 * bool direct_call) 104 * bool direct_call = false)
101 * The call is performed by NativeRegExpMacroAssembler::Execute() 105 * The call is performed by NativeRegExpMacroAssembler::Execute()
102 * (in regexp-macro-assembler.cc). 106 * (in regexp-macro-assembler.cc) via the CALL_GENERATED_REGEXP_CODE macro
107 * in arm/simulator-arm.h.
108 * When calling as a non-direct call (i.e., from C++ code), the return address
109 * area is overwritten with the LR register by the RegExp code. When doing a
110 * direct call from generated code, the return address is placed there by
111 * the calling code, as in a normal exit frame.
103 */ 112 */
104 113
105 #define __ ACCESS_MASM(masm_) 114 #define __ ACCESS_MASM(masm_)
106 115
107 RegExpMacroAssemblerARM::RegExpMacroAssemblerARM( 116 RegExpMacroAssemblerARM::RegExpMacroAssemblerARM(
108 Mode mode, 117 Mode mode,
109 int registers_to_save) 118 int registers_to_save)
110 : masm_(new MacroAssembler(NULL, kRegExpCodeSize)), 119 : masm_(new MacroAssembler(NULL, kRegExpCodeSize)),
111 mode_(mode), 120 mode_(mode),
112 num_registers_(registers_to_save), 121 num_registers_(registers_to_save),
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 __ jmp(&exit_label_); 601 __ jmp(&exit_label_);
593 } 602 }
594 603
595 604
596 Handle<Object> RegExpMacroAssemblerARM::GetCode(Handle<String> source) { 605 Handle<Object> RegExpMacroAssemblerARM::GetCode(Handle<String> source) {
597 // Finalize code - write the entry point code now we know how many 606 // Finalize code - write the entry point code now we know how many
598 // registers we need. 607 // registers we need.
599 608
600 // Entry code: 609 // Entry code:
601 __ bind(&entry_label_); 610 __ bind(&entry_label_);
602 // Push Link register.
603 // Push arguments 611 // Push arguments
604 // Save callee-save registers. 612 // Save callee-save registers.
605 // Start new stack frame. 613 // Start new stack frame.
614 // Store link register in existing stack-cell.
606 // Order here should correspond to order of offset constants in header file. 615 // Order here should correspond to order of offset constants in header file.
607 RegList registers_to_retain = r4.bit() | r5.bit() | r6.bit() | 616 RegList registers_to_retain = r4.bit() | r5.bit() | r6.bit() |
608 r7.bit() | r8.bit() | r9.bit() | r10.bit() | fp.bit(); 617 r7.bit() | r8.bit() | r9.bit() | r10.bit() | fp.bit();
609 RegList argument_registers = r0.bit() | r1.bit() | r2.bit() | r3.bit(); 618 RegList argument_registers = r0.bit() | r1.bit() | r2.bit() | r3.bit();
610 __ stm(db_w, sp, argument_registers | registers_to_retain | lr.bit()); 619 __ stm(db_w, sp, argument_registers | registers_to_retain | lr.bit());
611 // Set frame pointer just above the arguments. 620 // Set frame pointer in space for it if this is not a direct call
621 // from generated code.
612 __ add(frame_pointer(), sp, Operand(4 * kPointerSize)); 622 __ add(frame_pointer(), sp, Operand(4 * kPointerSize));
613 __ push(r0); // Make room for "position - 1" constant (value is irrelevant). 623 __ push(r0); // Make room for "position - 1" constant (value is irrelevant).
614 __ push(r0); // Make room for "at start" constant (value is irrelevant). 624 __ push(r0); // Make room for "at start" constant (value is irrelevant).
615 // Check if we have space on the stack for registers. 625 // Check if we have space on the stack for registers.
616 Label stack_limit_hit; 626 Label stack_limit_hit;
617 Label stack_ok; 627 Label stack_ok;
618 628
619 ExternalReference stack_limit = 629 ExternalReference stack_limit =
620 ExternalReference::address_of_stack_limit(); 630 ExternalReference::address_of_stack_limit();
621 __ mov(r0, Operand(stack_limit)); 631 __ mov(r0, Operand(stack_limit));
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 768
759 // String might have moved: Reload end of string from frame. 769 // String might have moved: Reload end of string from frame.
760 __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); 770 __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd));
761 SafeReturn(); 771 SafeReturn();
762 } 772 }
763 773
764 // Backtrack stack overflow code. 774 // Backtrack stack overflow code.
765 if (stack_overflow_label_.is_linked()) { 775 if (stack_overflow_label_.is_linked()) {
766 SafeCallTarget(&stack_overflow_label_); 776 SafeCallTarget(&stack_overflow_label_);
767 // Reached if the backtrack-stack limit has been hit. 777 // Reached if the backtrack-stack limit has been hit.
768
769 Label grow_failed; 778 Label grow_failed;
770 779
771 // Call GrowStack(backtrack_stackpointer()) 780 // Call GrowStack(backtrack_stackpointer(), &stack_base)
772 static const int num_arguments = 2; 781 static const int num_arguments = 2;
773 __ PrepareCallCFunction(num_arguments, r0); 782 __ PrepareCallCFunction(num_arguments, r0);
774 __ mov(r0, backtrack_stackpointer()); 783 __ mov(r0, backtrack_stackpointer());
775 __ add(r1, frame_pointer(), Operand(kStackHighEnd)); 784 __ add(r1, frame_pointer(), Operand(kStackHighEnd));
776 ExternalReference grow_stack = 785 ExternalReference grow_stack =
777 ExternalReference::re_grow_stack(); 786 ExternalReference::re_grow_stack();
778 __ CallCFunction(grow_stack, num_arguments); 787 __ CallCFunction(grow_stack, num_arguments);
779 // If return NULL, we have failed to grow the stack, and 788 // If return NULL, we have failed to grow the stack, and
780 // must exit with a stack-overflow exception. 789 // must exit with a stack-overflow exception.
781 __ cmp(r0, Operand(0, RelocInfo::NONE)); 790 __ cmp(r0, Operand(0, RelocInfo::NONE));
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); 1274 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
1266 } 1275 }
1267 1276
1268 #undef __ 1277 #undef __
1269 1278
1270 #endif // V8_INTERPRETED_REGEXP 1279 #endif // V8_INTERPRETED_REGEXP
1271 1280
1272 }} // namespace v8::internal 1281 }} // namespace v8::internal
1273 1282
1274 #endif // V8_TARGET_ARCH_ARM 1283 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.h ('k') | src/arm/simulator-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698