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

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

Issue 149413010: A64: Synchronize with r16024. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/a64/macro-assembler-a64.cc ('k') | src/a64/stub-cache-a64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 376
377 __ Bind(&fail); 377 __ Bind(&fail);
378 BranchOrBacktrack(al, on_no_match); 378 BranchOrBacktrack(al, on_no_match);
379 379
380 __ Bind(&success); 380 __ Bind(&success);
381 // Compute new value of character position after the matched part. 381 // Compute new value of character position after the matched part.
382 __ Sub(current_input_offset().X(), current_position_address, input_end()); 382 __ Sub(current_input_offset().X(), current_position_address, input_end());
383 if (masm_->emit_debug_code()) { 383 if (masm_->emit_debug_code()) {
384 __ Cmp(current_input_offset().X(), Operand(current_input_offset(), SXTW)); 384 __ Cmp(current_input_offset().X(), Operand(current_input_offset(), SXTW));
385 __ Ccmp(current_input_offset(), 0, NoFlag, eq); 385 __ Ccmp(current_input_offset(), 0, NoFlag, eq);
386 __ Check(le, 386 // The current input offset should be <= 0, and fit in a W register.
387 "current_input_offset should be <= 0 and fit in a W register."); 387 // TODO(all): Add this error code to objects.h.
388 // __ Check(le, kCurrentInputOffsetOutOfRange);
389 __ Check(le, kUnknown);
388 } 390 }
389 } else { 391 } else {
390 ASSERT(mode_ == UC16); 392 ASSERT(mode_ == UC16);
391 int argument_count = 4; 393 int argument_count = 4;
392 394
393 // The cached registers need to be retained. 395 // The cached registers need to be retained.
394 CPURegList cached_registers(CPURegister::kRegister, kXRegSize, 0, 7); 396 CPURegList cached_registers(CPURegister::kRegister, kXRegSize, 0, 7);
395 ASSERT((cached_registers.Count() * 2) == kNumCachedRegisters); 397 ASSERT((cached_registers.Count() * 2) == kNumCachedRegisters);
396 __ PushCPURegList(cached_registers); 398 __ PushCPURegList(cached_registers);
397 399
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 __ Cmp(w10, w11); 479 __ Cmp(w10, w11);
478 BranchOrBacktrack(ne, on_no_match); 480 BranchOrBacktrack(ne, on_no_match);
479 __ Cmp(capture_start_address, capture_end_address); 481 __ Cmp(capture_start_address, capture_end_address);
480 __ B(lt, &loop); 482 __ B(lt, &loop);
481 483
482 // Move current character position to position after match. 484 // Move current character position to position after match.
483 __ Sub(current_input_offset().X(), current_position_address, input_end()); 485 __ Sub(current_input_offset().X(), current_position_address, input_end());
484 if (masm_->emit_debug_code()) { 486 if (masm_->emit_debug_code()) {
485 __ Cmp(current_input_offset().X(), Operand(current_input_offset(), SXTW)); 487 __ Cmp(current_input_offset().X(), Operand(current_input_offset(), SXTW));
486 __ Ccmp(current_input_offset(), 0, NoFlag, eq); 488 __ Ccmp(current_input_offset(), 0, NoFlag, eq);
487 __ Check(le, 489 // The current input offset should be <= 0, and fit in a W register.
488 "current_input_offset should be <= 0 and fit in a W register."); 490 // TODO(all): Add this error code to objects.h.
491 // __ Check(le, kCurrentInputOffsetOutOfRange);
492 __ Check(le, kUnknown);
489 } 493 }
490 __ Bind(&fallthrough); 494 __ Bind(&fallthrough);
491 } 495 }
492 496
493 497
494 void RegExpMacroAssemblerA64::CheckNotCharacter(unsigned c, 498 void RegExpMacroAssemblerA64::CheckNotCharacter(unsigned c,
495 Label* on_not_equal) { 499 Label* on_not_equal) {
496 CompareAndBranchOrBacktrack(current_character(), c, ne, on_not_equal); 500 CompareAndBranchOrBacktrack(current_character(), c, ne, on_not_equal);
497 } 501 }
498 502
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 770
767 // Initialize success_counter with 0. 771 // Initialize success_counter with 0.
768 __ Str(wzr, MemOperand(frame_pointer(), kSuccessCounter)); 772 __ Str(wzr, MemOperand(frame_pointer(), kSuccessCounter));
769 773
770 // Find negative length (offset of start relative to end). 774 // Find negative length (offset of start relative to end).
771 __ Sub(x10, input_start(), input_end()); 775 __ Sub(x10, input_start(), input_end());
772 if (masm_->emit_debug_code()) { 776 if (masm_->emit_debug_code()) {
773 // Check that the input string length is < 2^30. 777 // Check that the input string length is < 2^30.
774 __ Neg(x11, x10); 778 __ Neg(x11, x10);
775 __ Cmp(x11, (1<<30) - 1); 779 __ Cmp(x11, (1<<30) - 1);
776 __ Check(ls, "The length of the input string cannot be >= 2^30."); 780 // TODO(all): Add this error code to objects.h.
781 // __ Check(ls, kInputStringTooLong);
782 __ Check(ls, kUnknown);
777 } 783 }
778 __ Mov(current_input_offset(), w10); 784 __ Mov(current_input_offset(), w10);
779 785
780 // The non-position value is used as a clearing value for the 786 // The non-position value is used as a clearing value for the
781 // capture registers, it corresponds to the position of the first character 787 // capture registers, it corresponds to the position of the first character
782 // minus one. 788 // minus one.
783 __ Sub(non_position_value(), current_input_offset(), char_size()); 789 __ Sub(non_position_value(), current_input_offset(), char_size());
784 __ Sub(non_position_value(), non_position_value(), 790 __ Sub(non_position_value(), non_position_value(),
785 Operand(start_offset(), LSL, (mode_ == UC16) ? 1 : 0)); 791 Operand(start_offset(), LSL, (mode_ == UC16) ? 1 : 0));
786 // We can store this value twice in an X register for initializing 792 // We can store this value twice in an X register for initializing
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 Register capture_end = w13; 837 Register capture_end = w13;
832 Register input_length = w14; 838 Register input_length = w14;
833 839
834 // Copy captures to output. 840 // Copy captures to output.
835 841
836 // Get string length. 842 // Get string length.
837 __ Sub(x10, input_end(), input_start()); 843 __ Sub(x10, input_end(), input_start());
838 if (masm_->emit_debug_code()) { 844 if (masm_->emit_debug_code()) {
839 // Check that the input string length is < 2^30. 845 // Check that the input string length is < 2^30.
840 __ Cmp(x10, (1<<30) - 1); 846 __ Cmp(x10, (1<<30) - 1);
841 __ Check(ls, "The length of the input string cannot be >= 2^30."); 847 // TODO(all): Add this error code to objects.h.
848 // __ Check(ls, kInputStringTooLong);
849 __ Check(ls, kUnknown);
842 } 850 }
843 // input_start has a start_offset offset on entry. We need to include 851 // input_start has a start_offset offset on entry. We need to include
844 // it when computing the length of the whole string. 852 // it when computing the length of the whole string.
845 if (mode_ == UC16) { 853 if (mode_ == UC16) {
846 __ Add(input_length, start_offset(), Operand(w10, LSR, 1)); 854 __ Add(input_length, start_offset(), Operand(w10, LSR, 1));
847 } else { 855 } else {
848 __ Add(input_length, start_offset(), w10); 856 __ Add(input_length, start_offset(), w10);
849 } 857 }
850 858
851 // Copy the results to the output array from the cached registers first. 859 // Copy the results to the output array from the cached registers first.
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 1136
1129 void RegExpMacroAssemblerA64::PushBacktrack(Label* label) { 1137 void RegExpMacroAssemblerA64::PushBacktrack(Label* label) {
1130 if (label->is_bound()) { 1138 if (label->is_bound()) {
1131 int target = label->pos(); 1139 int target = label->pos();
1132 __ Mov(w10, target + Code::kHeaderSize - kHeapObjectTag); 1140 __ Mov(w10, target + Code::kHeaderSize - kHeapObjectTag);
1133 } else { 1141 } else {
1134 __ Adr(x10, label); 1142 __ Adr(x10, label);
1135 __ Sub(x10, x10, code_pointer()); 1143 __ Sub(x10, x10, code_pointer());
1136 if (masm_->emit_debug_code()) { 1144 if (masm_->emit_debug_code()) {
1137 __ Cmp(x10, kWRegMask); 1145 __ Cmp(x10, kWRegMask);
1138 __ Check(ls, "The code offset needs to fit in a W register."); 1146 // The code offset has to fit in a W register.
1147 // TODO(all): Add this error code to objects.h.
1148 // __ Check(ls, kCodeOffsetOutOfRange);
1149 __ Check(ls, kUnknown);
1139 } 1150 }
1140 } 1151 }
1141 Push(w10); 1152 Push(w10);
1142 CheckStackLimit(); 1153 CheckStackLimit();
1143 } 1154 }
1144 1155
1145 1156
1146 void RegExpMacroAssemblerA64::PushCurrentPosition() { 1157 void RegExpMacroAssemblerA64::PushCurrentPosition() {
1147 Push(current_input_offset()); 1158 Push(current_input_offset());
1148 } 1159 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 } 1296 }
1286 } 1297 }
1287 } 1298 }
1288 1299
1289 1300
1290 void RegExpMacroAssemblerA64::WriteStackPointerToRegister(int reg) { 1301 void RegExpMacroAssemblerA64::WriteStackPointerToRegister(int reg) {
1291 __ Ldr(x10, MemOperand(frame_pointer(), kStackBase)); 1302 __ Ldr(x10, MemOperand(frame_pointer(), kStackBase));
1292 __ Sub(x10, backtrack_stackpointer(), x10); 1303 __ Sub(x10, backtrack_stackpointer(), x10);
1293 if (masm_->emit_debug_code()) { 1304 if (masm_->emit_debug_code()) {
1294 __ Cmp(x10, Operand(w10, SXTW)); 1305 __ Cmp(x10, Operand(w10, SXTW));
1295 __ Check(eq, "Offset from the stack base needs to fit in a W register."); 1306 // The stack offset needs to fit in a W register.
1307 // TODO(all): Add this error code to objects.h.
1308 // __ Check(eq, kStackOffsetIsTooLarge);
1309 __ Check(eq, kUnknown);
1296 } 1310 }
1297 StoreRegister(reg, w10); 1311 StoreRegister(reg, w10);
1298 } 1312 }
1299 1313
1300 1314
1301 // Helper function for reading a value out of a stack frame. 1315 // Helper function for reading a value out of a stack frame.
1302 template <typename T> 1316 template <typename T>
1303 static T& frame_entry(Address re_frame, int frame_offset) { 1317 static T& frame_entry(Address re_frame, int frame_offset) {
1304 return *reinterpret_cast<T*>(re_frame + frame_offset); 1318 return *reinterpret_cast<T*>(re_frame + frame_offset);
1305 } 1319 }
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 // TODO(pielan): See whether or not we should disable unaligned accesses. 1701 // TODO(pielan): See whether or not we should disable unaligned accesses.
1688 if (!CanReadUnaligned()) { 1702 if (!CanReadUnaligned()) {
1689 ASSERT(characters == 1); 1703 ASSERT(characters == 1);
1690 } 1704 }
1691 1705
1692 if (cp_offset != 0) { 1706 if (cp_offset != 0) {
1693 if (masm_->emit_debug_code()) { 1707 if (masm_->emit_debug_code()) {
1694 __ Mov(x10, cp_offset * char_size()); 1708 __ Mov(x10, cp_offset * char_size());
1695 __ Add(x10, x10, Operand(current_input_offset(), SXTW)); 1709 __ Add(x10, x10, Operand(current_input_offset(), SXTW));
1696 __ Cmp(x10, Operand(w10, SXTW)); 1710 __ Cmp(x10, Operand(w10, SXTW));
1697 __ Check(eq, "The offset needs to fit in a W register."); 1711 // The offset needs to fit in a W register.
1712 // TODO(all): Add this error code to objects.h.
1713 // __ Check(eq, kCurrentInputOffsetOutOfRange);
1714 __ Check(eq, kUnknown);
1698 } else { 1715 } else {
1699 __ Add(w10, current_input_offset(), cp_offset * char_size()); 1716 __ Add(w10, current_input_offset(), cp_offset * char_size());
1700 } 1717 }
1701 offset = w10; 1718 offset = w10;
1702 } 1719 }
1703 1720
1704 if (mode_ == ASCII) { 1721 if (mode_ == ASCII) {
1705 if (characters == 4) { 1722 if (characters == 4) {
1706 __ Ldr(current_character(), MemOperand(input_end(), offset, SXTW)); 1723 __ Ldr(current_character(), MemOperand(input_end(), offset, SXTW));
1707 } else if (characters == 2) { 1724 } else if (characters == 2) {
(...skipping 11 matching lines...) Expand all
1719 __ Ldrh(current_character(), MemOperand(input_end(), offset, SXTW)); 1736 __ Ldrh(current_character(), MemOperand(input_end(), offset, SXTW));
1720 } 1737 }
1721 } 1738 }
1722 } 1739 }
1723 1740
1724 #endif // V8_INTERPRETED_REGEXP 1741 #endif // V8_INTERPRETED_REGEXP
1725 1742
1726 }} // namespace v8::internal 1743 }} // namespace v8::internal
1727 1744
1728 #endif // V8_TARGET_ARCH_A64 1745 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « src/a64/macro-assembler-a64.cc ('k') | src/a64/stub-cache-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698