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

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

Issue 10984: Fix native code Irregexp on MacOSX. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 __ jmp(&exit_label_); 349 __ jmp(&exit_label_);
350 } 350 }
351 351
352 352
353 Handle<Object> RegExpMacroAssemblerIA32::GetCode() { 353 Handle<Object> RegExpMacroAssemblerIA32::GetCode() {
354 // Finalize code - write the entry point code now we know how many 354 // Finalize code - write the entry point code now we know how many
355 // registers we need. 355 // registers we need.
356 356
357 // Entry code: 357 // Entry code:
358 __ bind(&entry_label_); 358 __ bind(&entry_label_);
359 // Save callee-save registers. Order here should correspond to order of
360 // kBackup_ebx etc.
359 __ push(esi); 361 __ push(esi);
360 __ push(edi); 362 __ push(edi);
363 __ push(ebx); // Callee-save on MacOS.
361 __ enter(Immediate(num_registers_ * kPointerSize)); 364 __ enter(Immediate(num_registers_ * kPointerSize));
365 // Load string length.
362 __ mov(esi, Operand(ebp, kInputEndOffset)); 366 __ mov(esi, Operand(ebp, kInputEndOffset));
367 // Load input position.
363 __ mov(edi, Operand(ebp, kInputStartOffset)); 368 __ mov(edi, Operand(ebp, kInputStartOffset));
369 // Set up edi to be negative offset from string end.
364 __ sub(edi, Operand(esi)); 370 __ sub(edi, Operand(esi));
371 // Set up esi to be end of string. First get location.
365 __ mov(edx, Operand(ebp, kInputBuffer)); 372 __ mov(edx, Operand(ebp, kInputBuffer));
373 // Dereference location to get string start.
366 __ mov(edx, Operand(edx, 0)); 374 __ mov(edx, Operand(edx, 0));
375 // Add start to length to complete esi setup.
367 __ add(esi, Operand(edx)); 376 __ add(esi, Operand(edx));
368 if (num_saved_registers_ > 0) { 377 if (num_saved_registers_ > 0) {
369 // Fill saved registers with initial value = start offset - 1 378 // Fill saved registers with initial value = start offset - 1
370 __ mov(ecx, -num_saved_registers_); 379 __ mov(ecx, -num_saved_registers_);
371 __ mov(eax, Operand(edi)); 380 __ mov(eax, Operand(edi));
372 __ sub(Operand(eax), Immediate(char_size())); 381 __ sub(Operand(eax), Immediate(char_size()));
373 Label init_loop; 382 Label init_loop;
374 __ bind(&init_loop); 383 __ bind(&init_loop);
375 __ mov(Operand(ebp, ecx, times_4, +0), eax); 384 __ mov(Operand(ebp, ecx, times_4, +0), eax);
376 __ inc(ecx); 385 __ inc(ecx);
(...skipping 14 matching lines...) Expand all
391 if (char_size() == 2) { 400 if (char_size() == 2) {
392 __ shr(eax); 401 __ shr(eax);
393 } 402 }
394 __ mov(Operand(ebx, i * kPointerSize), eax); 403 __ mov(Operand(ebx, i * kPointerSize), eax);
395 } 404 }
396 } 405 }
397 __ mov(eax, Immediate(1)); 406 __ mov(eax, Immediate(1));
398 407
399 __ bind(&exit_label_); 408 __ bind(&exit_label_);
400 __ leave(); 409 __ leave();
410 __ pop(ebx);
401 __ pop(edi); 411 __ pop(edi);
402 __ pop(esi); 412 __ pop(esi);
403 __ ret(0); 413 __ ret(0);
404 414
405 CodeDesc code_desc; 415 CodeDesc code_desc;
406 masm_->GetCode(&code_desc); 416 masm_->GetCode(&code_desc);
407 Handle<Code> code = Factory::NewCode(code_desc, 417 Handle<Code> code = Factory::NewCode(code_desc,
408 NULL, 418 NULL,
409 Code::ComputeFlags(Code::REGEXP), 419 Code::ComputeFlags(Code::REGEXP),
410 self_); 420 self_);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 636
627 637
628 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, 638 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg,
629 ArraySlice* buffer) { 639 ArraySlice* buffer) {
630 __ mov(reg, buffer->array()); 640 __ mov(reg, buffer->array());
631 __ add(Operand(reg), Immediate(buffer->base_offset())); 641 __ add(Operand(reg), Immediate(buffer->base_offset()));
632 } 642 }
633 643
634 #undef __ 644 #undef __
635 }} // namespace v8::internal 645 }} // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698