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

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

Issue 549079: Support for MIPS in architecture independent files.... (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
OLDNEW
(Empty)
1
2 // FROM ARM Code
3
4 #include "v8.h"
5 #include "unicode.h"
6 #include "log.h"
7 #include "ast.h"
8 #include "regexp-stack.h"
9 #include "macro-assembler.h"
10 #include "regexp-macro-assembler.h"
11 #include "mips/macro-assembler-mips.h"
12 #include "mips/regexp-macro-assembler-mips.h"
13
14 namespace v8 {
15 namespace internal {
16
17 #ifdef V8_NATIVE_REGEXP
18 /*
19 * This assembler uses the following register assignment convention
20 * - r5 : Pointer to current code object (Code*) including heap object tag.
21 * - r6 : Current position in input, as negative offset from end of string.
22 * Please notice that this is the byte offset, not the character offset!
23 * - r7 : Currently loaded character. Must be loaded using
24 * LoadCurrentCharacter before using any of the dispatch methods.
25 * - r8 : points to tip of backtrack stack
26 * - r9 : Unused, might be used by C code and expected unchanged.
27 * - r10 : End of input (points to byte after last character in input).
28 * - r11 : Frame pointer. Used to access arguments, local variables and
29 * RegExp registers.
30 * - r12 : IP register, used by assembler. Very volatile.
31 * - r13/sp : points to tip of C stack.
32 *
33 * The remaining registers are free for computations.
34 *
35 * Each call to a public method should retain this convention.
36 * The stack will have the following structure:
37 * - stack_area_base (High end of the memory area to use as
38 * backtracking stack)
39 * - at_start (if 1, start at start of string, if 0, don't)
40 * --- sp when called ---
41 * - link address
42 * - backup of registers r4..r11
43 * - int* capture_array (int[num_saved_registers_], for output).
44 * - end of input (Address of end of string)
45 * - start of input (Address of first character in string)
46 * --- frame pointer ----
47 * - void* input_string (location of a handle containing the string)
48 * - Offset of location before start of input (effectively character
49 * position -1). Used to initialize capture registers to a non-position.
50 * - register 0 (Only positions must be stored in the first
51 * - register 1 num_saved_registers_ registers)
52 * - ...
53 * - register num_registers-1
54 * --- sp ---
55 *
56 * The first num_saved_registers_ registers are initialized to point to
57 * "character -1" in the string (i.e., char_size() bytes before the first
58 * character of the string). The remaining registers start out as garbage.
59 *
60 * The data up to the return address must be placed there by the calling
61 * code, by calling the code entry as cast to a function with the signature:
62 * int (*match)(String* input_string,
63 * Address start,
64 * Address end,
65 * int* capture_output_array,
66 * bool at_start,
67 * byte* stack_area_base)
68 * The call is performed by NativeRegExpMacroAssembler::Execute()
69 * (in regexp-macro-assembler.cc).
70 */
71
72 #define __ ACCESS_MASM(masm_)
73
74 RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(
75 Mode mode,
76 int registers_to_save)
77 : masm_(new MacroAssembler(NULL, kRegExpCodeSize)),
78 mode_(mode),
79 num_registers_(registers_to_save),
80 num_saved_registers_(registers_to_save),
81 entry_label_(),
82 start_label_(),
83 success_label_(),
84 backtrack_label_(),
85 exit_label_() {
86 // ASSERT_EQ(0, registers_to_save % 2);
87 // __ jmp(&entry_label_); // We'll write the entry code later.
88 // EmitBacktrackConstantPool();
89 // __ bind(&start_label_); // And then continue from here.
90 }
91 //
92 //
93 RegExpMacroAssemblerMIPS::~RegExpMacroAssemblerMIPS() {
94 UNIMPLEMENTED();
95 delete masm_;
96 // Unuse labels in case we throw away the assembler without calling GetCode.
97 // entry_label_.Unuse();
98 // start_label_.Unuse();
99 // success_label_.Unuse();
100 // backtrack_label_.Unuse();
101 // exit_label_.Unuse();
102 // check_preempt_label_.Unuse();
103 // stack_overflow_label_.Unuse();
104 }
105
106
107 int RegExpMacroAssemblerMIPS::stack_limit_slack() {
108 UNIMPLEMENTED();
109 // return RegExpStack::kStackLimitSlack;
110 return 0;
111 }
112
113
114 void RegExpMacroAssemblerMIPS::AdvanceCurrentPosition(int by) {
115 UNIMPLEMENTED();
116 // if (by != 0) {
117 // Label inside_string;
118 // __ add(current_input_offset(),
119 // current_input_offset(), Operand(by * char_size()));
120 // }
121 }
122
123
124 void RegExpMacroAssemblerMIPS::AdvanceRegister(int reg, int by) {
125 UNIMPLEMENTED();
126 // ASSERT(reg >= 0);
127 // ASSERT(reg < num_registers_);
128 // if (by != 0) {
129 // __ ldr(r0, register_location(reg));
130 // __ add(r0, r0, Operand(by));
131 // __ str(r0, register_location(reg));
132 // }
133 }
134
135
136 void RegExpMacroAssemblerMIPS::Backtrack() {
137 UNIMPLEMENTED();
138 // CheckPreemption();
139 // // Pop Code* offset from backtrack stack, add Code* and jump to location.
140 // Pop(r0);
141 // __ add(pc, r0, Operand(r5));
142 }
143
144
145 void RegExpMacroAssemblerMIPS::Bind(Label* label) {
146 UNIMPLEMENTED();
147 // __ bind(label);
148 }
149
150
151 void RegExpMacroAssemblerMIPS::CheckCharacter(uint32_t c, Label* on_equal) {
152 UNIMPLEMENTED();
153 // __ cmp(current_character(), Operand(c));
154 // BranchOrBacktrack(eq, on_equal);
155 }
156
157
158 void RegExpMacroAssemblerMIPS::CheckCharacterGT(uc16 limit, Label* on_greater) {
159 UNIMPLEMENTED();
160 // __ cmp(current_character(), Operand(limit));
161 // BranchOrBacktrack(gt, on_greater);
162 }
163
164
165 void RegExpMacroAssemblerMIPS::CheckAtStart(Label* on_at_start) {
166 UNIMPLEMENTED();
167 // Label not_at_start;
168 // // Did we start the match at the start of the string at all?
169 // __ ldr(r0, MemOperand(frame_pointer(), kAtStart));
170 // __ cmp(r0, Operand(0));
171 // BranchOrBacktrack(eq, &not_at_start);
172 //
173 // // If we did, are we still at the start of the input?
174 // __ ldr(r1, MemOperand(frame_pointer(), kInputStart));
175 // __ add(r0, end_of_input_address(), Operand(current_input_offset()));
176 // __ cmp(r0, r1);
177 // BranchOrBacktrack(eq, on_at_start);
178 // __ bind(&not_at_start);
179 }
180
181
182 void RegExpMacroAssemblerMIPS::CheckNotAtStart(Label* on_not_at_start) {
183 UNIMPLEMENTED();
184 // // Did we start the match at the start of the string at all?
185 // __ ldr(r0, MemOperand(frame_pointer(), kAtStart));
186 // __ cmp(r0, Operand(0));
187 // BranchOrBacktrack(eq, on_not_at_start);
188 // // If we did, are we still at the start of the input?
189 // __ ldr(r1, MemOperand(frame_pointer(), kInputStart));
190 // __ add(r0, end_of_input_address(), Operand(current_input_offset()));
191 // __ cmp(r0, r1);
192 // BranchOrBacktrack(ne, on_not_at_start);
193 }
194
195
196 void RegExpMacroAssemblerMIPS::CheckCharacterLT(uc16 limit, Label* on_less) {
197 UNIMPLEMENTED();
198 // __ cmp(current_character(), Operand(limit));
199 // BranchOrBacktrack(lt, on_less);
200 }
201
202
203 void RegExpMacroAssemblerMIPS::CheckCharacters(Vector<const uc16> str,
204 int cp_offset,
205 Label* on_failure,
206 bool check_end_of_string) {
207 UNIMPLEMENTED();
208 // if (on_failure == NULL) {
209 // // Instead of inlining a backtrack for each test, (re)use the global
210 // // backtrack target.
211 // on_failure = &backtrack_label_;
212 // }
213 //
214 // if (check_end_of_string) {
215 // // Is last character of required match inside string.
216 // CheckPosition(cp_offset + str.length() - 1, on_failure);
217 // }
218 //
219 // __ add(r0, end_of_input_address(), Operand(current_input_offset()));
220 // if (cp_offset != 0) {
221 // int byte_offset = cp_offset * char_size();
222 // __ add(r0, r0, Operand(byte_offset));
223 // }
224 //
225 // // r0 : Address of characters to match against str.
226 // int stored_high_byte = 0;
227 // for (int i = 0; i < str.length(); i++) {
228 // if (mode_ == ASCII) {
229 // __ ldrb(r1, MemOperand(r0, char_size(), PostIndex));
230 // ASSERT(str[i] <= String::kMaxAsciiCharCode);
231 // __ cmp(r1, Operand(str[i]));
232 // } else {
233 // __ ldrh(r1, MemOperand(r0, char_size(), PostIndex));
234 // uc16 match_char = str[i];
235 // int match_high_byte = (match_char >> 8);
236 // if (match_high_byte == 0) {
237 // __ cmp(r1, Operand(str[i]));
238 // } else {
239 // if (match_high_byte != stored_high_byte) {
240 // __ mov(r2, Operand(match_high_byte));
241 // stored_high_byte = match_high_byte;
242 // }
243 // __ add(r3, r2, Operand(match_char & 0xff));
244 // __ cmp(r1, r3);
245 // }
246 // }
247 // BranchOrBacktrack(ne, on_failure);
248 // }
249 }
250
251
252 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) {
253 UNIMPLEMENTED();
254 // __ ldr(r0, MemOperand(backtrack_stackpointer(), 0));
255 // __ cmp(current_input_offset(), r0);
256 // __ add(backtrack_stackpointer(),
257 // backtrack_stackpointer(), Operand(kPointerSize), LeaveCC, eq);
258 // BranchOrBacktrack(eq, on_equal);
259 }
260
261
262 void RegExpMacroAssemblerMIPS::CheckNotBackReferenceIgnoreCase(
263 int start_reg,
264 Label* on_no_match) {
265 UNIMPLEMENTED();
266 // Label fallthrough;
267 // __ ldr(r0, register_location(start_reg)); // Index of start of capture
268 // __ ldr(r1, register_location(start_reg + 1)); // Index of end of capture
269 // __ sub(r1, r1, r0, SetCC); // Length of capture.
270 //
271 // // If length is zero, either the capture is empty or it is not participating .
272 // // In either case succeed immediately.
273 // __ b(eq, &fallthrough);
274 //
275 // // Check that there are enough characters left in the input.
276 // __ cmn(r1, Operand(current_input_offset()));
277 // BranchOrBacktrack(gt, on_no_match);
278 //
279 // if (mode_ == ASCII) {
280 // Label success;
281 // Label fail;
282 // Label loop_check;
283 //
284 // // r0 - offset of start of capture
285 // // r1 - length of capture
286 // __ add(r0, r0, Operand(end_of_input_address()));
287 // __ add(r2, end_of_input_address(), Operand(current_input_offset()));
288 // __ add(r1, r0, Operand(r1));
289 //
290 // // r0 - Address of start of capture.
291 // // r1 - Address of end of capture
292 // // r2 - Address of current input position.
293 //
294 // Label loop;
295 // __ bind(&loop);
296 // __ ldrb(r3, MemOperand(r0, char_size(), PostIndex));
297 // __ ldrb(r4, MemOperand(r2, char_size(), PostIndex));
298 // __ cmp(r4, r3);
299 // __ b(eq, &loop_check);
300 //
301 // // Mismatch, try case-insensitive match (converting letters to lower-case) .
302 // __ orr(r3, r3, Operand(0x20)); // Convert capture character to lower-case .
303 // __ orr(r4, r4, Operand(0x20)); // Also convert input character.
304 // __ cmp(r4, r3);
305 // __ b(ne, &fail);
306 // __ sub(r3, r3, Operand('a'));
307 // __ cmp(r3, Operand('z' - 'a')); // Is r3 a lowercase letter?
308 // __ b(hi, &fail);
309 //
310 //
311 // __ bind(&loop_check);
312 // __ cmp(r0, r1);
313 // __ b(lt, &loop);
314 // __ jmp(&success);
315 //
316 // __ bind(&fail);
317 // BranchOrBacktrack(al, on_no_match);
318 //
319 // __ bind(&success);
320 // // Compute new value of character position after the matched part.
321 // __ sub(current_input_offset(), r2, end_of_input_address());
322 // } else {
323 // ASSERT(mode_ == UC16);
324 // int argument_count = 3;
325 // FrameAlign(argument_count, r2);
326 //
327 // // r0 - offset of start of capture
328 // // r1 - length of capture
329 //
330 // // Put arguments into arguments registers.
331 // // Parameters are
332 // // r0: Address byte_offset1 - Address captured substring's start.
333 // // r1: Address byte_offset2 - Address of current character position.
334 // // r2: size_t byte_length - length of capture in bytes(!)
335 //
336 // // Address of start of capture.
337 // __ add(r0, r0, Operand(end_of_input_address()));
338 // // Length of capture.
339 // __ mov(r2, Operand(r1));
340 // // Save length in callee-save register for use on return.
341 // __ mov(r4, Operand(r1));
342 // // Address of current input position.
343 // __ add(r1, current_input_offset(), Operand(end_of_input_address()));
344 //
345 // ExternalReference function =
346 // ExternalReference::re_case_insensitive_compare_uc16();
347 // CallCFunction(function, argument_count);
348 //
349 // // Check if function returned non-zero for success or zero for failure.
350 // __ cmp(r0, Operand(0));
351 // BranchOrBacktrack(eq, on_no_match);
352 // // On success, increment position by length of capture.
353 // __ add(current_input_offset(), current_input_offset(), Operand(r4));
354 // }
355 //
356 // __ bind(&fallthrough);
357 }
358
359
360 void RegExpMacroAssemblerMIPS::CheckNotBackReference(
361 int start_reg,
362 Label* on_no_match) {
363 UNIMPLEMENTED();
364 // Label fallthrough;
365 // Label success;
366 //
367 // // Find length of back-referenced capture.
368 // __ ldr(r0, register_location(start_reg));
369 // __ ldr(r1, register_location(start_reg + 1));
370 // __ sub(r1, r1, r0, SetCC); // Length to check.
371 // // Succeed on empty capture (including no capture).
372 // __ b(eq, &fallthrough);
373 //
374 // // Check that there are enough characters left in the input.
375 // __ cmn(r1, Operand(current_input_offset()));
376 // BranchOrBacktrack(gt, on_no_match);
377 //
378 // // Compute pointers to match string and capture string
379 // __ add(r0, r0, Operand(end_of_input_address()));
380 // __ add(r2, end_of_input_address(), Operand(current_input_offset()));
381 // __ add(r1, r1, Operand(r0));
382 //
383 // Label loop;
384 // __ bind(&loop);
385 // if (mode_ == ASCII) {
386 // __ ldrb(r3, MemOperand(r0, char_size(), PostIndex));
387 // __ ldrb(r4, MemOperand(r2, char_size(), PostIndex));
388 // } else {
389 // ASSERT(mode_ == UC16);
390 // __ ldrh(r3, MemOperand(r0, char_size(), PostIndex));
391 // __ ldrh(r4, MemOperand(r2, char_size(), PostIndex));
392 // }
393 // __ cmp(r3, r4);
394 // BranchOrBacktrack(ne, on_no_match);
395 // __ cmp(r0, r1);
396 // __ b(lt, &loop);
397 //
398 // // Move current character position to position after match.
399 // __ sub(current_input_offset(), r2, end_of_input_address());
400 // __ bind(&fallthrough);
401 }
402
403
404 void RegExpMacroAssemblerMIPS::CheckNotRegistersEqual(int reg1,
405 int reg2,
406 Label* on_not_equal) {
407 UNIMPLEMENTED();
408 // __ ldr(r0, register_location(reg1));
409 // __ ldr(r1, register_location(reg2));
410 // __ cmp(r0, r1);
411 // BranchOrBacktrack(ne, on_not_equal);
412 }
413
414
415 void RegExpMacroAssemblerMIPS::CheckNotCharacter(uint32_t c,
416 Label* on_not_equal) {
417 UNIMPLEMENTED();
418 // __ cmp(current_character(), Operand(c));
419 // BranchOrBacktrack(ne, on_not_equal);
420 }
421
422
423 void RegExpMacroAssemblerMIPS::CheckCharacterAfterAnd(uint32_t c,
424 uint32_t mask,
425 Label* on_equal) {
426 UNIMPLEMENTED();
427 // __ and_(r0, current_character(), Operand(mask));
428 // __ cmp(r0, Operand(c));
429 // BranchOrBacktrack(eq, on_equal);
430 }
431
432
433 void RegExpMacroAssemblerMIPS::CheckNotCharacterAfterAnd(uint32_t c,
434 uint32_t mask,
435 Label* on_not_equal) {
436 UNIMPLEMENTED();
437 // __ and_(r0, current_character(), Operand(mask));
438 // __ cmp(r0, Operand(c));
439 // BranchOrBacktrack(ne, on_not_equal);
440 }
441
442
443 void RegExpMacroAssemblerMIPS::CheckNotCharacterAfterMinusAnd(
444 uc16 c,
445 uc16 minus,
446 uc16 mask,
447 Label* on_not_equal) {
448 UNIMPLEMENTED();
449 // ASSERT(minus < String::kMaxUC16CharCode);
450 // __ sub(r0, current_character(), Operand(minus));
451 // __ and_(r0, r0, Operand(mask));
452 // __ cmp(r0, Operand(c));
453 // BranchOrBacktrack(ne, on_not_equal);
454 }
455
456
457 bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(uc16 type,
458 int cp_offset,
459 bool check_offset,
460 Label* on_no_match) {
461 UNIMPLEMENTED();
462 // // Range checks (c in min..max) are generally implemented by an unsigned
463 // // (c - min) <= (max - min) check
464 // switch (type) {
465 // case 's':
466 // // Match space-characters
467 // if (mode_ == ASCII) {
468 // // ASCII space characters are '\t'..'\r' and ' '.
469 // if (check_offset) {
470 // LoadCurrentCharacter(cp_offset, on_no_match);
471 // } else {
472 // LoadCurrentCharacterUnchecked(cp_offset, 1);
473 // }
474 // Label success;
475 // __ cmp(current_character(), Operand(' '));
476 // __ b(eq, &success);
477 // // Check range 0x09..0x0d
478 // __ sub(r0, current_character(), Operand('\t'));
479 // __ cmp(r0, Operand('\r' - '\t'));
480 // BranchOrBacktrack(hi, on_no_match);
481 // __ bind(&success);
482 // return true;
483 // }
484 // return false;
485 // case 'S':
486 // // Match non-space characters.
487 // if (check_offset) {
488 // LoadCurrentCharacter(cp_offset, on_no_match, 1);
489 // } else {
490 // LoadCurrentCharacterUnchecked(cp_offset, 1);
491 // }
492 // if (mode_ == ASCII) {
493 // // ASCII space characters are '\t'..'\r' and ' '.
494 // __ cmp(current_character(), Operand(' '));
495 // BranchOrBacktrack(eq, on_no_match);
496 // __ sub(r0, current_character(), Operand('\t'));
497 // __ cmp(r0, Operand('\r' - '\t'));
498 // BranchOrBacktrack(ls, on_no_match);
499 // return true;
500 // }
501 // return false;
502 // case 'd':
503 // // Match ASCII digits ('0'..'9')
504 // if (check_offset) {
505 // LoadCurrentCharacter(cp_offset, on_no_match, 1);
506 // } else {
507 // LoadCurrentCharacterUnchecked(cp_offset, 1);
508 // }
509 // __ sub(r0, current_character(), Operand('0'));
510 // __ cmp(current_character(), Operand('9' - '0'));
511 // BranchOrBacktrack(hi, on_no_match);
512 // return true;
513 // case 'D':
514 // // Match non ASCII-digits
515 // if (check_offset) {
516 // LoadCurrentCharacter(cp_offset, on_no_match, 1);
517 // } else {
518 // LoadCurrentCharacterUnchecked(cp_offset, 1);
519 // }
520 // __ sub(r0, current_character(), Operand('0'));
521 // __ cmp(r0, Operand('9' - '0'));
522 // BranchOrBacktrack(ls, on_no_match);
523 // return true;
524 // case '.': {
525 // // Match non-newlines (not 0x0a('\n'), 0x0d('\r'), 0x2028 and 0x2029)
526 // if (check_offset) {
527 // LoadCurrentCharacter(cp_offset, on_no_match, 1);
528 // } else {
529 // LoadCurrentCharacterUnchecked(cp_offset, 1);
530 // }
531 // __ eor(r0, current_character(), Operand(0x01));
532 // // See if current character is '\n'^1 or '\r'^1, i.e., 0x0b or 0x0c
533 // __ sub(r0, r0, Operand(0x0b));
534 // __ cmp(r0, Operand(0x0c - 0x0b));
535 // BranchOrBacktrack(ls, on_no_match);
536 // if (mode_ == UC16) {
537 // // Compare original value to 0x2028 and 0x2029, using the already
538 // // computed (current_char ^ 0x01 - 0x0b). I.e., check for
539 // // 0x201d (0x2028 - 0x0b) or 0x201e.
540 // __ sub(r0, r0, Operand(0x2028 - 0x0b));
541 // __ cmp(r0, Operand(1));
542 // BranchOrBacktrack(ls, on_no_match);
543 // }
544 // return true;
545 // }
546 // case '*':
547 // // Match any character.
548 // if (check_offset) {
549 // CheckPosition(cp_offset, on_no_match);
550 // }
551 // return true;
552 // // No custom implementation (yet): w, W, s(UC16), S(UC16).
553 // default:
554 // return false;
555 // }
556 return false;
557 }
558
559
560 void RegExpMacroAssemblerMIPS::Fail() {
561 UNIMPLEMENTED();
562 // __ mov(r0, Operand(FAILURE));
563 // __ jmp(&exit_label_);
564 }
565
566
567 Handle<Object> RegExpMacroAssemblerMIPS::GetCode(Handle<String> source) {
568 UNIMPLEMENTED();
569 // // Finalize code - write the entry point code now we know how many
570 // // registers we need.
571 //
572 // // Entry code:
573 // __ bind(&entry_label_);
574 // // Push Link register.
575 // // Push arguments
576 // // Save callee-save registers.
577 // // Start new stack frame.
578 // // Order here should correspond to order of offset constants in header file.
579 // RegList registers_to_retain = r4.bit() | r5.bit() | r6.bit() |
580 // r7.bit() | r8.bit() | r9.bit() | r10.bit() | fp.bit();
581 // RegList argument_registers = r0.bit() | r1.bit() | r2.bit() | r3.bit();
582 // __ stm(db_w, sp, argument_registers | registers_to_retain | lr.bit());
583 // // Set frame pointer just above the arguments.
584 // __ add(frame_pointer(), sp, Operand(4 * kPointerSize));
585 // __ push(r0); // Make room for "position - 1" constant (value is irrelevant) .
586 //
587 // // Check if we have space on the stack for registers.
588 // Label stack_limit_hit;
589 // Label stack_ok;
590 //
591 // ExternalReference stack_guard_limit =
592 // ExternalReference::address_of_stack_guard_limit();
593 // __ mov(r0, Operand(stack_guard_limit));
594 // __ ldr(r0, MemOperand(r0));
595 // __ sub(r0, sp, r0, SetCC);
596 // // Handle it if the stack pointer is already below the stack limit.
597 // __ b(ls, &stack_limit_hit);
598 // // Check if there is room for the variable number of registers above
599 // // the stack limit.
600 // __ cmp(r0, Operand(num_registers_ * kPointerSize));
601 // __ b(hs, &stack_ok);
602 // // Exit with OutOfMemory exception. There is not enough space on the stack
603 // // for our working registers.
604 // __ mov(r0, Operand(EXCEPTION));
605 // __ jmp(&exit_label_);
606 //
607 // __ bind(&stack_limit_hit);
608 // CallCheckStackGuardState(r0);
609 // __ cmp(r0, Operand(0));
610 // // If returned value is non-zero, we exit with the returned value as result.
611 // __ b(ne, &exit_label_);
612 //
613 // __ bind(&stack_ok);
614 //
615 // // Allocate space on stack for registers.
616 // __ sub(sp, sp, Operand(num_registers_ * kPointerSize));
617 // // Load string end.
618 // __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd));
619 // // Load input start.
620 // __ ldr(r0, MemOperand(frame_pointer(), kInputStart));
621 // // Find negative length (offset of start relative to end).
622 // __ sub(current_input_offset(), r0, end_of_input_address());
623 // // Set r0 to address of char before start of input
624 // // (effectively string position -1).
625 // __ sub(r0, current_input_offset(), Operand(char_size()));
626 // // Store this value in a local variable, for use when clearing
627 // // position registers.
628 // __ str(r0, MemOperand(frame_pointer(), kInputStartMinusOne));
629 // if (num_saved_registers_ > 0) { // Always is, if generated from a regexp.
630 // // Fill saved registers with initial value = start offset - 1
631 //
632 // // Address of register 0.
633 // __ add(r1, frame_pointer(), Operand(kRegisterZero));
634 // __ mov(r2, Operand(num_saved_registers_));
635 // Label init_loop;
636 // __ bind(&init_loop);
637 // __ str(r0, MemOperand(r1, kPointerSize, NegPostIndex));
638 // __ sub(r2, r2, Operand(1), SetCC);
639 // __ b(ne, &init_loop);
640 // }
641 //
642 // // Initialize backtrack stack pointer.
643 // __ ldr(backtrack_stackpointer(), MemOperand(frame_pointer(), kStackHighEnd)) ;
644 // // Initialize code pointer register
645 // __ mov(code_pointer(), Operand(masm_->CodeObject()));
646 // // Load previous char as initial value of current character register.
647 // Label at_start;
648 // __ ldr(r0, MemOperand(frame_pointer(), kAtStart));
649 // __ cmp(r0, Operand(0));
650 // __ b(ne, &at_start);
651 // LoadCurrentCharacterUnchecked(-1, 1); // Load previous char.
652 // __ jmp(&start_label_);
653 // __ bind(&at_start);
654 // __ mov(current_character(), Operand('\n'));
655 // __ jmp(&start_label_);
656 //
657 //
658 // // Exit code:
659 // if (success_label_.is_linked()) {
660 // // Save captures when successful.
661 // __ bind(&success_label_);
662 // if (num_saved_registers_ > 0) {
663 // // copy captures to output
664 // __ ldr(r1, MemOperand(frame_pointer(), kInputStart));
665 // __ ldr(r0, MemOperand(frame_pointer(), kRegisterOutput));
666 // __ sub(r1, end_of_input_address(), r1);
667 // // r1 is length of input in bytes.
668 // if (mode_ == UC16) {
669 // __ mov(r1, Operand(r1, LSR, 1));
670 // }
671 // // r1 is length of input in characters.
672 //
673 // ASSERT_EQ(0, num_saved_registers_ % 2);
674 // // Always an even number of capture registers. This allows us to
675 // // unroll the loop once to add an operation between a load of a register
676 // // and the following use of that register.
677 // for (int i = 0; i < num_saved_registers_; i += 2) {
678 // __ ldr(r2, register_location(i));
679 // __ ldr(r3, register_location(i + 1));
680 // if (mode_ == UC16) {
681 // __ add(r2, r1, Operand(r2, ASR, 1));
682 // __ add(r3, r1, Operand(r3, ASR, 1));
683 // } else {
684 // __ add(r2, r1, Operand(r2));
685 // __ add(r3, r1, Operand(r3));
686 // }
687 // __ str(r2, MemOperand(r0, kPointerSize, PostIndex));
688 // __ str(r3, MemOperand(r0, kPointerSize, PostIndex));
689 // }
690 // }
691 // __ mov(r0, Operand(SUCCESS));
692 // }
693 // // Exit and return r0
694 // __ bind(&exit_label_);
695 // // Skip sp past regexp registers and local variables..
696 // __ mov(sp, frame_pointer());
697 // // Restore registers r4..r11 and return (restoring lr to pc).
698 // __ ldm(ia_w, sp, registers_to_retain | pc.bit());
699 //
700 // // Backtrack code (branch target for conditional backtracks).
701 // if (backtrack_label_.is_linked()) {
702 // __ bind(&backtrack_label_);
703 // Backtrack();
704 // }
705 //
706 // Label exit_with_exception;
707 //
708 // // Preempt-code
709 // if (check_preempt_label_.is_linked()) {
710 // SafeCallTarget(&check_preempt_label_);
711 //
712 // CallCheckStackGuardState(r0);
713 // __ cmp(r0, Operand(0));
714 // // If returning non-zero, we should end execution with the given
715 // // result as return value.
716 // __ b(ne, &exit_label_);
717 //
718 // // String might have moved: Reload end of string from frame.
719 // __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd));
720 // SafeReturn();
721 // }
722 //
723 // // Backtrack stack overflow code.
724 // if (stack_overflow_label_.is_linked()) {
725 // SafeCallTarget(&stack_overflow_label_);
726 // // Reached if the backtrack-stack limit has been hit.
727 //
728 // Label grow_failed;
729 //
730 // // Call GrowStack(backtrack_stackpointer())
731 // int num_arguments = 2;
732 // FrameAlign(num_arguments, r0);
733 // __ mov(r0, backtrack_stackpointer());
734 // __ add(r1, frame_pointer(), Operand(kStackHighEnd));
735 // ExternalReference grow_stack =
736 // ExternalReference::re_grow_stack();
737 // CallCFunction(grow_stack, num_arguments);
738 // // If return NULL, we have failed to grow the stack, and
739 // // must exit with a stack-overflow exception.
740 // __ cmp(r0, Operand(0));
741 // __ b(eq, &exit_with_exception);
742 // // Otherwise use return value as new stack pointer.
743 // __ mov(backtrack_stackpointer(), r0);
744 // // Restore saved registers and continue.
745 // SafeReturn();
746 // }
747 //
748 // if (exit_with_exception.is_linked()) {
749 // // If any of the code above needed to exit with an exception.
750 // __ bind(&exit_with_exception);
751 // // Exit with Result EXCEPTION(-1) to signal thrown exception.
752 // __ mov(r0, Operand(EXCEPTION));
753 // __ jmp(&exit_label_);
754 // }
755 //
756 CodeDesc code_desc;
757 masm_->GetCode(&code_desc);
758 Handle<Code> code = Factory::NewCode(code_desc,
759 NULL,
760 Code::ComputeFlags(Code::REGEXP),
761 masm_->CodeObject());
762 LOG(RegExpCodeCreateEvent(*code, *source));
763 return Handle<Object>::cast(code);
764 }
765
766
767 void RegExpMacroAssemblerMIPS::GoTo(Label* to) {
768 UNIMPLEMENTED();
769 // BranchOrBacktrack(al, to);
770 }
771
772
773 void RegExpMacroAssemblerMIPS::IfRegisterGE(int reg,
774 int comparand,
775 Label* if_ge) {
776 UNIMPLEMENTED();
777 // __ ldr(r0, register_location(reg));
778 // __ cmp(r0, Operand(comparand));
779 // BranchOrBacktrack(ge, if_ge);
780 }
781
782
783 void RegExpMacroAssemblerMIPS::IfRegisterLT(int reg,
784 int comparand,
785 Label* if_lt) {
786 UNIMPLEMENTED();
787 // __ ldr(r0, register_location(reg));
788 // __ cmp(r0, Operand(comparand));
789 // BranchOrBacktrack(lt, if_lt);
790 }
791
792
793 void RegExpMacroAssemblerMIPS::IfRegisterEqPos(int reg,
794 Label* if_eq) {
795 UNIMPLEMENTED();
796 // __ ldr(r0, register_location(reg));
797 // __ cmp(r0, Operand(current_input_offset()));
798 // BranchOrBacktrack(eq, if_eq);
799 }
800
801
802 RegExpMacroAssembler::IrregexpImplementation
803 RegExpMacroAssemblerMIPS::Implementation() {
804 UNIMPLEMENTED();
805 return kARMImplementation;
806 }
807
808
809 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(int cp_offset,
810 Label* on_end_of_input,
811 bool check_bounds,
812 int characters) {
813 UNIMPLEMENTED();
814 // ASSERT(cp_offset >= -1); // ^ and \b can look behind one character.
815 // ASSERT(cp_offset < (1<<30)); // Be sane! (And ensure negation works)
816 // if (check_bounds) {
817 // CheckPosition(cp_offset + characters - 1, on_end_of_input);
818 // }
819 // LoadCurrentCharacterUnchecked(cp_offset, characters);
820 }
821
822
823 void RegExpMacroAssemblerMIPS::PopCurrentPosition() {
824 UNIMPLEMENTED();
825 // Pop(current_input_offset());
826 }
827
828
829 void RegExpMacroAssemblerMIPS::PopRegister(int register_index) {
830 UNIMPLEMENTED();
831 // Pop(r0);
832 // __ str(r0, register_location(register_index));
833 }
834
835
836 //static bool is_valid_memory_offset(int value) {
837 // if (value < 0) value = -value;
838 // return value < (1<<12);
839 //}
840
841
842 void RegExpMacroAssemblerMIPS::PushBacktrack(Label* label) {
843 UNIMPLEMENTED();
844 // if (label->is_bound()) {
845 // int target = label->pos();
846 // __ mov(r0, Operand(target + Code::kHeaderSize - kHeapObjectTag));
847 // } else {
848 // int constant_offset = GetBacktrackConstantPoolEntry();
849 // masm_->label_at_put(label, constant_offset);
850 // // Reading pc-relative is based on the address 8 bytes ahead of
851 // // the current opcode.
852 // unsigned int offset_of_pc_register_read =
853 // masm_->pc_offset() + Assembler::kPcLoadDelta;
854 // int pc_offset_of_constant =
855 // constant_offset - offset_of_pc_register_read;
856 // ASSERT(pc_offset_of_constant < 0);
857 // if (is_valid_memory_offset(pc_offset_of_constant)) {
858 // masm_->BlockConstPoolBefore(masm_->pc_offset() + Assembler::kInstrSize);
859 // __ ldr(r0, MemOperand(pc, pc_offset_of_constant));
860 // } else {
861 // // Not a 12-bit offset, so it needs to be loaded from the constant
862 // // pool.
863 // masm_->BlockConstPoolBefore(
864 // masm_->pc_offset() + 2 * Assembler::kInstrSize);
865 // __ mov(r0, Operand(pc_offset_of_constant + Assembler::kInstrSize));
866 // __ ldr(r0, MemOperand(pc, r0));
867 // }
868 // }
869 // Push(r0);
870 // CheckStackLimit();
871 }
872
873
874 void RegExpMacroAssemblerMIPS::PushCurrentPosition() {
875 UNIMPLEMENTED();
876 // Push(current_input_offset());
877 }
878
879
880 void RegExpMacroAssemblerMIPS::PushRegister(int register_index,
881 StackCheckFlag check_stack_limit) {
882 UNIMPLEMENTED();
883 // __ ldr(r0, register_location(register_index));
884 // Push(r0);
885 // if (check_stack_limit) CheckStackLimit();
886 }
887
888
889 void RegExpMacroAssemblerMIPS::ReadCurrentPositionFromRegister(int reg) {
890 UNIMPLEMENTED();
891 // __ ldr(current_input_offset(), register_location(reg));
892 }
893
894
895 void RegExpMacroAssemblerMIPS::ReadStackPointerFromRegister(int reg) {
896 UNIMPLEMENTED();
897 // __ ldr(backtrack_stackpointer(), register_location(reg));
898 // __ ldr(r0, MemOperand(frame_pointer(), kStackHighEnd));
899 // __ add(backtrack_stackpointer(), backtrack_stackpointer(), Operand(r0));
900 }
901
902
903 void RegExpMacroAssemblerMIPS::SetRegister(int register_index, int to) {
904 UNIMPLEMENTED();
905 // ASSERT(register_index >= num_saved_registers_); // Reserved for positions!
906 // __ mov(r0, Operand(to));
907 // __ str(r0, register_location(register_index));
908 }
909
910
911 void RegExpMacroAssemblerMIPS::Succeed() {
912 UNIMPLEMENTED();
913 // __ jmp(&success_label_);
914 }
915
916
917 void RegExpMacroAssemblerMIPS::WriteCurrentPositionToRegister(int reg,
918 int cp_offset) {
919 UNIMPLEMENTED();
920 // if (cp_offset == 0) {
921 // __ str(current_input_offset(), register_location(reg));
922 // } else {
923 // __ add(r0, current_input_offset(), Operand(cp_offset * char_size()));
924 // __ str(r0, register_location(reg));
925 // }
926 }
927
928
929 void RegExpMacroAssemblerMIPS::ClearRegisters(int reg_from, int reg_to) {
930 UNIMPLEMENTED();
931 // ASSERT(reg_from <= reg_to);
932 // __ ldr(r0, MemOperand(frame_pointer(), kInputStartMinusOne));
933 // for (int reg = reg_from; reg <= reg_to; reg++) {
934 // __ str(r0, register_location(reg));
935 // }
936 }
937
938
939 void RegExpMacroAssemblerMIPS::WriteStackPointerToRegister(int reg) {
940 UNIMPLEMENTED();
941 // __ ldr(r1, MemOperand(frame_pointer(), kStackHighEnd));
942 // __ sub(r0, backtrack_stackpointer(), r1);
943 // __ str(r0, register_location(reg));
944 }
945
946
947 // Private methods:
948 //
949 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) {
950 UNIMPLEMENTED();
951 // int num_arguments = 3;
952 // FrameAlign(num_arguments, scratch);
953 // // RegExp code frame pointer.
954 // __ mov(r2, frame_pointer());
955 // // Code* of self.
956 // __ mov(r1, Operand(masm_->CodeObject()));
957 // // r0 becomes return address pointer.
958 // ExternalReference stack_guard_check =
959 // ExternalReference::re_check_stack_guard_state();
960 // CallCFunctionUsingStub(stack_guard_check, num_arguments);
961 }
962 //
963 //
964 //// Helper function for reading a value out of a stack frame.
965 //template <typename T>
966 //static T& frame_entry(Address re_frame, int frame_offset) {
967 // return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
968 //}
969 //
970 //
971 int RegExpMacroAssemblerMIPS::CheckStackGuardState(Address* return_address,
972 Code* re_code,
973 Address re_frame) {
974 UNIMPLEMENTED();
975 // if (StackGuard::IsStackOverflow()) {
976 // Top::StackOverflow();
977 // return EXCEPTION;
978 // }
979 //
980 // // If not real stack overflow the stack guard was used to interrupt
981 // // execution for another purpose.
982 //
983 // // Prepare for possible GC.
984 // HandleScope handles;
985 // Handle<Code> code_handle(re_code);
986 //
987 // Handle<String> subject(frame_entry<String*>(re_frame, kInputString));
988 // // Current string.
989 // bool is_ascii = subject->IsAsciiRepresentation();
990 //
991 // ASSERT(re_code->instruction_start() <= *return_address);
992 // ASSERT(*return_address <=
993 // re_code->instruction_start() + re_code->instruction_size());
994 //
995 // Object* result = Execution::HandleStackGuardInterrupt();
996 //
997 // if (*code_handle != re_code) { // Return address no longer valid
998 // int delta = *code_handle - re_code;
999 // // Overwrite the return address on the stack.
1000 // *return_address += delta;
1001 // }
1002 //
1003 // if (result->IsException()) {
1004 // return EXCEPTION;
1005 // }
1006 //
1007 // // String might have changed.
1008 // if (subject->IsAsciiRepresentation() != is_ascii) {
1009 // // If we changed between an ASCII and an UC16 string, the specialized
1010 // // code cannot be used, and we need to restart regexp matching from
1011 // // scratch (including, potentially, compiling a new version of the code).
1012 // return RETRY;
1013 // }
1014 //
1015 // // Otherwise, the content of the string might have moved. It must still
1016 // // be a sequential or external string with the same content.
1017 // // Update the start and end pointers in the stack frame to the current
1018 // // location (whether it has actually moved or not).
1019 // ASSERT(StringShape(*subject).IsSequential() ||
1020 // StringShape(*subject).IsExternal());
1021 //
1022 // // The original start address of the characters to match.
1023 // const byte* start_address = frame_entry<const byte*>(re_frame, kInputStart);
1024 //
1025 // // Find the current start address of the same character at the current strin g
1026 // // position.
1027 // int start_index = frame_entry<int>(re_frame, kStartIndex);
1028 // const byte* new_address = StringCharacterPosition(*subject, start_index);
1029 //
1030 // if (start_address != new_address) {
1031 // // If there is a difference, update the object pointer and start and end
1032 // // addresses in the RegExp stack frame to match the new value.
1033 // const byte* end_address = frame_entry<const byte* >(re_frame, kInputEnd);
1034 // int byte_length = end_address - start_address;
1035 // frame_entry<const String*>(re_frame, kInputString) = *subject;
1036 // frame_entry<const byte*>(re_frame, kInputStart) = new_address;
1037 // frame_entry<const byte*>(re_frame, kInputEnd) = new_address + byte_length;
1038 // }
1039 //
1040 return 0;
1041 }
1042
1043
1044 MemOperand RegExpMacroAssemblerMIPS::register_location(int register_index) {
1045 ASSERT(register_index < (1<<30));
1046 if (num_registers_ <= register_index) {
1047 num_registers_ = register_index + 1;
1048 }
1049 return MemOperand(frame_pointer(),
1050 kRegisterZero - register_index * kPointerSize);
1051 }
1052
1053
1054 void RegExpMacroAssemblerMIPS::CheckPosition(int cp_offset,
1055 Label* on_outside_input) {
1056 UNIMPLEMENTED();
1057 // __ cmp(current_input_offset(), Operand(-cp_offset * char_size()));
1058 // BranchOrBacktrack(ge, on_outside_input);
1059 }
1060
1061
1062 void RegExpMacroAssemblerMIPS::BranchOrBacktrack(Condition condition,
1063 Label* to) {
1064 UNIMPLEMENTED();
1065 // if (condition == al) { // Unconditional.
1066 // if (to == NULL) {
1067 // Backtrack();
1068 // return;
1069 // }
1070 // __ jmp(to);
1071 // return;
1072 // }
1073 // if (to == NULL) {
1074 // __ b(condition, &backtrack_label_);
1075 // return;
1076 // }
1077 // __ b(condition, to);
1078 }
1079
1080
1081 void RegExpMacroAssemblerMIPS::SafeCall(Label* to, Condition cond) {
1082 UNIMPLEMENTED();
1083 // __ bl(to, cond);
1084 }
1085
1086
1087 void RegExpMacroAssemblerMIPS::SafeReturn() {
1088 UNIMPLEMENTED();
1089 // __ pop(lr);
1090 // __ add(pc, lr, Operand(masm_->CodeObject()));
1091 }
1092
1093
1094 void RegExpMacroAssemblerMIPS::SafeCallTarget(Label* name) {
1095 UNIMPLEMENTED();
1096 // __ bind(name);
1097 // __ sub(lr, lr, Operand(masm_->CodeObject()));
1098 // __ push(lr);
1099 }
1100
1101
1102 void RegExpMacroAssemblerMIPS::Push(Register source) {
1103 UNIMPLEMENTED();
1104 // ASSERT(!source.is(backtrack_stackpointer()));
1105 // __ str(source,
1106 // MemOperand(backtrack_stackpointer(), kPointerSize, NegPreIndex));
1107 }
1108
1109
1110 void RegExpMacroAssemblerMIPS::Pop(Register target) {
1111 UNIMPLEMENTED();
1112 // ASSERT(!target.is(backtrack_stackpointer()));
1113 // __ ldr(target,
1114 // MemOperand(backtrack_stackpointer(), kPointerSize, PostIndex));
1115 }
1116
1117
1118 void RegExpMacroAssemblerMIPS::CheckPreemption() {
1119 UNIMPLEMENTED();
1120 // // Check for preemption.
1121 // ExternalReference stack_guard_limit =
1122 // ExternalReference::address_of_stack_guard_limit();
1123 // __ mov(r0, Operand(stack_guard_limit));
1124 // __ ldr(r0, MemOperand(r0));
1125 // __ cmp(sp, r0);
1126 // SafeCall(&check_preempt_label_, ls);
1127 }
1128
1129
1130 void RegExpMacroAssemblerMIPS::CheckStackLimit() {
1131 UNIMPLEMENTED();
1132 // if (FLAG_check_stack) {
1133 // ExternalReference stack_limit =
1134 // ExternalReference::address_of_regexp_stack_limit();
1135 // __ mov(r0, Operand(stack_limit));
1136 // __ ldr(r0, MemOperand(r0));
1137 // __ cmp(backtrack_stackpointer(), Operand(r0));
1138 // SafeCall(&stack_overflow_label_, ls);
1139 // }
1140 }
1141
1142
1143 void RegExpMacroAssemblerMIPS::EmitBacktrackConstantPool() {
1144 UNIMPLEMENTED();
1145 // __ CheckConstPool(false, false);
1146 // __ BlockConstPoolBefore(
1147 // masm_->pc_offset() + kBacktrackConstantPoolSize * Assembler::kInstrSize) ;
1148 // backtrack_constant_pool_offset_ = masm_->pc_offset();
1149 // for (int i = 0; i < kBacktrackConstantPoolSize; i++) {
1150 // __ emit(0);
1151 // }
1152 //
1153 // backtrack_constant_pool_capacity_ = kBacktrackConstantPoolSize;
1154 }
1155
1156
1157 int RegExpMacroAssemblerMIPS::GetBacktrackConstantPoolEntry() {
1158 UNIMPLEMENTED();
1159 // while (backtrack_constant_pool_capacity_ > 0) {
1160 // int offset = backtrack_constant_pool_offset_;
1161 // backtrack_constant_pool_offset_ += kPointerSize;
1162 // backtrack_constant_pool_capacity_--;
1163 // if (masm_->pc_offset() - offset < 2 * KB) {
1164 // return offset;
1165 // }
1166 // }
1167 // Label new_pool_skip;
1168 // __ jmp(&new_pool_skip);
1169 // EmitBacktrackConstantPool();
1170 // __ bind(&new_pool_skip);
1171 // int offset = backtrack_constant_pool_offset_;
1172 // backtrack_constant_pool_offset_ += kPointerSize;
1173 // backtrack_constant_pool_capacity_--;
1174 // return offset;
1175 return 0;
1176 }
1177
1178
1179 void RegExpMacroAssemblerMIPS::FrameAlign(int num_arguments, Register scratch) {
1180 UNIMPLEMENTED();
1181 // int frameAlignment = OS::ActivationFrameAlignment();
1182 // // Up to four simple arguments are passed in registers r0..r3.
1183 // int stack_passed_arguments = (num_arguments <= 4) ? 0 : num_arguments - 4;
1184 // if (frameAlignment != 0) {
1185 // // Make stack end at alignment and make room for num_arguments - 4 words
1186 // // and the original value of sp.
1187 // __ mov(scratch, sp);
1188 // __ sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize));
1189 // ASSERT(IsPowerOf2(frameAlignment));
1190 // __ and_(sp, sp, Operand(-frameAlignment));
1191 // __ str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize));
1192 // } else {
1193 // __ sub(sp, sp, Operand(stack_passed_arguments * kPointerSize));
1194 // }
1195 }
1196
1197
1198 void RegExpMacroAssemblerMIPS::CallCFunction(ExternalReference function,
1199 int num_arguments) {
1200 UNIMPLEMENTED();
1201 // __ mov(r5, Operand(function));
1202 // // Just call directly. The function called cannot cause a GC, or
1203 // // allow preemption, so the return address in the link register
1204 // // stays correct.
1205 // __ Call(r5);
1206 // int stack_passed_arguments = (num_arguments <= 4) ? 0 : num_arguments - 4;
1207 // if (OS::ActivationFrameAlignment() > kIntSize) {
1208 // __ ldr(sp, MemOperand(sp, stack_passed_arguments * kPointerSize));
1209 // } else {
1210 // __ add(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize)));
1211 // }
1212 // __ mov(code_pointer(), Operand(masm_->CodeObject()));
1213 }
1214
1215
1216 void RegExpMacroAssemblerMIPS::CallCFunctionUsingStub(
1217 ExternalReference function,
1218 int num_arguments) {
1219 UNIMPLEMENTED();
1220 // // Must pass all arguments in registers. The stub pushes on the stack.
1221 // ASSERT(num_arguments <= 4);
1222 // __ mov(r5, Operand(function));
1223 // RegExpCEntryStub stub;
1224 // __ CallStub(&stub);
1225 // if (OS::ActivationFrameAlignment() != 0) {
1226 // __ ldr(sp, MemOperand(sp, 0));
1227 // }
1228 // __ mov(code_pointer(), Operand(masm_->CodeObject()));
1229 }
1230
1231
1232 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset,
1233 int characters) {
1234 UNIMPLEMENTED();
1235 // Register offset = current_input_offset();
1236 // if (cp_offset != 0) {
1237 // __ add(r0, current_input_offset(), Operand(cp_offset * char_size()));
1238 // offset = r0;
1239 // }
1240 // // We assume that we cannot do unaligned loads on ARM, so this function
1241 // // must only be used to load a single character at a time.
1242 // ASSERT(characters == 1);
1243 // if (mode_ == ASCII) {
1244 // __ ldrb(current_character(), MemOperand(end_of_input_address(), offset));
1245 // } else {
1246 // ASSERT(mode_ == UC16);
1247 // __ ldrh(current_character(), MemOperand(end_of_input_address(), offset));
1248 // }
1249 }
1250
1251
1252 //void RegExpCEntryStub::Generate(MacroAssembler* masm_) {
1253 // UNIMPLEMENTED();
1254 // int stack_alignment = OS::ActivationFrameAlignment();
1255 // if (stack_alignment < kPointerSize) stack_alignment = kPointerSize;
1256 // // Stack is already aligned for call, so decrement by alignment
1257 // // to make room for storing the link register.
1258 // __ str(lr, MemOperand(sp, stack_alignment, NegPreIndex));
1259 // __ mov(r0, sp);
1260 // __ Call(r5);
1261 // __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
1262 //}
1263
1264 #undef __
1265
1266 #endif // V8_NATIVE_REGEXP
1267
1268 }} // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698