7 #if V8_TARGET_ARCH_MIPS64
21 #ifndef V8_INTERPRETED_REGEXP
132 #define __ ACCESS_MASM(masm_)
136 int registers_to_save,
138 : NativeRegExpMacroAssembler(zone),
139 masm_(new MacroAssembler(zone->isolate(),
NULL, kRegExpCodeSize)),
141 num_registers_(registers_to_save),
142 num_saved_registers_(registers_to_save),
148 internal_failure_label_() {
150 __ jmp(&entry_label_);
153 __ bind(&internal_failure_label_);
154 __ li(v0, Operand(FAILURE));
156 __ bind(&start_label_);
160 RegExpMacroAssemblerMIPS::~RegExpMacroAssemblerMIPS() {
163 entry_label_.Unuse();
164 start_label_.Unuse();
165 success_label_.Unuse();
166 backtrack_label_.Unuse();
168 check_preempt_label_.Unuse();
169 stack_overflow_label_.Unuse();
170 internal_failure_label_.Unuse();
174 int RegExpMacroAssemblerMIPS::stack_limit_slack() {
175 return RegExpStack::kStackLimitSlack;
179 void RegExpMacroAssemblerMIPS::AdvanceCurrentPosition(
int by) {
181 __ Daddu(current_input_offset(),
182 current_input_offset(), Operand(by * char_size()));
187 void RegExpMacroAssemblerMIPS::AdvanceRegister(
int reg,
int by) {
189 DCHECK(reg < num_registers_);
191 __ ld(a0, register_location(reg));
192 __ Daddu(a0, a0, Operand(by));
193 __ sd(a0, register_location(reg));
198 void RegExpMacroAssemblerMIPS::Backtrack() {
202 __ Daddu(a0, a0, code_pointer());
207 void RegExpMacroAssemblerMIPS::Bind(Label* label) {
212 void RegExpMacroAssemblerMIPS::CheckCharacter(
uint32_t c, Label* on_equal) {
213 BranchOrBacktrack(on_equal,
eq, current_character(), Operand(c));
217 void RegExpMacroAssemblerMIPS::CheckCharacterGT(
uc16 limit, Label* on_greater) {
218 BranchOrBacktrack(on_greater,
gt, current_character(), Operand(limit));
222 void RegExpMacroAssemblerMIPS::CheckAtStart(Label* on_at_start) {
226 BranchOrBacktrack(¬_at_start,
ne, a0, Operand(zero_reg));
230 __ Daddu(a0, end_of_input_address(), Operand(current_input_offset()));
231 BranchOrBacktrack(on_at_start,
eq, a0, Operand(a1));
232 __ bind(¬_at_start);
236 void RegExpMacroAssemblerMIPS::CheckNotAtStart(Label* on_not_at_start) {
239 BranchOrBacktrack(on_not_at_start,
ne, a0, Operand(zero_reg));
242 __ Daddu(a0, end_of_input_address(), Operand(current_input_offset()));
243 BranchOrBacktrack(on_not_at_start,
ne, a0, Operand(a1));
247 void RegExpMacroAssemblerMIPS::CheckCharacterLT(
uc16 limit, Label* on_less) {
248 BranchOrBacktrack(on_less,
lt, current_character(), Operand(limit));
252 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) {
253 Label backtrack_non_equal;
255 __ Branch(&backtrack_non_equal,
ne, current_input_offset(), Operand(a0));
256 __ Daddu(backtrack_stackpointer(),
257 backtrack_stackpointer(),
259 __ bind(&backtrack_non_equal);
260 BranchOrBacktrack(on_equal,
eq, current_input_offset(), Operand(a0));
264 void RegExpMacroAssemblerMIPS::CheckNotBackReferenceIgnoreCase(
266 Label* on_no_match) {
268 __ ld(a0, register_location(start_reg));
269 __ ld(a1, register_location(start_reg + 1));
270 __ Dsubu(a1, a1, a0);
274 __ Branch(&fallthrough,
eq, a1, Operand(zero_reg));
276 __ Daddu(t1, a1, current_input_offset());
278 BranchOrBacktrack(on_no_match,
gt, t1, Operand(zero_reg));
280 if (mode_ == LATIN1) {
287 __ Daddu(a0, a0, Operand(end_of_input_address()));
288 __ Daddu(a2, end_of_input_address(), Operand(current_input_offset()));
289 __ Daddu(a1, a0, Operand(a1));
298 __ daddiu(a0, a0, char_size());
300 __ daddiu(a2, a2, char_size());
302 __ Branch(&loop_check,
eq, a4, Operand(a3));
305 __ Or(a3, a3, Operand(0x20));
306 __ Or(a4, a4, Operand(0x20));
307 __ Branch(&fail,
ne, a4, Operand(a3));
308 __ Dsubu(a3, a3, Operand(
'a'));
309 __ Branch(&loop_check,
ls, a3, Operand(
'z' -
'a'));
311 __ Dsubu(a3, a3, Operand(224 -
'a'));
313 __ Branch(&fail,
hi, a3, Operand(254 - 224));
315 __ Branch(&fail,
eq, a3, Operand(247 - 224));
317 __ bind(&loop_check);
318 __ Branch(&loop,
lt, a0, Operand(a1));
326 __ Dsubu(current_input_offset(), a2, end_of_input_address());
330 RegList regexp_registers_to_retain = current_input_offset().bit() |
331 current_character().bit() | backtrack_stackpointer().bit();
332 __ MultiPush(regexp_registers_to_retain);
334 int argument_count = 4;
335 __ PrepareCallCFunction(argument_count, a2);
348 __ Daddu(a0, a0, Operand(end_of_input_address()));
354 __ Daddu(a1, current_input_offset(), Operand(end_of_input_address()));
356 __ li(a3, Operand(ExternalReference::isolate_address(masm_->isolate())));
359 AllowExternalCallThatCantCauseGC scope(masm_);
360 ExternalReference
function =
361 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate());
362 __ CallCFunction(
function, argument_count);
366 __ MultiPop(regexp_registers_to_retain);
368 __ ld(end_of_input_address(),
MemOperand(frame_pointer(), kInputEnd));
371 BranchOrBacktrack(on_no_match,
eq, v0, Operand(zero_reg));
373 __ Daddu(current_input_offset(), current_input_offset(), Operand(
s3));
376 __ bind(&fallthrough);
380 void RegExpMacroAssemblerMIPS::CheckNotBackReference(
382 Label* on_no_match) {
387 __ ld(a0, register_location(start_reg));
388 __ ld(a1, register_location(start_reg + 1));
389 __ Dsubu(a1, a1, a0);
391 __ Branch(&fallthrough,
eq, a1, Operand(zero_reg));
393 __ Daddu(t1, a1, current_input_offset());
395 BranchOrBacktrack(on_no_match,
gt, t1, Operand(zero_reg));
398 __ Daddu(a0, a0, Operand(end_of_input_address()));
399 __ Daddu(a2, end_of_input_address(), Operand(current_input_offset()));
400 __ Daddu(a1, a1, Operand(a0));
404 if (mode_ == LATIN1) {
406 __ daddiu(a0, a0, char_size());
408 __ daddiu(a2, a2, char_size());
412 __ daddiu(a0, a0, char_size());
414 __ daddiu(a2, a2, char_size());
416 BranchOrBacktrack(on_no_match,
ne, a3, Operand(a4));
417 __ Branch(&loop,
lt, a0, Operand(a1));
420 __ Dsubu(current_input_offset(), a2, end_of_input_address());
421 __ bind(&fallthrough);
425 void RegExpMacroAssemblerMIPS::CheckNotCharacter(
uint32_t c,
426 Label* on_not_equal) {
427 BranchOrBacktrack(on_not_equal,
ne, current_character(), Operand(c));
431 void RegExpMacroAssemblerMIPS::CheckCharacterAfterAnd(
uint32_t c,
434 __ And(a0, current_character(), Operand(mask));
435 Operand rhs = (c == 0) ? Operand(zero_reg) : Operand(c);
436 BranchOrBacktrack(on_equal,
eq, a0, rhs);
440 void RegExpMacroAssemblerMIPS::CheckNotCharacterAfterAnd(
uint32_t c,
442 Label* on_not_equal) {
443 __ And(a0, current_character(), Operand(mask));
444 Operand rhs = (c == 0) ? Operand(zero_reg) : Operand(c);
445 BranchOrBacktrack(on_not_equal,
ne, a0, rhs);
449 void RegExpMacroAssemblerMIPS::CheckNotCharacterAfterMinusAnd(
453 Label* on_not_equal) {
454 DCHECK(minus < String::kMaxUtf16CodeUnit);
455 __ Dsubu(a0, current_character(), Operand(minus));
456 __ And(a0, a0, Operand(mask));
457 BranchOrBacktrack(on_not_equal,
ne, a0, Operand(c));
461 void RegExpMacroAssemblerMIPS::CheckCharacterInRange(
464 Label* on_in_range) {
465 __ Dsubu(a0, current_character(), Operand(from));
467 BranchOrBacktrack(on_in_range,
ls, a0, Operand(
to - from));
471 void RegExpMacroAssemblerMIPS::CheckCharacterNotInRange(
474 Label* on_not_in_range) {
475 __ Dsubu(a0, current_character(), Operand(from));
477 BranchOrBacktrack(on_not_in_range,
hi, a0, Operand(
to - from));
481 void RegExpMacroAssemblerMIPS::CheckBitInTable(
482 Handle<ByteArray> table,
484 __ li(a0, Operand(table));
485 if (mode_ != LATIN1 || kTableMask != String::kMaxOneByteCharCode) {
486 __ And(a1, current_character(), Operand(kTableSize - 1));
487 __ Daddu(a0, a0, a1);
489 __ Daddu(a0, a0, current_character());
493 BranchOrBacktrack(on_bit_set,
ne, a0, Operand(zero_reg));
497 bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(
uc16 type,
498 Label* on_no_match) {
504 if (mode_ == LATIN1) {
507 __ Branch(&success,
eq, current_character(), Operand(
' '));
509 __ Dsubu(a0, current_character(), Operand(
'\t'));
510 __ Branch(&success,
ls, a0, Operand(
'\r' -
'\t'));
512 BranchOrBacktrack(on_no_match,
ne, a0, Operand(0x00a0 -
'\t'));
522 __ Dsubu(a0, current_character(), Operand(
'0'));
523 BranchOrBacktrack(on_no_match,
hi, a0, Operand(
'9' -
'0'));
527 __ Dsubu(a0, current_character(), Operand(
'0'));
528 BranchOrBacktrack(on_no_match,
ls, a0, Operand(
'9' -
'0'));
532 __ Xor(a0, current_character(), Operand(0x01));
534 __ Dsubu(a0, a0, Operand(0x0b));
535 BranchOrBacktrack(on_no_match,
ls, a0, Operand(0x0c - 0x0b));
540 __ Dsubu(a0, a0, Operand(0x2028 - 0x0b));
541 BranchOrBacktrack(on_no_match,
ls, a0, Operand(1));
547 __ Xor(a0, current_character(), Operand(0x01));
549 __ Dsubu(a0, a0, Operand(0x0b));
550 if (mode_ == LATIN1) {
551 BranchOrBacktrack(on_no_match,
hi, a0, Operand(0x0c - 0x0b));
554 BranchOrBacktrack(&done,
ls, a0, Operand(0x0c - 0x0b));
558 __ Dsubu(a0, a0, Operand(0x2028 - 0x0b));
559 BranchOrBacktrack(on_no_match,
hi, a0, Operand(1));
565 if (mode_ != LATIN1) {
567 BranchOrBacktrack(on_no_match,
hi, current_character(), Operand(
'z'));
569 ExternalReference
map = ExternalReference::re_word_character_map();
570 __ li(a0, Operand(
map));
571 __ Daddu(a0, a0, current_character());
573 BranchOrBacktrack(on_no_match,
eq, a0, Operand(zero_reg));
578 if (mode_ != LATIN1) {
580 __ Branch(&done,
hi, current_character(), Operand(
'z'));
582 ExternalReference
map = ExternalReference::re_word_character_map();
583 __ li(a0, Operand(
map));
584 __ Daddu(a0, a0, current_character());
586 BranchOrBacktrack(on_no_match,
ne, a0, Operand(zero_reg));
587 if (mode_ != LATIN1) {
602 void RegExpMacroAssemblerMIPS::Fail() {
603 __ li(v0, Operand(FAILURE));
604 __ jmp(&exit_label_);
608 Handle<HeapObject> RegExpMacroAssemblerMIPS::GetCode(Handle<String> source) {
610 if (masm_->has_exception()) {
614 __ bind_to(&entry_label_, internal_failure_label_.pos());
620 __ bind(&entry_label_);
624 FrameScope scope(masm_, StackFrame::MANUAL);
636 RegList argument_registers = a0.bit() | a1.bit() | a2.bit() | a3.bit();
640 argument_registers |= a4.bit() | a5.bit() | a6.bit() | a7.bit();
643 __ MultiPush(argument_registers | registers_to_retain | ra.bit());
648 __ mov(a0, zero_reg);
653 Label stack_limit_hit;
656 ExternalReference stack_limit =
657 ExternalReference::address_of_stack_limit(masm_->isolate());
658 __ li(a0, Operand(stack_limit));
660 __ Dsubu(a0,
sp, a0);
662 __ Branch(&stack_limit_hit,
le, a0, Operand(zero_reg));
668 __ li(v0, Operand(EXCEPTION));
671 __ bind(&stack_limit_hit);
672 CallCheckStackGuardState(a0);
674 __ Branch(&return_v0,
ne, v0, Operand(zero_reg));
680 __ ld(end_of_input_address(),
MemOperand(frame_pointer(), kInputEnd));
684 __ Dsubu(current_input_offset(), a0, end_of_input_address());
688 __ Dsubu(a0, current_input_offset(), Operand(char_size()));
689 __ dsll(t1, a1, (mode_ == UC16) ? 1 : 0);
690 __ Dsubu(a0, a0, t1);
693 __ sd(a0,
MemOperand(frame_pointer(), kInputStartMinusOne));
698 Label load_char_start_regexp, start_regexp;
700 __ Branch(&load_char_start_regexp,
ne, a1, Operand(zero_reg));
701 __ li(current_character(), Operand(
'\n'));
702 __ jmp(&start_regexp);
705 __ bind(&load_char_start_regexp);
707 LoadCurrentCharacterUnchecked(-1, 1);
708 __ bind(&start_regexp);
711 if (num_saved_registers_ > 0) {
713 if (num_saved_registers_ > 8) {
715 __ Daddu(a1, frame_pointer(), Operand(kRegisterZero));
716 __ li(a2, Operand(num_saved_registers_));
721 __ Dsubu(a2, a2, Operand(1));
722 __ Branch(&init_loop,
ne, a2, Operand(zero_reg));
724 for (
int i = 0;
i < num_saved_registers_;
i++) {
725 __ sd(a0, register_location(
i));
731 __ ld(backtrack_stackpointer(),
MemOperand(frame_pointer(), kStackHighEnd));
733 __ jmp(&start_label_);
737 if (success_label_.is_linked()) {
739 __ bind(&success_label_);
740 if (num_saved_registers_ > 0) {
743 __ ld(a0,
MemOperand(frame_pointer(), kRegisterOutput));
745 __ Dsubu(a1, end_of_input_address(), a1);
751 __ Daddu(a1, a1, Operand(a2));
758 for (
int i = 0;
i < num_saved_registers_;
i += 2) {
759 __ ld(a2, register_location(
i));
760 __ ld(a3, register_location(
i + 1));
761 if (
i == 0 && global_with_zero_length_check()) {
767 __ Daddu(a2, a2, a1);
769 __ Daddu(a3, a3, a1);
771 __ Daddu(a2, a1, Operand(a2));
772 __ Daddu(a3, a1, Operand(a3));
784 __ ld(a0,
MemOperand(frame_pointer(), kSuccessfulCaptures));
785 __ lw(a1,
MemOperand(frame_pointer(), kNumOutputRegisters));
786 __ ld(a2,
MemOperand(frame_pointer(), kRegisterOutput));
789 __ sd(a0,
MemOperand(frame_pointer(), kSuccessfulCaptures));
792 __ Dsubu(a1, a1, num_saved_registers_);
795 __ Branch(&return_v0,
lt, a1, Operand(num_saved_registers_));
797 __ sd(a1,
MemOperand(frame_pointer(), kNumOutputRegisters));
799 __ Daddu(a2, a2, num_saved_registers_ *
kIntSize);
800 __ sd(a2,
MemOperand(frame_pointer(), kRegisterOutput));
803 __ ld(a0,
MemOperand(frame_pointer(), kInputStartMinusOne));
805 if (global_with_zero_length_check()) {
810 &load_char_start_regexp,
ne, current_input_offset(), Operand(t3));
812 __ Branch(&exit_label_,
eq, current_input_offset(),
815 __ Daddu(current_input_offset(),
816 current_input_offset(),
817 Operand((mode_ == UC16) ? 2 : 1));
820 __ Branch(&load_char_start_regexp);
822 __ li(v0, Operand(SUCCESS));
826 __ bind(&exit_label_);
828 __ ld(v0,
MemOperand(frame_pointer(), kSuccessfulCaptures));
833 __ mov(
sp, frame_pointer());
835 __ MultiPop(registers_to_retain | ra.bit());
839 if (backtrack_label_.is_linked()) {
840 __ bind(&backtrack_label_);
844 Label exit_with_exception;
847 if (check_preempt_label_.is_linked()) {
848 SafeCallTarget(&check_preempt_label_);
850 RegList regexp_registers_to_retain = current_input_offset().bit() |
851 current_character().bit() | backtrack_stackpointer().bit();
852 __ MultiPush(regexp_registers_to_retain);
853 CallCheckStackGuardState(a0);
854 __ MultiPop(regexp_registers_to_retain);
857 __ Branch(&return_v0,
ne, v0, Operand(zero_reg));
860 __ ld(end_of_input_address(),
MemOperand(frame_pointer(), kInputEnd));
866 if (stack_overflow_label_.is_linked()) {
867 SafeCallTarget(&stack_overflow_label_);
870 RegList regexp_registers = current_input_offset().bit() |
871 current_character().bit();
872 __ MultiPush(regexp_registers);
875 static const int num_arguments = 3;
876 __ PrepareCallCFunction(num_arguments, a0);
877 __ mov(a0, backtrack_stackpointer());
878 __ Daddu(a1, frame_pointer(), Operand(kStackHighEnd));
879 __ li(a2, Operand(ExternalReference::isolate_address(masm_->isolate())));
880 ExternalReference grow_stack =
881 ExternalReference::re_grow_stack(masm_->isolate());
882 __ CallCFunction(grow_stack, num_arguments);
884 __ MultiPop(regexp_registers);
887 __ Branch(&exit_with_exception,
eq, v0, Operand(zero_reg));
889 __ mov(backtrack_stackpointer(), v0);
892 __ ld(end_of_input_address(),
MemOperand(frame_pointer(), kInputEnd));
896 if (exit_with_exception.is_linked()) {
898 __ bind(&exit_with_exception);
900 __ li(v0, Operand(EXCEPTION));
906 masm_->GetCode(&code_desc);
907 Handle<Code> code = isolate()->factory()->NewCode(
908 code_desc, Code::ComputeFlags(Code::REGEXP), masm_->CodeObject());
909 LOG(masm_->isolate(), RegExpCodeCreateEvent(*code, *source));
910 return Handle<HeapObject>::cast(code);
914 void RegExpMacroAssemblerMIPS::GoTo(Label*
to) {
924 void RegExpMacroAssemblerMIPS::IfRegisterGE(
int reg,
927 __ ld(a0, register_location(reg));
928 BranchOrBacktrack(if_ge,
ge, a0, Operand(comparand));
932 void RegExpMacroAssemblerMIPS::IfRegisterLT(
int reg,
935 __ ld(a0, register_location(reg));
936 BranchOrBacktrack(if_lt,
lt, a0, Operand(comparand));
940 void RegExpMacroAssemblerMIPS::IfRegisterEqPos(
int reg,
942 __ ld(a0, register_location(reg));
943 BranchOrBacktrack(if_eq,
eq, a0, Operand(current_input_offset()));
947 RegExpMacroAssembler::IrregexpImplementation
948 RegExpMacroAssemblerMIPS::Implementation() {
949 return kMIPSImplementation;
953 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(
int cp_offset,
954 Label* on_end_of_input,
958 DCHECK(cp_offset < (1<<30));
960 CheckPosition(cp_offset + characters - 1, on_end_of_input);
962 LoadCurrentCharacterUnchecked(cp_offset, characters);
966 void RegExpMacroAssemblerMIPS::PopCurrentPosition() {
967 Pop(current_input_offset());
971 void RegExpMacroAssemblerMIPS::PopRegister(
int register_index) {
973 __ sd(a0, register_location(register_index));
977 void RegExpMacroAssemblerMIPS::PushBacktrack(Label* label) {
978 if (label->is_bound()) {
979 int target = label->pos();
982 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
983 Label after_constant;
984 __ Branch(&after_constant);
985 int offset = masm_->pc_offset();
988 masm_->label_at_put(label, offset);
989 __ bind(&after_constant);
990 if (is_int16(cp_offset)) {
993 __ Daddu(a0, code_pointer(), cp_offset);
1002 void RegExpMacroAssemblerMIPS::PushCurrentPosition() {
1003 Push(current_input_offset());
1007 void RegExpMacroAssemblerMIPS::PushRegister(
int register_index,
1008 StackCheckFlag check_stack_limit) {
1009 __ ld(a0, register_location(register_index));
1011 if (check_stack_limit) CheckStackLimit();
1015 void RegExpMacroAssemblerMIPS::ReadCurrentPositionFromRegister(
int reg) {
1016 __ ld(current_input_offset(), register_location(reg));
1020 void RegExpMacroAssemblerMIPS::ReadStackPointerFromRegister(
int reg) {
1021 __ ld(backtrack_stackpointer(), register_location(reg));
1023 __ Daddu(backtrack_stackpointer(), backtrack_stackpointer(), Operand(a0));
1027 void RegExpMacroAssemblerMIPS::SetCurrentPositionFromEnd(
int by) {
1028 Label after_position;
1029 __ Branch(&after_position,
1031 current_input_offset(),
1032 Operand(-by * char_size()));
1033 __ li(current_input_offset(), -by * char_size());
1037 LoadCurrentCharacterUnchecked(-1, 1);
1038 __ bind(&after_position);
1042 void RegExpMacroAssemblerMIPS::SetRegister(
int register_index,
int to) {
1043 DCHECK(register_index >= num_saved_registers_);
1044 __ li(a0, Operand(
to));
1045 __ sd(a0, register_location(register_index));
1049 bool RegExpMacroAssemblerMIPS::Succeed() {
1050 __ jmp(&success_label_);
1055 void RegExpMacroAssemblerMIPS::WriteCurrentPositionToRegister(
int reg,
1057 if (cp_offset == 0) {
1058 __ sd(current_input_offset(), register_location(reg));
1060 __ Daddu(a0, current_input_offset(), Operand(cp_offset * char_size()));
1061 __ sd(a0, register_location(reg));
1066 void RegExpMacroAssemblerMIPS::ClearRegisters(
int reg_from,
int reg_to) {
1067 DCHECK(reg_from <= reg_to);
1068 __ ld(a0,
MemOperand(frame_pointer(), kInputStartMinusOne));
1069 for (
int reg = reg_from; reg <= reg_to; reg++) {
1070 __ sd(a0, register_location(reg));
1075 void RegExpMacroAssemblerMIPS::WriteStackPointerToRegister(
int reg) {
1077 __ Dsubu(a0, backtrack_stackpointer(), a1);
1078 __ sd(a0, register_location(reg));
1082 bool RegExpMacroAssemblerMIPS::CanReadUnaligned() {
1089 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) {
1090 int stack_alignment = base::OS::ActivationFrameAlignment();
1093 __ mov(scratch,
sp);
1096 __ And(
sp,
sp, Operand(-stack_alignment));
1099 __ mov(a2, frame_pointer());
1105 __ Dsubu(
sp,
sp, Operand(stack_alignment));
1120 ExternalReference stack_guard_check =
1121 ExternalReference::re_check_stack_guard_state(masm_->isolate());
1122 __ li(t9, Operand(stack_guard_check));
1123 DirectCEntryStub stub(isolate());
1124 stub.GenerateCall(masm_, t9);
1139 __ li(code_pointer(), Operand(masm_->CodeObject()));
1144 template <
typename T>
1145 static T& frame_entry(
Address re_frame,
int frame_offset) {
1146 return reinterpret_cast<T&
>(Memory::int32_at(re_frame + frame_offset));
1150 int RegExpMacroAssemblerMIPS::CheckStackGuardState(
Address* return_address,
1153 Isolate* isolate = frame_entry<Isolate*>(re_frame, kIsolate);
1154 StackLimitCheck check(isolate);
1155 if (check.JsHasOverflowed()) {
1156 isolate->StackOverflow();
1165 if (frame_entry<int>(re_frame, kDirectCall) == 1) {
1170 HandleScope handles(isolate);
1171 Handle<Code> code_handle(re_code);
1173 Handle<String> subject(frame_entry<String*>(re_frame, kInputString));
1175 bool is_one_byte = subject->IsOneByteRepresentationUnderneath();
1177 DCHECK(re_code->instruction_start() <= *return_address);
1178 DCHECK(*return_address <=
1179 re_code->instruction_start() + re_code->instruction_size());
1181 Object* result = isolate->stack_guard()->HandleInterrupts();
1183 if (*code_handle != re_code) {
1184 int delta = code_handle->address() - re_code->address();
1186 *return_address += delta;
1189 if (result->IsException()) {
1193 Handle<String> subject_tmp = subject;
1194 int slice_offset = 0;
1197 if (StringShape(*subject_tmp).IsCons()) {
1198 subject_tmp = Handle<String>(ConsString::cast(*subject_tmp)->first());
1199 }
else if (StringShape(*subject_tmp).IsSliced()) {
1200 SlicedString* slice = SlicedString::cast(*subject_tmp);
1201 subject_tmp = Handle<String>(slice->parent());
1202 slice_offset = slice->offset();
1206 if (subject_tmp->IsOneByteRepresentation() != is_one_byte) {
1217 DCHECK(StringShape(*subject_tmp).IsSequential() ||
1218 StringShape(*subject_tmp).IsExternal());
1221 const byte* start_address = frame_entry<const byte*>(re_frame, kInputStart);
1225 int start_index = frame_entry<int>(re_frame, kStartIndex);
1226 const byte* new_address = StringCharacterPosition(*subject_tmp,
1227 start_index + slice_offset);
1229 if (start_address != new_address) {
1232 const byte* end_address = frame_entry<const byte* >(re_frame, kInputEnd);
1233 int byte_length =
static_cast<int>(end_address - start_address);
1234 frame_entry<const String*>(re_frame, kInputString) = *subject;
1235 frame_entry<const byte*>(re_frame, kInputStart) = new_address;
1236 frame_entry<const byte*>(re_frame, kInputEnd) = new_address + byte_length;
1237 }
else if (frame_entry<const String*>(re_frame, kInputString) != *subject) {
1241 frame_entry<const String*>(re_frame, kInputString) = *subject;
1248 MemOperand RegExpMacroAssemblerMIPS::register_location(
int register_index) {
1249 DCHECK(register_index < (1<<30));
1250 if (num_registers_ <= register_index) {
1251 num_registers_ = register_index + 1;
1258 void RegExpMacroAssemblerMIPS::CheckPosition(
int cp_offset,
1259 Label* on_outside_input) {
1260 BranchOrBacktrack(on_outside_input,
1262 current_input_offset(),
1263 Operand(-cp_offset * char_size()));
1267 void RegExpMacroAssemblerMIPS::BranchOrBacktrack(Label*
to,
1270 const Operand& rt) {
1271 if (condition ==
al) {
1280 __ Branch(&backtrack_label_, condition, rs, rt);
1283 __ Branch(
to, condition, rs, rt);
1287 void RegExpMacroAssemblerMIPS::SafeCall(Label*
to,
1290 const Operand& rt) {
1291 __ BranchAndLink(
to, cond, rs, rt);
1295 void RegExpMacroAssemblerMIPS::SafeReturn() {
1297 __ Daddu(t1, ra, Operand(masm_->CodeObject()));
1302 void RegExpMacroAssemblerMIPS::SafeCallTarget(Label*
name) {
1304 __ Dsubu(ra, ra, Operand(masm_->CodeObject()));
1310 DCHECK(!source.is(backtrack_stackpointer()));
1311 __ Daddu(backtrack_stackpointer(),
1312 backtrack_stackpointer(),
1318 void RegExpMacroAssemblerMIPS::Pop(Register target) {
1319 DCHECK(!target.is(backtrack_stackpointer()));
1321 __ Daddu(backtrack_stackpointer(), backtrack_stackpointer(),
kIntSize);
1325 void RegExpMacroAssemblerMIPS::CheckPreemption() {
1327 ExternalReference stack_limit =
1328 ExternalReference::address_of_stack_limit(masm_->isolate());
1329 __ li(a0, Operand(stack_limit));
1331 SafeCall(&check_preempt_label_,
ls,
sp, Operand(a0));
1335 void RegExpMacroAssemblerMIPS::CheckStackLimit() {
1336 ExternalReference stack_limit =
1337 ExternalReference::address_of_regexp_stack_limit(masm_->isolate());
1339 __ li(a0, Operand(stack_limit));
1341 SafeCall(&stack_overflow_label_,
ls, backtrack_stackpointer(), Operand(a0));
1345 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(
int cp_offset,
1347 Register offset = current_input_offset();
1348 if (cp_offset != 0) {
1350 __ Daddu(t3, current_input_offset(), Operand(cp_offset * char_size()));
1356 __ Daddu(t1, end_of_input_address(), Operand(offset));
1357 if (mode_ == LATIN1) {
RegExpMacroAssemblerMIPS(Mode mode, int registers_to_save, Zone *zone)
static const AbiVariants kMipsAbi
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define LOG(isolate, Call)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
bool IsPowerOfTwo32(uint32_t value)
static int Push(SpecialRPOStackFrame *stack, int depth, BasicBlock *child, int unvisited)
kSerializedDataOffset Object
MemOperand FieldMemOperand(Register object, int offset)
const int kCArgsSlotsSize
bool IsAligned(T value, U alignment)
Debugger support for the V8 JavaScript engine.
#define T(name, string, precedence)
Definitions and convenience functions for working with unicode.