42 using v8::internal::Immediate;
44 using v8::internal::Label;
46 using v8::internal::Operand;
77 typedef int (*
F1)(int64_t x);
78 typedef int (*
F2)(int64_t x, int64_t y);
94 static void InitializeVM() {
101 TEST(AssemblerX64ReturnOperation) {
105 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
109 Assembler assm(Isolate::Current(), buffer, static_cast<int>(actual_size));
119 int result = FUNCTION_CAST<F2>(buffer)(3, 2);
123 TEST(AssemblerX64StackOperations) {
127 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
131 Assembler assm(Isolate::Current(), buffer, static_cast<int>(actual_size));
151 int result = FUNCTION_CAST<F2>(buffer)(3, 2);
155 TEST(AssemblerX64ArithmeticOperations) {
159 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
163 Assembler assm(Isolate::Current(), buffer, static_cast<int>(actual_size));
173 int result = FUNCTION_CAST<F2>(buffer)(3, 2);
177 TEST(AssemblerX64ImulOperation) {
181 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
185 Assembler assm(Isolate::Current(), buffer, static_cast<int>(actual_size));
197 int result = FUNCTION_CAST<F2>(buffer)(3, 2);
199 result = FUNCTION_CAST<F2>(buffer)(0x100000000l, 0x100000000l);
201 result = FUNCTION_CAST<F2>(buffer)(-0x100000000l, 0x100000000l);
205 TEST(AssemblerX64MemoryOperands) {
209 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
213 Assembler assm(Isolate::Current(), buffer, static_cast<int>(actual_size));
223 const int kStackElementSize = 8;
224 __ movq(
rax, Operand(
rbp, -3 * kStackElementSize));
235 int result = FUNCTION_CAST<F2>(buffer)(3, 2);
239 TEST(AssemblerX64ControlFlow) {
243 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
247 Assembler assm(Isolate::Current(), buffer, static_cast<int>(actual_size));
264 int result = FUNCTION_CAST<F2>(buffer)(3, 2);
268 TEST(AssemblerX64LoopImmediates) {
272 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
276 Assembler assm(Isolate::Current(), buffer, static_cast<int>(actual_size));
279 __ movq(
rax, Immediate(-3));
283 __ bind(&Loop1_body);
284 __ addq(
rax, Immediate(7));
285 __ bind(&Loop1_test);
286 __ cmpq(
rax, Immediate(20));
289 __ cmpq(
rax, Immediate(25));
294 __ movq(
rax, Immediate(0x11FEED00));
296 __ bind(&Loop2_body);
297 __ addq(
rax, Immediate(-0x1100));
298 __ bind(&Loop2_test);
299 __ cmpq(
rax, Immediate(0x11FE8000));
302 __ cmpq(
rax, Immediate(0x11FE7600));
305 __ movq(
rax, Immediate(1));
308 __ movq(
rax, Immediate(0));
314 int result = FUNCTION_CAST<F0>(buffer)();
319 TEST(OperandRegisterDependency) {
320 int offsets[4] = {0, 1, 0xfed, 0xbeefcad};
321 for (
int i = 0; i < 4; i++) {
322 int offset = offsets[i];
323 CHECK(Operand(
rax, offset).AddressUsesRegister(
rax));
324 CHECK(!Operand(
rax, offset).AddressUsesRegister(
r8));
325 CHECK(!Operand(
rax, offset).AddressUsesRegister(
rcx));
338 CHECK(Operand(
rsp, offset).AddressUsesRegister(
rsp));
339 CHECK(!Operand(
rsp, offset).AddressUsesRegister(
rax));
340 CHECK(!Operand(
rsp, offset).AddressUsesRegister(
r15));
342 CHECK(Operand(
rbp, offset).AddressUsesRegister(
rbp));
343 CHECK(!Operand(
rbp, offset).AddressUsesRegister(
rax));
344 CHECK(!Operand(
rbp, offset).AddressUsesRegister(
r13));
362 TEST(AssemblerX64LabelChaining) {
379 Assembler assm(Isolate::Current(), buffer,
sizeof(buffer));
385 __ movq(
rax, Immediate(1));
386 __ movq(
rbx, Immediate(2));
387 __ movq(
rcx, Immediate(3));
388 __ movq(
rdx, Immediate(4));
389 __ movq(
rdi, Immediate(5));
390 __ movq(
rsi, Immediate(6));
391 for (
int i = 0; i < 16; i++) {
398 __ cmpq(
rax, Immediate(1));
400 __ cmpq(
rbx, Immediate(2));
402 __ cmpq(
rcx, Immediate(3));
404 __ cmpq(
rdx, Immediate(4));
406 __ cmpq(
rdi, Immediate(5));
408 __ cmpq(
rsi, Immediate(6));
410 __ movq(
rax, Immediate(42));
418 __ movq(
rax, Immediate(13));
430 Code::ComputeFlags(Code::STUB),
432 HEAP->undefined_value()))->ToObjectChecked());
433 CHECK(code->IsCode());
435 F0 f = FUNCTION_CAST<F0>(code->
entry());
#define CHECK_EQ(expected, value)
v8::Handle< v8::Value > Fail(const v8::Arguments &args)
TEST(AssemblerX64ReturnOperation)
void GetCode(CodeDesc *desc)
int(* F2)(int64_t x, int64_t y)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
static Persistent< Context > New(ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
F FUNCTION_CAST(Address addr)