7 #if V8_TARGET_ARCH_MIPS
21 #ifndef V8_INTERPRETED_REGEXP
96 #define __ ACCESS_MASM(masm_)
100 int registers_to_save,
102 : NativeRegExpMacroAssembler(zone),
103 masm_(new MacroAssembler(zone->isolate(),
NULL, kRegExpCodeSize)),
105 num_registers_(registers_to_save),
106 num_saved_registers_(registers_to_save),
112 internal_failure_label_() {
114 __ jmp(&entry_label_);
117 __ bind(&internal_failure_label_);
118 __ li(v0, Operand(FAILURE));
120 __ bind(&start_label_);
124 RegExpMacroAssemblerMIPS::~RegExpMacroAssemblerMIPS() {
127 entry_label_.Unuse();
128 start_label_.Unuse();
129 success_label_.Unuse();
130 backtrack_label_.Unuse();
132 check_preempt_label_.Unuse();
133 stack_overflow_label_.Unuse();
134 internal_failure_label_.Unuse();
138 int RegExpMacroAssemblerMIPS::stack_limit_slack() {
139 return RegExpStack::kStackLimitSlack;
143 void RegExpMacroAssemblerMIPS::AdvanceCurrentPosition(
int by) {
145 __ Addu(current_input_offset(),
146 current_input_offset(), Operand(by * char_size()));
151 void RegExpMacroAssemblerMIPS::AdvanceRegister(
int reg,
int by) {
153 DCHECK(reg < num_registers_);
155 __ lw(a0, register_location(reg));
156 __ Addu(a0, a0, Operand(by));
157 __ sw(a0, register_location(reg));
162 void RegExpMacroAssemblerMIPS::Backtrack() {
166 __ Addu(a0, a0, code_pointer());
171 void RegExpMacroAssemblerMIPS::Bind(Label* label) {
176 void RegExpMacroAssemblerMIPS::CheckCharacter(
uint32_t c, Label* on_equal) {
177 BranchOrBacktrack(on_equal,
eq, current_character(), Operand(c));
181 void RegExpMacroAssemblerMIPS::CheckCharacterGT(
uc16 limit, Label* on_greater) {
182 BranchOrBacktrack(on_greater,
gt, current_character(), Operand(limit));
186 void RegExpMacroAssemblerMIPS::CheckAtStart(Label* on_at_start) {
190 BranchOrBacktrack(¬_at_start,
ne, a0, Operand(zero_reg));
194 __ Addu(a0, end_of_input_address(), Operand(current_input_offset()));
195 BranchOrBacktrack(on_at_start,
eq, a0, Operand(a1));
196 __ bind(¬_at_start);
200 void RegExpMacroAssemblerMIPS::CheckNotAtStart(Label* on_not_at_start) {
203 BranchOrBacktrack(on_not_at_start,
ne, a0, Operand(zero_reg));
206 __ Addu(a0, end_of_input_address(), Operand(current_input_offset()));
207 BranchOrBacktrack(on_not_at_start,
ne, a0, Operand(a1));
211 void RegExpMacroAssemblerMIPS::CheckCharacterLT(
uc16 limit, Label* on_less) {
212 BranchOrBacktrack(on_less,
lt, current_character(), Operand(limit));
216 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) {
217 Label backtrack_non_equal;
219 __ Branch(&backtrack_non_equal,
ne, current_input_offset(), Operand(a0));
220 __ Addu(backtrack_stackpointer(),
221 backtrack_stackpointer(),
223 __ bind(&backtrack_non_equal);
224 BranchOrBacktrack(on_equal,
eq, current_input_offset(), Operand(a0));
228 void RegExpMacroAssemblerMIPS::CheckNotBackReferenceIgnoreCase(
230 Label* on_no_match) {
232 __ lw(a0, register_location(start_reg));
233 __ lw(a1, register_location(start_reg + 1));
238 __ Branch(&fallthrough,
eq, a1, Operand(zero_reg));
240 __ Addu(t5, a1, current_input_offset());
242 BranchOrBacktrack(on_no_match,
gt, t5, Operand(zero_reg));
244 if (mode_ == LATIN1) {
251 __ Addu(a0, a0, Operand(end_of_input_address()));
252 __ Addu(a2, end_of_input_address(), Operand(current_input_offset()));
253 __ Addu(a1, a0, Operand(a1));
262 __ addiu(a0, a0, char_size());
264 __ addiu(a2, a2, char_size());
266 __ Branch(&loop_check,
eq, t0, Operand(a3));
269 __ Or(a3, a3, Operand(0x20));
270 __ Or(t0, t0, Operand(0x20));
271 __ Branch(&fail,
ne, t0, Operand(a3));
272 __ Subu(a3, a3, Operand(
'a'));
273 __ Branch(&loop_check,
ls, a3, Operand(
'z' -
'a'));
275 __ Subu(a3, a3, Operand(224 -
'a'));
277 __ Branch(&fail,
hi, a3, Operand(254 - 224));
279 __ Branch(&fail,
eq, a3, Operand(247 - 224));
281 __ bind(&loop_check);
282 __ Branch(&loop,
lt, a0, Operand(a1));
290 __ Subu(current_input_offset(), a2, end_of_input_address());
294 RegList regexp_registers_to_retain = current_input_offset().bit() |
295 current_character().bit() | backtrack_stackpointer().bit();
296 __ MultiPush(regexp_registers_to_retain);
298 int argument_count = 4;
299 __ PrepareCallCFunction(argument_count, a2);
312 __ Addu(a0, a0, Operand(end_of_input_address()));
318 __ Addu(a1, current_input_offset(), Operand(end_of_input_address()));
320 __ li(a3, Operand(ExternalReference::isolate_address(masm_->isolate())));
323 AllowExternalCallThatCantCauseGC scope(masm_);
324 ExternalReference
function =
325 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate());
326 __ CallCFunction(
function, argument_count);
330 __ MultiPop(regexp_registers_to_retain);
332 __ lw(end_of_input_address(),
MemOperand(frame_pointer(), kInputEnd));
335 BranchOrBacktrack(on_no_match,
eq, v0, Operand(zero_reg));
337 __ Addu(current_input_offset(), current_input_offset(), Operand(
s3));
340 __ bind(&fallthrough);
344 void RegExpMacroAssemblerMIPS::CheckNotBackReference(
346 Label* on_no_match) {
351 __ lw(a0, register_location(start_reg));
352 __ lw(a1, register_location(start_reg + 1));
355 __ Branch(&fallthrough,
eq, a1, Operand(zero_reg));
357 __ Addu(t5, a1, current_input_offset());
359 BranchOrBacktrack(on_no_match,
gt, t5, Operand(zero_reg));
362 __ Addu(a0, a0, Operand(end_of_input_address()));
363 __ Addu(a2, end_of_input_address(), Operand(current_input_offset()));
364 __ Addu(a1, a1, Operand(a0));
368 if (mode_ == LATIN1) {
370 __ addiu(a0, a0, char_size());
372 __ addiu(a2, a2, char_size());
376 __ addiu(a0, a0, char_size());
378 __ addiu(a2, a2, char_size());
380 BranchOrBacktrack(on_no_match,
ne, a3, Operand(t0));
381 __ Branch(&loop,
lt, a0, Operand(a1));
384 __ Subu(current_input_offset(), a2, end_of_input_address());
385 __ bind(&fallthrough);
389 void RegExpMacroAssemblerMIPS::CheckNotCharacter(
uint32_t c,
390 Label* on_not_equal) {
391 BranchOrBacktrack(on_not_equal,
ne, current_character(), Operand(c));
395 void RegExpMacroAssemblerMIPS::CheckCharacterAfterAnd(
uint32_t c,
398 __ And(a0, current_character(), Operand(mask));
399 Operand rhs = (c == 0) ? Operand(zero_reg) : Operand(c);
400 BranchOrBacktrack(on_equal,
eq, a0, rhs);
404 void RegExpMacroAssemblerMIPS::CheckNotCharacterAfterAnd(
uint32_t c,
406 Label* on_not_equal) {
407 __ And(a0, current_character(), Operand(mask));
408 Operand rhs = (c == 0) ? Operand(zero_reg) : Operand(c);
409 BranchOrBacktrack(on_not_equal,
ne, a0, rhs);
413 void RegExpMacroAssemblerMIPS::CheckNotCharacterAfterMinusAnd(
417 Label* on_not_equal) {
418 DCHECK(minus < String::kMaxUtf16CodeUnit);
419 __ Subu(a0, current_character(), Operand(minus));
420 __ And(a0, a0, Operand(mask));
421 BranchOrBacktrack(on_not_equal,
ne, a0, Operand(c));
425 void RegExpMacroAssemblerMIPS::CheckCharacterInRange(
428 Label* on_in_range) {
429 __ Subu(a0, current_character(), Operand(from));
431 BranchOrBacktrack(on_in_range,
ls, a0, Operand(
to - from));
435 void RegExpMacroAssemblerMIPS::CheckCharacterNotInRange(
438 Label* on_not_in_range) {
439 __ Subu(a0, current_character(), Operand(from));
441 BranchOrBacktrack(on_not_in_range,
hi, a0, Operand(
to - from));
445 void RegExpMacroAssemblerMIPS::CheckBitInTable(
446 Handle<ByteArray> table,
448 __ li(a0, Operand(table));
449 if (mode_ != LATIN1 || kTableMask != String::kMaxOneByteCharCode) {
450 __ And(a1, current_character(), Operand(kTableSize - 1));
453 __ Addu(a0, a0, current_character());
457 BranchOrBacktrack(on_bit_set,
ne, a0, Operand(zero_reg));
461 bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(
uc16 type,
462 Label* on_no_match) {
468 if (mode_ == LATIN1) {
471 __ Branch(&success,
eq, current_character(), Operand(
' '));
473 __ Subu(a0, current_character(), Operand(
'\t'));
474 __ Branch(&success,
ls, a0, Operand(
'\r' -
'\t'));
476 BranchOrBacktrack(on_no_match,
ne, a0, Operand(0x00a0 -
'\t'));
486 __ Subu(a0, current_character(), Operand(
'0'));
487 BranchOrBacktrack(on_no_match,
hi, a0, Operand(
'9' -
'0'));
491 __ Subu(a0, current_character(), Operand(
'0'));
492 BranchOrBacktrack(on_no_match,
ls, a0, Operand(
'9' -
'0'));
496 __ Xor(a0, current_character(), Operand(0x01));
498 __ Subu(a0, a0, Operand(0x0b));
499 BranchOrBacktrack(on_no_match,
ls, a0, Operand(0x0c - 0x0b));
504 __ Subu(a0, a0, Operand(0x2028 - 0x0b));
505 BranchOrBacktrack(on_no_match,
ls, a0, Operand(1));
511 __ Xor(a0, current_character(), Operand(0x01));
513 __ Subu(a0, a0, Operand(0x0b));
514 if (mode_ == LATIN1) {
515 BranchOrBacktrack(on_no_match,
hi, a0, Operand(0x0c - 0x0b));
518 BranchOrBacktrack(&done,
ls, a0, Operand(0x0c - 0x0b));
522 __ Subu(a0, a0, Operand(0x2028 - 0x0b));
523 BranchOrBacktrack(on_no_match,
hi, a0, Operand(1));
529 if (mode_ != LATIN1) {
531 BranchOrBacktrack(on_no_match,
hi, current_character(), Operand(
'z'));
533 ExternalReference
map = ExternalReference::re_word_character_map();
534 __ li(a0, Operand(
map));
535 __ Addu(a0, a0, current_character());
537 BranchOrBacktrack(on_no_match,
eq, a0, Operand(zero_reg));
542 if (mode_ != LATIN1) {
544 __ Branch(&done,
hi, current_character(), Operand(
'z'));
546 ExternalReference
map = ExternalReference::re_word_character_map();
547 __ li(a0, Operand(
map));
548 __ Addu(a0, a0, current_character());
550 BranchOrBacktrack(on_no_match,
ne, a0, Operand(zero_reg));
551 if (mode_ != LATIN1) {
566 void RegExpMacroAssemblerMIPS::Fail() {
567 __ li(v0, Operand(FAILURE));
568 __ jmp(&exit_label_);
572 Handle<HeapObject> RegExpMacroAssemblerMIPS::GetCode(Handle<String> source) {
574 if (masm_->has_exception()) {
578 __ bind_to(&entry_label_, internal_failure_label_.pos());
584 __ bind(&entry_label_);
588 FrameScope scope(masm_, StackFrame::MANUAL);
598 RegList argument_registers = a0.bit() | a1.bit() | a2.bit() | a3.bit();
599 __ MultiPush(argument_registers | registers_to_retain | ra.bit());
603 __ mov(a0, zero_reg);
608 Label stack_limit_hit;
611 ExternalReference stack_limit =
612 ExternalReference::address_of_stack_limit(masm_->isolate());
613 __ li(a0, Operand(stack_limit));
617 __ Branch(&stack_limit_hit,
le, a0, Operand(zero_reg));
623 __ li(v0, Operand(EXCEPTION));
626 __ bind(&stack_limit_hit);
627 CallCheckStackGuardState(a0);
629 __ Branch(&return_v0,
ne, v0, Operand(zero_reg));
635 __ lw(end_of_input_address(),
MemOperand(frame_pointer(), kInputEnd));
639 __ Subu(current_input_offset(), a0, end_of_input_address());
643 __ Subu(a0, current_input_offset(), Operand(char_size()));
644 __ sll(t5, a1, (mode_ == UC16) ? 1 : 0);
648 __ sw(a0,
MemOperand(frame_pointer(), kInputStartMinusOne));
653 Label load_char_start_regexp, start_regexp;
655 __ Branch(&load_char_start_regexp,
ne, a1, Operand(zero_reg));
656 __ li(current_character(), Operand(
'\n'));
657 __ jmp(&start_regexp);
660 __ bind(&load_char_start_regexp);
662 LoadCurrentCharacterUnchecked(-1, 1);
663 __ bind(&start_regexp);
666 if (num_saved_registers_ > 0) {
668 if (num_saved_registers_ > 8) {
670 __ Addu(a1, frame_pointer(), Operand(kRegisterZero));
671 __ li(a2, Operand(num_saved_registers_));
676 __ Subu(a2, a2, Operand(1));
677 __ Branch(&init_loop,
ne, a2, Operand(zero_reg));
679 for (
int i = 0;
i < num_saved_registers_;
i++) {
680 __ sw(a0, register_location(
i));
686 __ lw(backtrack_stackpointer(),
MemOperand(frame_pointer(), kStackHighEnd));
688 __ jmp(&start_label_);
692 if (success_label_.is_linked()) {
694 __ bind(&success_label_);
695 if (num_saved_registers_ > 0) {
698 __ lw(a0,
MemOperand(frame_pointer(), kRegisterOutput));
700 __ Subu(a1, end_of_input_address(), a1);
706 __ Addu(a1, a1, Operand(a2));
713 for (
int i = 0;
i < num_saved_registers_;
i += 2) {
714 __ lw(a2, register_location(
i));
715 __ lw(a3, register_location(
i + 1));
716 if (
i == 0 && global_with_zero_length_check()) {
726 __ Addu(a2, a1, Operand(a2));
727 __ Addu(a3, a1, Operand(a3));
738 __ lw(a0,
MemOperand(frame_pointer(), kSuccessfulCaptures));
739 __ lw(a1,
MemOperand(frame_pointer(), kNumOutputRegisters));
740 __ lw(a2,
MemOperand(frame_pointer(), kRegisterOutput));
743 __ sw(a0,
MemOperand(frame_pointer(), kSuccessfulCaptures));
746 __ Subu(a1, a1, num_saved_registers_);
749 __ Branch(&return_v0,
lt, a1, Operand(num_saved_registers_));
751 __ sw(a1,
MemOperand(frame_pointer(), kNumOutputRegisters));
754 __ sw(a2,
MemOperand(frame_pointer(), kRegisterOutput));
757 __ lw(a0,
MemOperand(frame_pointer(), kInputStartMinusOne));
759 if (global_with_zero_length_check()) {
764 &load_char_start_regexp,
ne, current_input_offset(), Operand(t7));
766 __ Branch(&exit_label_,
eq, current_input_offset(),
769 __ Addu(current_input_offset(),
770 current_input_offset(),
771 Operand((mode_ == UC16) ? 2 : 1));
774 __ Branch(&load_char_start_regexp);
776 __ li(v0, Operand(SUCCESS));
780 __ bind(&exit_label_);
782 __ lw(v0,
MemOperand(frame_pointer(), kSuccessfulCaptures));
787 __ mov(
sp, frame_pointer());
789 __ MultiPop(registers_to_retain | ra.bit());
793 if (backtrack_label_.is_linked()) {
794 __ bind(&backtrack_label_);
798 Label exit_with_exception;
801 if (check_preempt_label_.is_linked()) {
802 SafeCallTarget(&check_preempt_label_);
804 RegList regexp_registers_to_retain = current_input_offset().bit() |
805 current_character().bit() | backtrack_stackpointer().bit();
806 __ MultiPush(regexp_registers_to_retain);
807 CallCheckStackGuardState(a0);
808 __ MultiPop(regexp_registers_to_retain);
811 __ Branch(&return_v0,
ne, v0, Operand(zero_reg));
814 __ lw(end_of_input_address(),
MemOperand(frame_pointer(), kInputEnd));
820 if (stack_overflow_label_.is_linked()) {
821 SafeCallTarget(&stack_overflow_label_);
824 RegList regexp_registers = current_input_offset().bit() |
825 current_character().bit();
826 __ MultiPush(regexp_registers);
829 static const int num_arguments = 3;
830 __ PrepareCallCFunction(num_arguments, a0);
831 __ mov(a0, backtrack_stackpointer());
832 __ Addu(a1, frame_pointer(), Operand(kStackHighEnd));
833 __ li(a2, Operand(ExternalReference::isolate_address(masm_->isolate())));
834 ExternalReference grow_stack =
835 ExternalReference::re_grow_stack(masm_->isolate());
836 __ CallCFunction(grow_stack, num_arguments);
838 __ MultiPop(regexp_registers);
841 __ Branch(&exit_with_exception,
eq, v0, Operand(zero_reg));
843 __ mov(backtrack_stackpointer(), v0);
846 __ lw(end_of_input_address(),
MemOperand(frame_pointer(), kInputEnd));
850 if (exit_with_exception.is_linked()) {
852 __ bind(&exit_with_exception);
854 __ li(v0, Operand(EXCEPTION));
860 masm_->GetCode(&code_desc);
861 Handle<Code> code = isolate()->factory()->NewCode(
862 code_desc, Code::ComputeFlags(Code::REGEXP), masm_->CodeObject());
863 LOG(masm_->isolate(), RegExpCodeCreateEvent(*code, *source));
864 return Handle<HeapObject>::cast(code);
868 void RegExpMacroAssemblerMIPS::GoTo(Label*
to) {
878 void RegExpMacroAssemblerMIPS::IfRegisterGE(
int reg,
881 __ lw(a0, register_location(reg));
882 BranchOrBacktrack(if_ge,
ge, a0, Operand(comparand));
886 void RegExpMacroAssemblerMIPS::IfRegisterLT(
int reg,
889 __ lw(a0, register_location(reg));
890 BranchOrBacktrack(if_lt,
lt, a0, Operand(comparand));
894 void RegExpMacroAssemblerMIPS::IfRegisterEqPos(
int reg,
896 __ lw(a0, register_location(reg));
897 BranchOrBacktrack(if_eq,
eq, a0, Operand(current_input_offset()));
901 RegExpMacroAssembler::IrregexpImplementation
902 RegExpMacroAssemblerMIPS::Implementation() {
903 return kMIPSImplementation;
907 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(
int cp_offset,
908 Label* on_end_of_input,
912 DCHECK(cp_offset < (1<<30));
914 CheckPosition(cp_offset + characters - 1, on_end_of_input);
916 LoadCurrentCharacterUnchecked(cp_offset, characters);
920 void RegExpMacroAssemblerMIPS::PopCurrentPosition() {
921 Pop(current_input_offset());
925 void RegExpMacroAssemblerMIPS::PopRegister(
int register_index) {
927 __ sw(a0, register_location(register_index));
931 void RegExpMacroAssemblerMIPS::PushBacktrack(Label* label) {
932 if (label->is_bound()) {
933 int target = label->pos();
936 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
937 Label after_constant;
938 __ Branch(&after_constant);
939 int offset = masm_->pc_offset();
942 masm_->label_at_put(label, offset);
943 __ bind(&after_constant);
944 if (is_int16(cp_offset)) {
947 __ Addu(a0, code_pointer(), cp_offset);
956 void RegExpMacroAssemblerMIPS::PushCurrentPosition() {
957 Push(current_input_offset());
961 void RegExpMacroAssemblerMIPS::PushRegister(
int register_index,
962 StackCheckFlag check_stack_limit) {
963 __ lw(a0, register_location(register_index));
965 if (check_stack_limit) CheckStackLimit();
969 void RegExpMacroAssemblerMIPS::ReadCurrentPositionFromRegister(
int reg) {
970 __ lw(current_input_offset(), register_location(reg));
974 void RegExpMacroAssemblerMIPS::ReadStackPointerFromRegister(
int reg) {
975 __ lw(backtrack_stackpointer(), register_location(reg));
977 __ Addu(backtrack_stackpointer(), backtrack_stackpointer(), Operand(a0));
981 void RegExpMacroAssemblerMIPS::SetCurrentPositionFromEnd(
int by) {
982 Label after_position;
983 __ Branch(&after_position,
985 current_input_offset(),
986 Operand(-by * char_size()));
987 __ li(current_input_offset(), -by * char_size());
991 LoadCurrentCharacterUnchecked(-1, 1);
992 __ bind(&after_position);
996 void RegExpMacroAssemblerMIPS::SetRegister(
int register_index,
int to) {
997 DCHECK(register_index >= num_saved_registers_);
998 __ li(a0, Operand(
to));
999 __ sw(a0, register_location(register_index));
1003 bool RegExpMacroAssemblerMIPS::Succeed() {
1004 __ jmp(&success_label_);
1009 void RegExpMacroAssemblerMIPS::WriteCurrentPositionToRegister(
int reg,
1011 if (cp_offset == 0) {
1012 __ sw(current_input_offset(), register_location(reg));
1014 __ Addu(a0, current_input_offset(), Operand(cp_offset * char_size()));
1015 __ sw(a0, register_location(reg));
1020 void RegExpMacroAssemblerMIPS::ClearRegisters(
int reg_from,
int reg_to) {
1021 DCHECK(reg_from <= reg_to);
1022 __ lw(a0,
MemOperand(frame_pointer(), kInputStartMinusOne));
1023 for (
int reg = reg_from; reg <= reg_to; reg++) {
1024 __ sw(a0, register_location(reg));
1029 void RegExpMacroAssemblerMIPS::WriteStackPointerToRegister(
int reg) {
1031 __ Subu(a0, backtrack_stackpointer(), a1);
1032 __ sw(a0, register_location(reg));
1036 bool RegExpMacroAssemblerMIPS::CanReadUnaligned() {
1043 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) {
1044 int stack_alignment = base::OS::ActivationFrameAlignment();
1047 __ mov(scratch,
sp);
1050 __ And(
sp,
sp, Operand(-stack_alignment));
1053 __ mov(a2, frame_pointer());
1059 __ Subu(
sp,
sp, Operand(stack_alignment));
1074 ExternalReference stack_guard_check =
1075 ExternalReference::re_check_stack_guard_state(masm_->isolate());
1076 __ li(t9, Operand(stack_guard_check));
1077 DirectCEntryStub stub(isolate());
1078 stub.GenerateCall(masm_, t9);
1093 __ li(code_pointer(), Operand(masm_->CodeObject()));
1098 template <
typename T>
1099 static T& frame_entry(
Address re_frame,
int frame_offset) {
1100 return reinterpret_cast<T&
>(Memory::int32_at(re_frame + frame_offset));
1104 int RegExpMacroAssemblerMIPS::CheckStackGuardState(
Address* return_address,
1107 Isolate* isolate = frame_entry<Isolate*>(re_frame, kIsolate);
1108 StackLimitCheck check(isolate);
1109 if (check.JsHasOverflowed()) {
1110 isolate->StackOverflow();
1119 if (frame_entry<int>(re_frame, kDirectCall) == 1) {
1124 HandleScope handles(isolate);
1125 Handle<Code> code_handle(re_code);
1127 Handle<String> subject(frame_entry<String*>(re_frame, kInputString));
1129 bool is_one_byte = subject->IsOneByteRepresentationUnderneath();
1131 DCHECK(re_code->instruction_start() <= *return_address);
1132 DCHECK(*return_address <=
1133 re_code->instruction_start() + re_code->instruction_size());
1135 Object* result = isolate->stack_guard()->HandleInterrupts();
1137 if (*code_handle != re_code) {
1138 int delta = code_handle->address() - re_code->address();
1140 *return_address += delta;
1143 if (result->IsException()) {
1147 Handle<String> subject_tmp = subject;
1148 int slice_offset = 0;
1151 if (StringShape(*subject_tmp).IsCons()) {
1152 subject_tmp = Handle<String>(ConsString::cast(*subject_tmp)->first());
1153 }
else if (StringShape(*subject_tmp).IsSliced()) {
1154 SlicedString* slice = SlicedString::cast(*subject_tmp);
1155 subject_tmp = Handle<String>(slice->parent());
1156 slice_offset = slice->offset();
1160 if (subject_tmp->IsOneByteRepresentation() != is_one_byte) {
1171 DCHECK(StringShape(*subject_tmp).IsSequential() ||
1172 StringShape(*subject_tmp).IsExternal());
1175 const byte* start_address = frame_entry<const byte*>(re_frame, kInputStart);
1179 int start_index = frame_entry<int>(re_frame, kStartIndex);
1180 const byte* new_address = StringCharacterPosition(*subject_tmp,
1181 start_index + slice_offset);
1183 if (start_address != new_address) {
1186 const byte* end_address = frame_entry<const byte* >(re_frame, kInputEnd);
1187 int byte_length =
static_cast<int>(end_address - start_address);
1188 frame_entry<const String*>(re_frame, kInputString) = *subject;
1189 frame_entry<const byte*>(re_frame, kInputStart) = new_address;
1190 frame_entry<const byte*>(re_frame, kInputEnd) = new_address + byte_length;
1191 }
else if (frame_entry<const String*>(re_frame, kInputString) != *subject) {
1195 frame_entry<const String*>(re_frame, kInputString) = *subject;
1202 MemOperand RegExpMacroAssemblerMIPS::register_location(
int register_index) {
1203 DCHECK(register_index < (1<<30));
1204 if (num_registers_ <= register_index) {
1205 num_registers_ = register_index + 1;
1212 void RegExpMacroAssemblerMIPS::CheckPosition(
int cp_offset,
1213 Label* on_outside_input) {
1214 BranchOrBacktrack(on_outside_input,
1216 current_input_offset(),
1217 Operand(-cp_offset * char_size()));
1221 void RegExpMacroAssemblerMIPS::BranchOrBacktrack(Label*
to,
1224 const Operand& rt) {
1225 if (condition ==
al) {
1234 __ Branch(&backtrack_label_, condition, rs, rt);
1237 __ Branch(
to, condition, rs, rt);
1241 void RegExpMacroAssemblerMIPS::SafeCall(Label*
to,
1244 const Operand& rt) {
1245 __ BranchAndLink(
to, cond, rs, rt);
1249 void RegExpMacroAssemblerMIPS::SafeReturn() {
1251 __ Addu(t5, ra, Operand(masm_->CodeObject()));
1256 void RegExpMacroAssemblerMIPS::SafeCallTarget(Label*
name) {
1258 __ Subu(ra, ra, Operand(masm_->CodeObject()));
1264 DCHECK(!source.is(backtrack_stackpointer()));
1265 __ Addu(backtrack_stackpointer(),
1266 backtrack_stackpointer(),
1272 void RegExpMacroAssemblerMIPS::Pop(Register target) {
1273 DCHECK(!target.is(backtrack_stackpointer()));
1275 __ Addu(backtrack_stackpointer(), backtrack_stackpointer(),
kPointerSize);
1279 void RegExpMacroAssemblerMIPS::CheckPreemption() {
1281 ExternalReference stack_limit =
1282 ExternalReference::address_of_stack_limit(masm_->isolate());
1283 __ li(a0, Operand(stack_limit));
1285 SafeCall(&check_preempt_label_,
ls,
sp, Operand(a0));
1289 void RegExpMacroAssemblerMIPS::CheckStackLimit() {
1290 ExternalReference stack_limit =
1291 ExternalReference::address_of_regexp_stack_limit(masm_->isolate());
1293 __ li(a0, Operand(stack_limit));
1295 SafeCall(&stack_overflow_label_,
ls, backtrack_stackpointer(), Operand(a0));
1299 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(
int cp_offset,
1301 Register offset = current_input_offset();
1302 if (cp_offset != 0) {
1304 __ Addu(t7, current_input_offset(), Operand(cp_offset * char_size()));
1310 __ Addu(t5, end_of_input_address(), Operand(offset));
1311 if (mode_ == LATIN1) {
RegExpMacroAssemblerMIPS(Mode mode, int registers_to_save, Zone *zone)
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.