| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 } | 696 } |
| 697 | 697 |
| 698 | 698 |
| 699 void RegExpMacroAssemblerX64::Fail() { | 699 void RegExpMacroAssemblerX64::Fail() { |
| 700 ASSERT(FAILURE == 0); // Return value for failure is zero. | 700 ASSERT(FAILURE == 0); // Return value for failure is zero. |
| 701 __ Set(rax, 0); | 701 __ Set(rax, 0); |
| 702 __ jmp(&exit_label_); | 702 __ jmp(&exit_label_); |
| 703 } | 703 } |
| 704 | 704 |
| 705 | 705 |
| 706 Handle<Object> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { | 706 Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { |
| 707 // Finalize code - write the entry point code now we know how many | 707 // Finalize code - write the entry point code now we know how many |
| 708 // registers we need. | 708 // registers we need. |
| 709 // Entry code: | 709 // Entry code: |
| 710 __ bind(&entry_label_); | 710 __ bind(&entry_label_); |
| 711 // Start new stack frame. | 711 // Start new stack frame. |
| 712 __ push(rbp); | 712 __ push(rbp); |
| 713 __ movq(rbp, rsp); | 713 __ movq(rbp, rsp); |
| 714 // Save parameters and callee-save registers. Order here should correspond | 714 // Save parameters and callee-save registers. Order here should correspond |
| 715 // to order of kBackup_ebx etc. | 715 // to order of kBackup_ebx etc. |
| 716 #ifdef _WIN64 | 716 #ifdef _WIN64 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 | 965 |
| 966 FixupCodeRelativePositions(); | 966 FixupCodeRelativePositions(); |
| 967 | 967 |
| 968 CodeDesc code_desc; | 968 CodeDesc code_desc; |
| 969 masm_.GetCode(&code_desc); | 969 masm_.GetCode(&code_desc); |
| 970 Isolate* isolate = ISOLATE; | 970 Isolate* isolate = ISOLATE; |
| 971 Handle<Code> code = isolate->factory()->NewCode( | 971 Handle<Code> code = isolate->factory()->NewCode( |
| 972 code_desc, Code::ComputeFlags(Code::REGEXP), | 972 code_desc, Code::ComputeFlags(Code::REGEXP), |
| 973 masm_.CodeObject()); | 973 masm_.CodeObject()); |
| 974 PROFILE(isolate, RegExpCodeCreateEvent(*code, *source)); | 974 PROFILE(isolate, RegExpCodeCreateEvent(*code, *source)); |
| 975 return Handle<Object>::cast(code); | 975 return Handle<HeapObject>::cast(code); |
| 976 } | 976 } |
| 977 | 977 |
| 978 | 978 |
| 979 void RegExpMacroAssemblerX64::GoTo(Label* to) { | 979 void RegExpMacroAssemblerX64::GoTo(Label* to) { |
| 980 BranchOrBacktrack(no_condition, to); | 980 BranchOrBacktrack(no_condition, to); |
| 981 } | 981 } |
| 982 | 982 |
| 983 | 983 |
| 984 void RegExpMacroAssemblerX64::IfRegisterGE(int reg, | 984 void RegExpMacroAssemblerX64::IfRegisterGE(int reg, |
| 985 int comparand, | 985 int comparand, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 | 1060 |
| 1061 void RegExpMacroAssemblerX64::ReadStackPointerFromRegister(int reg) { | 1061 void RegExpMacroAssemblerX64::ReadStackPointerFromRegister(int reg) { |
| 1062 __ movq(backtrack_stackpointer(), register_location(reg)); | 1062 __ movq(backtrack_stackpointer(), register_location(reg)); |
| 1063 __ addq(backtrack_stackpointer(), Operand(rbp, kStackHighEnd)); | 1063 __ addq(backtrack_stackpointer(), Operand(rbp, kStackHighEnd)); |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 | 1066 |
| 1067 void RegExpMacroAssemblerX64::SetCurrentPositionFromEnd(int by) { | 1067 void RegExpMacroAssemblerX64::SetCurrentPositionFromEnd(int by) { |
| 1068 NearLabel after_position; | 1068 Label after_position; |
| 1069 __ cmpq(rdi, Immediate(-by * char_size())); | 1069 __ cmpq(rdi, Immediate(-by * char_size())); |
| 1070 __ j(greater_equal, &after_position); | 1070 __ j(greater_equal, &after_position, Label::kNear); |
| 1071 __ movq(rdi, Immediate(-by * char_size())); | 1071 __ movq(rdi, Immediate(-by * char_size())); |
| 1072 // On RegExp code entry (where this operation is used), the character before | 1072 // On RegExp code entry (where this operation is used), the character before |
| 1073 // the current position is expected to be already loaded. | 1073 // the current position is expected to be already loaded. |
| 1074 // We have advanced the position, so it's safe to read backwards. | 1074 // We have advanced the position, so it's safe to read backwards. |
| 1075 LoadCurrentCharacterUnchecked(-1, 1); | 1075 LoadCurrentCharacterUnchecked(-1, 1); |
| 1076 __ bind(&after_position); | 1076 __ bind(&after_position); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 | 1079 |
| 1080 void RegExpMacroAssemblerX64::SetRegister(int register_index, int to) { | 1080 void RegExpMacroAssemblerX64::SetRegister(int register_index, int to) { |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 } | 1389 } |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 #undef __ | 1392 #undef __ |
| 1393 | 1393 |
| 1394 #endif // V8_INTERPRETED_REGEXP | 1394 #endif // V8_INTERPRETED_REGEXP |
| 1395 | 1395 |
| 1396 }} // namespace v8::internal | 1396 }} // namespace v8::internal |
| 1397 | 1397 |
| 1398 #endif // V8_TARGET_ARCH_X64 | 1398 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |