Commit 2364f20c authored by lrn@chromium.org's avatar lrn@chromium.org

X64 RegExp - fix RegExp on WIN64.

Use the correct ifdef to detect Win64 (_WIN64, not __MSVC__).

Review URL: http://codereview.chromium.org/195014


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2823 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 643d5cde
...@@ -4612,7 +4612,7 @@ static JSObject* ComputeReceiverForNonGlobal(JSObject* holder) { ...@@ -4612,7 +4612,7 @@ static JSObject* ComputeReceiverForNonGlobal(JSObject* holder) {
static ObjectPair LoadContextSlotHelper(Arguments args, bool throw_error) { static ObjectPair LoadContextSlotHelper(Arguments args, bool throw_error) {
HandleScope scope; HandleScope scope;
ASSERT(args.length() == 2); ASSERT_EQ(2, args.length());
if (!args[0]->IsContext() || !args[1]->IsString()) { if (!args[0]->IsContext() || !args[1]->IsString()) {
return MakePair(Top::ThrowIllegalOperation(), NULL); return MakePair(Top::ThrowIllegalOperation(), NULL);
......
...@@ -612,7 +612,7 @@ Handle<Object> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { ...@@ -612,7 +612,7 @@ Handle<Object> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
// MSVC passes arguments in rcx, rdx, r8, r9, with backing stack slots. // MSVC passes arguments in rcx, rdx, r8, r9, with backing stack slots.
// Store register parameters in pre-allocated stack slots, // Store register parameters in pre-allocated stack slots,
__ movq(Operand(rbp, kInputString), rcx); __ movq(Operand(rbp, kInputString), rcx);
__ movq(Operand(rbp, kStartIndex), rdx); __ movzxlq(Operand(rbp, kStartIndex), rdx); // Passed as int in eax.
__ movq(Operand(rbp, kInputStart), r8); __ movq(Operand(rbp, kInputStart), r8);
__ movq(Operand(rbp, kInputEnd), r9); __ movq(Operand(rbp, kInputEnd), r9);
// Callee-save on Win64. // Callee-save on Win64.
...@@ -711,7 +711,7 @@ Handle<Object> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { ...@@ -711,7 +711,7 @@ Handle<Object> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
__ Move(code_object_pointer(), masm_->CodeObject()); __ Move(code_object_pointer(), masm_->CodeObject());
// Load previous char as initial value of current-character. // Load previous char as initial value of current-character.
Label at_start; Label at_start;
__ cmpq(Operand(rbp, kAtStart), Immediate(0)); __ cmpb(Operand(rbp, kAtStart), Immediate(0));
__ j(not_equal, &at_start); __ j(not_equal, &at_start);
LoadCurrentCharacterUnchecked(-1, 1); // Load previous char. LoadCurrentCharacterUnchecked(-1, 1); // Load previous char.
__ jmp(&start_label_); __ jmp(&start_label_);
......
...@@ -129,16 +129,18 @@ class RegExpMacroAssemblerX64: public NativeRegExpMacroAssembler { ...@@ -129,16 +129,18 @@ class RegExpMacroAssemblerX64: public NativeRegExpMacroAssembler {
static const int kReturn_eip = kFramePointer + kPointerSize; static const int kReturn_eip = kFramePointer + kPointerSize;
static const int kFrameAlign = kReturn_eip + kPointerSize; static const int kFrameAlign = kReturn_eip + kPointerSize;
#ifdef __MSVC__ #ifdef _WIN64
// Parameters (first four passed as registers, but with room on stack). // Parameters (first four passed as registers, but with room on stack).
// In Microsoft 64-bit Calling Convention, there is room on the callers // In Microsoft 64-bit Calling Convention, there is room on the callers
// stack (before the return address) to spill parameter registers. We // stack (before the return address) to spill parameter registers. We
// use this space to store the register passed parameters. // use this space to store the register passed parameters.
static const int kInputString = kFrameAlign; static const int kInputString = kFrameAlign;
// StartIndex is passed as 32 bit int.
static const int kStartIndex = kInputString + kPointerSize; static const int kStartIndex = kInputString + kPointerSize;
static const int kInputStart = kStartIndex + kPointerSize; static const int kInputStart = kStartIndex + kPointerSize;
static const int kInputEnd = kInputStart + kPointerSize; static const int kInputEnd = kInputStart + kPointerSize;
static const int kRegisterOutput = kInputEnd + kPointerSize; static const int kRegisterOutput = kInputEnd + kPointerSize;
// AtStart is passed as 32 bit int (values 0 or 1).
static const int kAtStart = kRegisterOutput + kPointerSize; static const int kAtStart = kRegisterOutput + kPointerSize;
static const int kStackHighEnd = kAtStart + kPointerSize; static const int kStackHighEnd = kAtStart + kPointerSize;
#else #else
...@@ -154,7 +156,7 @@ class RegExpMacroAssemblerX64: public NativeRegExpMacroAssembler { ...@@ -154,7 +156,7 @@ class RegExpMacroAssemblerX64: public NativeRegExpMacroAssembler {
static const int kStackHighEnd = kFrameAlign; static const int kStackHighEnd = kFrameAlign;
#endif #endif
#ifdef __MSVC__ #ifdef _WIN64
// Microsoft calling convention has three callee-saved registers // Microsoft calling convention has three callee-saved registers
// (that we are using). We push these after the frame pointer. // (that we are using). We push these after the frame pointer.
static const int kBackup_rsi = kFramePointer - kPointerSize; static const int kBackup_rsi = kFramePointer - kPointerSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment