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

Unified Diff: src/x64/regexp-macro-assembler-x64.cc

Issue 220453008: Introduce ReadPositionFromRegister in x64 Regexp Macro Assembler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/regexp-macro-assembler-x64.cc
diff --git a/src/x64/regexp-macro-assembler-x64.cc b/src/x64/regexp-macro-assembler-x64.cc
index d7b9c38f74ec28fb6780283742efeb5c472db91f..807e00b97c7f7a6110e11ce0e5cad067bd6e6871 100644
--- a/src/x64/regexp-macro-assembler-x64.cc
+++ b/src/x64/regexp-macro-assembler-x64.cc
@@ -241,8 +241,8 @@ void RegExpMacroAssemblerX64::CheckNotBackReferenceIgnoreCase(
int start_reg,
Label* on_no_match) {
Label fallthrough;
- __ movq(rdx, register_location(start_reg)); // Offset of start of capture
- __ movq(rbx, register_location(start_reg + 1)); // Offset of end of capture
+ ReadPositionFromRegister(rdx, start_reg); // Offset of start of capture
+ ReadPositionFromRegister(rbx, start_reg + 1); // Offset of end of capture
__ subp(rbx, rdx); // Length of capture.
// -----------------------
@@ -390,8 +390,8 @@ void RegExpMacroAssemblerX64::CheckNotBackReference(
Label fallthrough;
// Find length of back-referenced capture.
- __ movq(rdx, register_location(start_reg));
- __ movq(rax, register_location(start_reg + 1));
+ ReadPositionFromRegister(rdx, start_reg); // Offset of start of capture
+ ReadPositionFromRegister(rax, start_reg + 1); // Offset of end of capture
__ subp(rax, rdx); // Length to check.
// Fail on partial or illegal capture (start of capture after end of capture).
@@ -747,7 +747,7 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
// Load input position.
__ movp(rdi, Operand(rbp, kInputStart));
// Set up rdi to be negative offset from string end.
- __ subp(rdi, rsi);
+ __ subq(rdi, rsi);
// Set rax to address of char before start of the string
// (effectively string position -1).
__ movp(rbx, Operand(rbp, kStartIndex));
@@ -831,7 +831,7 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
__ addp(rcx, rdx);
}
for (int i = 0; i < num_saved_registers_; i++) {
- __ movq(rax, register_location(i));
+ __ movp(rax, register_location(i));
if (i == 0 && global_with_zero_length_check()) {
// Keep capture start in rdx for the zero-length check later.
__ movp(rdx, rax);
@@ -1084,13 +1084,31 @@ void RegExpMacroAssemblerX64::PushRegister(int register_index,
}
+STATIC_ASSERT(kPointerSize == kInt64Size || kPointerSize == kInt32Size);
+
+
void RegExpMacroAssemblerX64::ReadCurrentPositionFromRegister(int reg) {
- __ movq(rdi, register_location(reg));
+ if (kPointerSize == kInt64Size) {
+ __ movq(rdi, register_location(reg));
+ } else {
+ // Need sign extension for x32 as rdi might be used as an index register.
+ __ movsxlq(rdi, register_location(reg));
+ }
+}
+
+
+void RegExpMacroAssemblerX64::ReadPositionFromRegister(Register dst, int reg) {
+ if (kPointerSize == kInt64Size) {
+ __ movq(dst, register_location(reg));
+ } else {
+ // Need sign extension for x32 as dst might be used as an index register.
+ __ movsxlq(dst, register_location(reg));
+ }
}
void RegExpMacroAssemblerX64::ReadStackPointerFromRegister(int reg) {
- __ movq(backtrack_stackpointer(), register_location(reg));
+ __ movp(backtrack_stackpointer(), register_location(reg));
__ addp(backtrack_stackpointer(), Operand(rbp, kStackHighEnd));
}
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698