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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 10386090: Implement loop for global regexps in regexp assembler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix bugs, add tests, port to x64 and arm. Created 8 years, 7 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
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 2857
2858 // rdi: subject string 2858 // rdi: subject string
2859 // rbx: previous index 2859 // rbx: previous index
2860 // rcx: encoding of subject string (1 if ASCII 0 if two_byte); 2860 // rcx: encoding of subject string (1 if ASCII 0 if two_byte);
2861 // r11: code 2861 // r11: code
2862 // All checks done. Now push arguments for native regexp code. 2862 // All checks done. Now push arguments for native regexp code.
2863 Counters* counters = masm->isolate()->counters(); 2863 Counters* counters = masm->isolate()->counters();
2864 __ IncrementCounter(counters->regexp_entry_native(), 1); 2864 __ IncrementCounter(counters->regexp_entry_native(), 1);
2865 2865
2866 // Isolates: note we add an additional parameter here (isolate pointer). 2866 // Isolates: note we add an additional parameter here (isolate pointer).
2867 static const int kRegExpExecuteArguments = 8; 2867 static const int kRegExpExecuteArguments = 9;
2868 int argument_slots_on_stack = 2868 int argument_slots_on_stack =
2869 masm->ArgumentStackSlotsForCFunctionCall(kRegExpExecuteArguments); 2869 masm->ArgumentStackSlotsForCFunctionCall(kRegExpExecuteArguments);
2870 __ EnterApiExitFrame(argument_slots_on_stack); 2870 __ EnterApiExitFrame(argument_slots_on_stack);
2871 2871
2872 // Argument 8: Pass current isolate address. 2872 // Argument 9: Pass current isolate address.
2873 // __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize), 2873 // __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize),
2874 // Immediate(ExternalReference::isolate_address())); 2874 // Immediate(ExternalReference::isolate_address()));
2875 __ LoadAddress(kScratchRegister, ExternalReference::isolate_address()); 2875 __ LoadAddress(kScratchRegister, ExternalReference::isolate_address());
2876 __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize), 2876 __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize),
2877 kScratchRegister); 2877 kScratchRegister);
2878 2878
2879 // Argument 7: Indicate that this is a direct call from JavaScript. 2879 // Argument 8: Indicate that this is a direct call from JavaScript.
2880 __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kPointerSize), 2880 __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kPointerSize),
2881 Immediate(1)); 2881 Immediate(1));
2882 2882
2883 // Argument 6: Start (high end) of backtracking stack memory area. 2883 // Argument 7: Start (high end) of backtracking stack memory area.
2884 __ movq(kScratchRegister, address_of_regexp_stack_memory_address); 2884 __ movq(kScratchRegister, address_of_regexp_stack_memory_address);
2885 __ movq(r9, Operand(kScratchRegister, 0)); 2885 __ movq(r9, Operand(kScratchRegister, 0));
2886 __ movq(kScratchRegister, address_of_regexp_stack_memory_size); 2886 __ movq(kScratchRegister, address_of_regexp_stack_memory_size);
2887 __ addq(r9, Operand(kScratchRegister, 0)); 2887 __ addq(r9, Operand(kScratchRegister, 0));
2888 // Argument 6 passed in r9 on Linux and on the stack on Windows. 2888 __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kPointerSize), r9);
2889
2890 // Argument 6: Clear the number of capture registers for non-global capture.
2891 // Argument 6 is passed in r9 on Linux and on the stack on Windows.
2889 #ifdef _WIN64 2892 #ifdef _WIN64
2890 __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kPointerSize), r9); 2893 __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kPointerSize),
2894 Immediate(0));
2895 #else
2896 __ Set(r9, 0);
2891 #endif 2897 #endif
2892 2898
2893 // Argument 5: static offsets vector buffer. 2899 // Argument 5: static offsets vector buffer.
2894 __ LoadAddress(r8, 2900 __ LoadAddress(r8,
2895 ExternalReference::address_of_static_offsets_vector(isolate)); 2901 ExternalReference::address_of_static_offsets_vector(isolate));
2896 // Argument 5 passed in r8 on Linux and on the stack on Windows. 2902 // Argument 5 passed in r8 on Linux and on the stack on Windows.
2897 #ifdef _WIN64 2903 #ifdef _WIN64
2898 __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kPointerSize), r8); 2904 __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kPointerSize), r8);
2899 #endif 2905 #endif
2900 2906
2901 // First four arguments are passed in registers on both Linux and Windows. 2907 // First four arguments are passed in registers on both Linux and Windows.
2902 #ifdef _WIN64 2908 #ifdef _WIN64
2903 Register arg4 = r9; 2909 Register arg4 = r9;
2904 Register arg3 = r8; 2910 Register arg3 = r8;
2905 Register arg2 = rdx; 2911 Register arg2 = rdx;
2906 Register arg1 = rcx; 2912 Register arg1 = rcx;
2907 #else 2913 #else
2908 Register arg4 = rcx; 2914 Register arg4 = rcx;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 // Locate the code entry and call it. 2960 // Locate the code entry and call it.
2955 __ addq(r11, Immediate(Code::kHeaderSize - kHeapObjectTag)); 2961 __ addq(r11, Immediate(Code::kHeaderSize - kHeapObjectTag));
2956 __ call(r11); 2962 __ call(r11);
2957 2963
2958 __ LeaveApiExitFrame(); 2964 __ LeaveApiExitFrame();
2959 2965
2960 // Check the result. 2966 // Check the result.
2961 Label success; 2967 Label success;
2962 Label exception; 2968 Label exception;
2963 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::SUCCESS)); 2969 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::SUCCESS));
2970 // We do not expect multiple results.
2964 __ j(equal, &success, Label::kNear); 2971 __ j(equal, &success, Label::kNear);
2965 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::EXCEPTION)); 2972 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::EXCEPTION));
2966 __ j(equal, &exception); 2973 __ j(equal, &exception);
2967 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::FAILURE)); 2974 __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::FAILURE));
2968 // If none of the above, it can only be retry. 2975 // If none of the above, it can only be retry.
2969 // Handle that in the runtime system. 2976 // Handle that in the runtime system.
2970 __ j(not_equal, &runtime); 2977 __ j(not_equal, &runtime);
2971 2978
2972 // For failure return null. 2979 // For failure return null.
2973 __ LoadRoot(rax, Heap::kNullValueRootIndex); 2980 __ LoadRoot(rax, Heap::kNullValueRootIndex);
(...skipping 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after
6326 xmm0, 6333 xmm0,
6327 &slow_elements); 6334 &slow_elements);
6328 __ ret(0); 6335 __ ret(0);
6329 } 6336 }
6330 6337
6331 #undef __ 6338 #undef __
6332 6339
6333 } } // namespace v8::internal 6340 } } // namespace v8::internal
6334 6341
6335 #endif // V8_TARGET_ARCH_X64 6342 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698