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

Unified Diff: src/x64/full-codegen-x64.cc

Issue 18014003: Add X32 port into V8 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 6 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
Index: src/x64/full-codegen-x64.cc
===================================================================
--- src/x64/full-codegen-x64.cc (revision 15486)
+++ src/x64/full-codegen-x64.cc (working copy)
@@ -43,6 +43,8 @@
namespace internal {
#define __ ACCESS_MASM(masm_)
+#define __k __
+#define __n __
class JumpPatchSite BASE_EMBEDDED {
@@ -140,8 +142,13 @@
Label ok;
__ testq(rcx, rcx);
__ j(zero, &ok, Label::kNear);
+#ifndef V8_TARGET_ARCH_X32
// +1 for return address.
int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize;
+#else
+ int receiver_offset = 1 * kHWRegSize +
+ info->scope()->num_parameters() * kPointerSize;
+#endif
__ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
__ movq(Operand(rsp, receiver_offset), kScratchRegister);
__ bind(&ok);
@@ -320,9 +327,15 @@
reset_value = Smi::kMaxValue;
}
__ movq(rbx, profiling_counter_, RelocInfo::EMBEDDED_OBJECT);
+#ifndef V8_TARGET_ARCH_X32
__ movq(kScratchRegister,
reinterpret_cast<uint64_t>(Smi::FromInt(reset_value)),
RelocInfo::NONE64);
+#else
+ __ movl(kScratchRegister,
+ reinterpret_cast<uint32_t>(Smi::FromInt(reset_value)),
+ RelocInfo::NONE32);
+#endif
__ movq(FieldOperand(rbx, Cell::kValueOffset), kScratchRegister);
}
@@ -415,7 +428,11 @@
// Add padding that will be overwritten by a debugger breakpoint. We
// have just generated at least 7 bytes: "movq rsp, rbp; pop rbp; ret k"
// (3 + 1 + 3).
+#ifndef V8_TARGET_ARCH_X32
const int kPadding = Assembler::kJSReturnSequenceLength - 7;
+#else
+ const int kPadding = Assembler::kJSReturnSequenceLength - 6;
+#endif
for (int i = 0; i < kPadding; ++i) {
masm_->int3();
}
@@ -680,7 +697,12 @@
int offset = -var->index() * kPointerSize;
// Adjust by a (parameter or local) base offset.
if (var->IsParameter()) {
+#ifndef V8_TARGET_ARCH_X32
offset += (info_->scope()->num_parameters() + 1) * kPointerSize;
+#else
+ offset += 2 * kHWRegSize +
+ (info_->scope()->num_parameters() - 1) * kPointerSize;
+#endif
} else {
offset += JavaScriptFrameConstants::kLocal0Offset;
}
@@ -2134,9 +2156,16 @@
// Push holes for arguments to generator function.
__ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
+#ifndef V8_TARGET_ARCH_X32
__ movsxlq(rdx,
FieldOperand(rdx,
SharedFunctionInfo::kFormalParameterCountOffset));
+#else
+ __ movl(rdx,
+ FieldOperand(rdx,
+ SharedFunctionInfo::kFormalParameterCountOffset));
+ __ SmiToInteger32(rdx, rdx);
+#endif
__ LoadRoot(rcx, Heap::kTheHoleValueRootIndex);
Label push_argument_holes, push_frame;
__ bind(&push_argument_holes);
@@ -2286,7 +2315,11 @@
__ SmiShiftArithmeticRight(rax, rdx, rcx);
break;
case Token::SHL:
+#ifndef V8_TARGET_ARCH_X32
__ SmiShiftLeft(rax, rdx, rcx);
+#else
+ __ SmiShiftLeft(rax, rdx, rcx, &stub_call);
+#endif
break;
case Token::SHR:
__ SmiShiftLogicalRight(rax, rdx, rcx, &stub_call);
@@ -2640,7 +2673,12 @@
}
// Push the receiver of the enclosing function and do runtime call.
+#ifndef V8_TARGET_ARCH_X32
__ push(Operand(rbp, (2 + info_->scope()->num_parameters()) * kPointerSize));
+#else
+ __ Push(Operand(rbp, 2 * kHWRegSize +
+ info_->scope()->num_parameters() * kPointerSize));
+#endif
// Push the language mode.
__ Push(Smi::FromInt(language_mode()));
@@ -3380,8 +3418,8 @@
}
__ bind(&runtime);
__ PrepareCallCFunction(2);
- __ movq(arg_reg_1, object);
- __ movq(arg_reg_2, index, RelocInfo::NONE64);
+ __ movq(arg_reg_1, object);
+ __n movq(arg_reg_2, index, RelocInfo::NONE64);
__ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
__ jmp(&done);
@@ -4136,7 +4174,7 @@
__ movl(index, array_length_operand);
__ lea(elements, FieldOperand(elements, index, times_pointer_size,
FixedArray::kHeaderSize));
- __ neg(index);
+ __k neg(index);
// Replace separator string with pointer to its first character, and
// make scratch be its length.
@@ -4172,7 +4210,7 @@
__ lea(string,
FieldOperand(string, SeqOneByteString::kHeaderSize));
__ CopyBytes(result_pos, string, string_length);
- __ incq(index);
+ __k incq(index);
__ j(not_equal, &loop_3); // Loop while (index < 0).
__ bind(&done);
@@ -4820,7 +4858,7 @@
ASSERT(!result_register().is(rdx));
ASSERT(!result_register().is(rcx));
// Cook return address on top of stack (smi encoded Code* delta)
- __ pop(rdx);
+ __k pop(rdx);
__ Move(rcx, masm_->CodeObject());
__ subq(rdx, rcx);
__ Integer32ToSmi(rdx, rdx);
@@ -4908,6 +4946,8 @@
}
+#undef __n
+#undef __k
#undef __
} } // namespace v8::internal

Powered by Google App Engine
This is Rietveld 408576698