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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 64453002: Refactor loading a pointer into a register instruction for X64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased with bleeding_edge Created 7 years 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/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 // Size of movq(destination, src); 157 // Size of movq(destination, src);
158 return Assembler::kMoveAddressIntoScratchRegisterInstructionLength; 158 return Assembler::kMoveAddressIntoScratchRegisterInstructionLength;
159 } 159 }
160 160
161 161
162 void MacroAssembler::PushAddress(ExternalReference source) { 162 void MacroAssembler::PushAddress(ExternalReference source) {
163 int64_t address = reinterpret_cast<int64_t>(source.address()); 163 int64_t address = reinterpret_cast<int64_t>(source.address());
164 if (is_int32(address) && !Serializer::enabled()) { 164 if (is_int32(address) && !Serializer::enabled()) {
165 if (emit_debug_code()) { 165 if (emit_debug_code()) {
166 movq(kScratchRegister, kZapValue, RelocInfo::NONE64); 166 Move(kScratchRegister, kZapValue, RelocInfo::NONE64);
167 } 167 }
168 push(Immediate(static_cast<int32_t>(address))); 168 push(Immediate(static_cast<int32_t>(address)));
169 return; 169 return;
170 } 170 }
171 LoadAddress(kScratchRegister, source); 171 LoadAddress(kScratchRegister, source);
172 push(kScratchRegister); 172 push(kScratchRegister);
173 } 173 }
174 174
175 175
176 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { 176 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 Move(scratch, ExternalReference::new_space_mask(isolate())); 281 Move(scratch, ExternalReference::new_space_mask(isolate()));
282 and_(scratch, object); 282 and_(scratch, object);
283 } 283 }
284 Move(kScratchRegister, ExternalReference::new_space_start(isolate())); 284 Move(kScratchRegister, ExternalReference::new_space_start(isolate()));
285 cmpq(scratch, kScratchRegister); 285 cmpq(scratch, kScratchRegister);
286 j(cc, branch, distance); 286 j(cc, branch, distance);
287 } else { 287 } else {
288 ASSERT(is_int32(static_cast<int64_t>(isolate()->heap()->NewSpaceMask()))); 288 ASSERT(is_int32(static_cast<int64_t>(isolate()->heap()->NewSpaceMask())));
289 intptr_t new_space_start = 289 intptr_t new_space_start =
290 reinterpret_cast<intptr_t>(isolate()->heap()->NewSpaceStart()); 290 reinterpret_cast<intptr_t>(isolate()->heap()->NewSpaceStart());
291 movq(kScratchRegister, reinterpret_cast<Address>(-new_space_start), 291 Move(kScratchRegister, reinterpret_cast<Address>(-new_space_start),
292 RelocInfo::NONE64); 292 RelocInfo::NONE64);
293 if (scratch.is(object)) { 293 if (scratch.is(object)) {
294 addq(scratch, kScratchRegister); 294 addq(scratch, kScratchRegister);
295 } else { 295 } else {
296 lea(scratch, Operand(object, kScratchRegister, times_1, 0)); 296 lea(scratch, Operand(object, kScratchRegister, times_1, 0));
297 } 297 }
298 and_(scratch, 298 and_(scratch,
299 Immediate(static_cast<int32_t>(isolate()->heap()->NewSpaceMask()))); 299 Immediate(static_cast<int32_t>(isolate()->heap()->NewSpaceMask())));
300 j(cc, branch, distance); 300 j(cc, branch, distance);
301 } 301 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } 333 }
334 334
335 RecordWrite( 335 RecordWrite(
336 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); 336 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK);
337 337
338 bind(&done); 338 bind(&done);
339 339
340 // Clobber clobbered input registers when running with the debug-code flag 340 // Clobber clobbered input registers when running with the debug-code flag
341 // turned on to provoke errors. 341 // turned on to provoke errors.
342 if (emit_debug_code()) { 342 if (emit_debug_code()) {
343 movq(value, kZapValue, RelocInfo::NONE64); 343 Move(value, kZapValue, RelocInfo::NONE64);
344 movq(dst, kZapValue, RelocInfo::NONE64); 344 Move(dst, kZapValue, RelocInfo::NONE64);
345 } 345 }
346 } 346 }
347 347
348 348
349 void MacroAssembler::RecordWriteArray(Register object, 349 void MacroAssembler::RecordWriteArray(Register object,
350 Register value, 350 Register value,
351 Register index, 351 Register index,
352 SaveFPRegsMode save_fp, 352 SaveFPRegsMode save_fp,
353 RememberedSetAction remembered_set_action, 353 RememberedSetAction remembered_set_action,
354 SmiCheck smi_check) { 354 SmiCheck smi_check) {
(...skipping 12 matching lines...) Expand all
367 FixedArray::kHeaderSize - kHeapObjectTag)); 367 FixedArray::kHeaderSize - kHeapObjectTag));
368 368
369 RecordWrite( 369 RecordWrite(
370 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); 370 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK);
371 371
372 bind(&done); 372 bind(&done);
373 373
374 // Clobber clobbered input registers when running with the debug-code flag 374 // Clobber clobbered input registers when running with the debug-code flag
375 // turned on to provoke errors. 375 // turned on to provoke errors.
376 if (emit_debug_code()) { 376 if (emit_debug_code()) {
377 movq(value, kZapValue, RelocInfo::NONE64); 377 Move(value, kZapValue, RelocInfo::NONE64);
378 movq(index, kZapValue, RelocInfo::NONE64); 378 Move(index, kZapValue, RelocInfo::NONE64);
379 } 379 }
380 } 380 }
381 381
382 382
383 void MacroAssembler::RecordWrite(Register object, 383 void MacroAssembler::RecordWrite(Register object,
384 Register address, 384 Register address,
385 Register value, 385 Register value,
386 SaveFPRegsMode fp_mode, 386 SaveFPRegsMode fp_mode,
387 RememberedSetAction remembered_set_action, 387 RememberedSetAction remembered_set_action,
388 SmiCheck smi_check) { 388 SmiCheck smi_check) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 Label::kNear); 432 Label::kNear);
433 433
434 RecordWriteStub stub(object, value, address, remembered_set_action, fp_mode); 434 RecordWriteStub stub(object, value, address, remembered_set_action, fp_mode);
435 CallStub(&stub); 435 CallStub(&stub);
436 436
437 bind(&done); 437 bind(&done);
438 438
439 // Clobber clobbered registers when running with the debug-code flag 439 // Clobber clobbered registers when running with the debug-code flag
440 // turned on to provoke errors. 440 // turned on to provoke errors.
441 if (emit_debug_code()) { 441 if (emit_debug_code()) {
442 movq(address, kZapValue, RelocInfo::NONE64); 442 Move(address, kZapValue, RelocInfo::NONE64);
443 movq(value, kZapValue, RelocInfo::NONE64); 443 Move(value, kZapValue, RelocInfo::NONE64);
444 } 444 }
445 } 445 }
446 446
447 447
448 void MacroAssembler::Assert(Condition cc, BailoutReason reason) { 448 void MacroAssembler::Assert(Condition cc, BailoutReason reason) {
449 if (emit_debug_code()) Check(cc, reason); 449 if (emit_debug_code()) Check(cc, reason);
450 } 450 }
451 451
452 452
453 void MacroAssembler::AssertFastElements(Register elements) { 453 void MacroAssembler::AssertFastElements(Register elements) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 RecordComment(msg); 521 RecordComment(msg);
522 } 522 }
523 523
524 if (FLAG_trap_on_abort) { 524 if (FLAG_trap_on_abort) {
525 int3(); 525 int3();
526 return; 526 return;
527 } 527 }
528 #endif 528 #endif
529 529
530 push(rax); 530 push(rax);
531 movq(kScratchRegister, reinterpret_cast<Smi*>(p0), RelocInfo::NONE64); 531 Move(kScratchRegister, reinterpret_cast<Smi*>(p0), RelocInfo::NONE64);
532 push(kScratchRegister); 532 push(kScratchRegister);
533 movq(kScratchRegister, Smi::FromInt(static_cast<int>(p1 - p0)), 533 Move(kScratchRegister, Smi::FromInt(static_cast<int>(p1 - p0)),
534 RelocInfo::NONE64); 534 RelocInfo::NONE64);
535 push(kScratchRegister); 535 push(kScratchRegister);
536 536
537 if (!has_frame_) { 537 if (!has_frame_) {
538 // We don't actually want to generate a pile of code for this, so just 538 // We don't actually want to generate a pile of code for this, so just
539 // claim there is a stack frame, without generating one. 539 // claim there is a stack frame, without generating one.
540 FrameScope scope(this, StackFrame::NONE); 540 FrameScope scope(this, StackFrame::NONE);
541 CallRuntime(Runtime::kAbort, 2); 541 CallRuntime(Runtime::kAbort, 2);
542 } else { 542 } else {
543 CallRuntime(Runtime::kAbort, 2); 543 CallRuntime(Runtime::kAbort, 2);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); 713 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1);
714 PopSafepointRegisters(); 714 PopSafepointRegisters();
715 } 715 }
716 716
717 717
718 Label profiler_disabled; 718 Label profiler_disabled;
719 Label end_profiler_check; 719 Label end_profiler_check;
720 bool* is_profiling_flag = 720 bool* is_profiling_flag =
721 isolate()->cpu_profiler()->is_profiling_address(); 721 isolate()->cpu_profiler()->is_profiling_address();
722 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); 722 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1);
723 movq(rax, is_profiling_flag, RelocInfo::EXTERNAL_REFERENCE); 723 Move(rax, is_profiling_flag, RelocInfo::EXTERNAL_REFERENCE);
724 cmpb(Operand(rax, 0), Immediate(0)); 724 cmpb(Operand(rax, 0), Immediate(0));
725 j(zero, &profiler_disabled); 725 j(zero, &profiler_disabled);
726 726
727 // Third parameter is the address of the actual getter function. 727 // Third parameter is the address of the actual getter function.
728 movq(thunk_last_arg, function_address, RelocInfo::EXTERNAL_REFERENCE); 728 Move(thunk_last_arg, function_address, RelocInfo::EXTERNAL_REFERENCE);
729 movq(rax, thunk_address, RelocInfo::EXTERNAL_REFERENCE); 729 Move(rax, thunk_address, RelocInfo::EXTERNAL_REFERENCE);
730 jmp(&end_profiler_check); 730 jmp(&end_profiler_check);
731 731
732 bind(&profiler_disabled); 732 bind(&profiler_disabled);
733 // Call the api function! 733 // Call the api function!
734 movq(rax, reinterpret_cast<Address>(function_address), 734 Move(rax, reinterpret_cast<Address>(function_address),
735 RelocInfo::EXTERNAL_REFERENCE); 735 RelocInfo::EXTERNAL_REFERENCE);
736 736
737 bind(&end_profiler_check); 737 bind(&end_profiler_check);
738 738
739 // Call the api function! 739 // Call the api function!
740 call(rax); 740 call(rax);
741 741
742 if (FLAG_log_timer_events) { 742 if (FLAG_log_timer_events) {
743 FrameScope frame(this, StackFrame::MANUAL); 743 FrameScope frame(this, StackFrame::MANUAL);
744 PushSafepointRegisters(); 744 PushSafepointRegisters();
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 if (value == 1) { 1036 if (value == 1) {
1037 return kSmiConstantRegister; 1037 return kSmiConstantRegister;
1038 } 1038 }
1039 LoadSmiConstant(kScratchRegister, source); 1039 LoadSmiConstant(kScratchRegister, source);
1040 return kScratchRegister; 1040 return kScratchRegister;
1041 } 1041 }
1042 1042
1043 1043
1044 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { 1044 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) {
1045 if (emit_debug_code()) { 1045 if (emit_debug_code()) {
1046 movq(dst, Smi::FromInt(kSmiConstantRegisterValue), RelocInfo::NONE64); 1046 Move(dst, Smi::FromInt(kSmiConstantRegisterValue), RelocInfo::NONE64);
1047 cmpq(dst, kSmiConstantRegister); 1047 cmpq(dst, kSmiConstantRegister);
1048 Assert(equal, kUninitializedKSmiConstantRegister); 1048 Assert(equal, kUninitializedKSmiConstantRegister);
1049 } 1049 }
1050 int value = source->value(); 1050 int value = source->value();
1051 if (value == 0) { 1051 if (value == 0) {
1052 xorl(dst, dst); 1052 xorl(dst, dst);
1053 return; 1053 return;
1054 } 1054 }
1055 bool negative = value < 0; 1055 bool negative = value < 0;
1056 unsigned int uvalue = negative ? -value : value; 1056 unsigned int uvalue = negative ? -value : value;
(...skipping 19 matching lines...) Expand all
1076 case 2: 1076 case 2:
1077 lea(dst, Operand(kSmiConstantRegister, kSmiConstantRegister, times_1, 0)); 1077 lea(dst, Operand(kSmiConstantRegister, kSmiConstantRegister, times_1, 0));
1078 break; 1078 break;
1079 case 1: 1079 case 1:
1080 movq(dst, kSmiConstantRegister); 1080 movq(dst, kSmiConstantRegister);
1081 break; 1081 break;
1082 case 0: 1082 case 0:
1083 UNREACHABLE(); 1083 UNREACHABLE();
1084 return; 1084 return;
1085 default: 1085 default:
1086 movq(dst, source, RelocInfo::NONE64); 1086 Move(dst, source, RelocInfo::NONE64);
1087 return; 1087 return;
1088 } 1088 }
1089 if (negative) { 1089 if (negative) {
1090 neg(dst); 1090 neg(dst);
1091 } 1091 }
1092 } 1092 }
1093 1093
1094 1094
1095 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { 1095 void MacroAssembler::Integer32ToSmi(Register dst, Register src) {
1096 STATIC_ASSERT(kSmiTag == 0); 1096 STATIC_ASSERT(kSmiTag == 0);
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 } 2544 }
2545 } 2545 }
2546 2546
2547 2547
2548 void MacroAssembler::MoveHeapObject(Register result, 2548 void MacroAssembler::MoveHeapObject(Register result,
2549 Handle<Object> object) { 2549 Handle<Object> object) {
2550 AllowDeferredHandleDereference using_raw_address; 2550 AllowDeferredHandleDereference using_raw_address;
2551 ASSERT(object->IsHeapObject()); 2551 ASSERT(object->IsHeapObject());
2552 if (isolate()->heap()->InNewSpace(*object)) { 2552 if (isolate()->heap()->InNewSpace(*object)) {
2553 Handle<Cell> cell = isolate()->factory()->NewCell(object); 2553 Handle<Cell> cell = isolate()->factory()->NewCell(object);
2554 movq(result, cell, RelocInfo::CELL); 2554 Move(result, cell, RelocInfo::CELL);
2555 movq(result, Operand(result, 0)); 2555 movq(result, Operand(result, 0));
2556 } else { 2556 } else {
2557 movq(result, object, RelocInfo::EMBEDDED_OBJECT); 2557 Move(result, object, RelocInfo::EMBEDDED_OBJECT);
2558 } 2558 }
2559 } 2559 }
2560 2560
2561 2561
2562 void MacroAssembler::LoadGlobalCell(Register dst, Handle<Cell> cell) { 2562 void MacroAssembler::LoadGlobalCell(Register dst, Handle<Cell> cell) {
2563 if (dst.is(rax)) { 2563 if (dst.is(rax)) {
2564 AllowDeferredHandleDereference embedding_raw_address; 2564 AllowDeferredHandleDereference embedding_raw_address;
2565 load_rax(cell.location(), RelocInfo::CELL); 2565 load_rax(cell.location(), RelocInfo::CELL);
2566 } else { 2566 } else {
2567 movq(dst, cell, RelocInfo::CELL); 2567 Move(dst, cell, RelocInfo::CELL);
2568 movq(dst, Operand(dst, 0)); 2568 movq(dst, Operand(dst, 0));
2569 } 2569 }
2570 } 2570 }
2571 2571
2572 2572
2573 void MacroAssembler::Drop(int stack_elements) { 2573 void MacroAssembler::Drop(int stack_elements) {
2574 if (stack_elements > 0) { 2574 if (stack_elements > 0) {
2575 addq(rsp, Immediate(stack_elements * kPointerSize)); 2575 addq(rsp, Immediate(stack_elements * kPointerSize));
2576 } 2576 }
2577 } 2577 }
2578 2578
2579 2579
2580 void MacroAssembler::TestBit(const Operand& src, int bits) { 2580 void MacroAssembler::TestBit(const Operand& src, int bits) {
2581 int byte_offset = bits / kBitsPerByte; 2581 int byte_offset = bits / kBitsPerByte;
2582 int bit_in_byte = bits & (kBitsPerByte - 1); 2582 int bit_in_byte = bits & (kBitsPerByte - 1);
2583 testb(Operand(src, byte_offset), Immediate(1 << bit_in_byte)); 2583 testb(Operand(src, byte_offset), Immediate(1 << bit_in_byte));
2584 } 2584 }
2585 2585
2586 2586
2587 void MacroAssembler::Jump(ExternalReference ext) { 2587 void MacroAssembler::Jump(ExternalReference ext) {
2588 LoadAddress(kScratchRegister, ext); 2588 LoadAddress(kScratchRegister, ext);
2589 jmp(kScratchRegister); 2589 jmp(kScratchRegister);
2590 } 2590 }
2591 2591
2592 2592
2593 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) { 2593 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) {
2594 movq(kScratchRegister, destination, rmode); 2594 Move(kScratchRegister, destination, rmode);
2595 jmp(kScratchRegister); 2595 jmp(kScratchRegister);
2596 } 2596 }
2597 2597
2598 2598
2599 void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) { 2599 void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) {
2600 // TODO(X64): Inline this 2600 // TODO(X64): Inline this
2601 jmp(code_object, rmode); 2601 jmp(code_object, rmode);
2602 } 2602 }
2603 2603
2604 2604
(...skipping 13 matching lines...) Expand all
2618 #ifdef DEBUG 2618 #ifdef DEBUG
2619 CHECK_EQ(end_position, pc_offset()); 2619 CHECK_EQ(end_position, pc_offset());
2620 #endif 2620 #endif
2621 } 2621 }
2622 2622
2623 2623
2624 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { 2624 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) {
2625 #ifdef DEBUG 2625 #ifdef DEBUG
2626 int end_position = pc_offset() + CallSize(destination, rmode); 2626 int end_position = pc_offset() + CallSize(destination, rmode);
2627 #endif 2627 #endif
2628 movq(kScratchRegister, destination, rmode); 2628 Move(kScratchRegister, destination, rmode);
2629 call(kScratchRegister); 2629 call(kScratchRegister);
2630 #ifdef DEBUG 2630 #ifdef DEBUG
2631 CHECK_EQ(pc_offset(), end_position); 2631 CHECK_EQ(pc_offset(), end_position);
2632 #endif 2632 #endif
2633 } 2633 }
2634 2634
2635 2635
2636 void MacroAssembler::Call(Handle<Code> code_object, 2636 void MacroAssembler::Call(Handle<Code> code_object,
2637 RelocInfo::Mode rmode, 2637 RelocInfo::Mode rmode,
2638 TypeFeedbackId ast_id) { 2638 TypeFeedbackId ast_id) {
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
3660 cmpq(expected.reg(), actual.reg()); 3660 cmpq(expected.reg(), actual.reg());
3661 j(equal, &invoke, Label::kNear); 3661 j(equal, &invoke, Label::kNear);
3662 ASSERT(actual.reg().is(rax)); 3662 ASSERT(actual.reg().is(rax));
3663 ASSERT(expected.reg().is(rbx)); 3663 ASSERT(expected.reg().is(rbx));
3664 } 3664 }
3665 } 3665 }
3666 3666
3667 if (!definitely_matches) { 3667 if (!definitely_matches) {
3668 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline(); 3668 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline();
3669 if (!code_constant.is_null()) { 3669 if (!code_constant.is_null()) {
3670 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); 3670 Move(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT);
3671 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 3671 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag));
3672 } else if (!code_register.is(rdx)) { 3672 } else if (!code_register.is(rdx)) {
3673 movq(rdx, code_register); 3673 movq(rdx, code_register);
3674 } 3674 }
3675 3675
3676 if (flag == CALL_FUNCTION) { 3676 if (flag == CALL_FUNCTION) {
3677 call_wrapper.BeforeCall(CallSize(adaptor)); 3677 call_wrapper.BeforeCall(CallSize(adaptor));
3678 SetCallKind(rcx, call_kind); 3678 SetCallKind(rcx, call_kind);
3679 Call(adaptor, RelocInfo::CODE_TARGET); 3679 Call(adaptor, RelocInfo::CODE_TARGET);
3680 call_wrapper.AfterCall(); 3680 call_wrapper.AfterCall();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3712 } 3712 }
3713 } 3713 }
3714 } 3714 }
3715 3715
3716 3716
3717 void MacroAssembler::EnterFrame(StackFrame::Type type) { 3717 void MacroAssembler::EnterFrame(StackFrame::Type type) {
3718 push(rbp); 3718 push(rbp);
3719 movq(rbp, rsp); 3719 movq(rbp, rsp);
3720 push(rsi); // Context. 3720 push(rsi); // Context.
3721 Push(Smi::FromInt(type)); 3721 Push(Smi::FromInt(type));
3722 movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT); 3722 Move(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT);
3723 push(kScratchRegister); 3723 push(kScratchRegister);
3724 if (emit_debug_code()) { 3724 if (emit_debug_code()) {
3725 movq(kScratchRegister, 3725 Move(kScratchRegister,
3726 isolate()->factory()->undefined_value(), 3726 isolate()->factory()->undefined_value(),
3727 RelocInfo::EMBEDDED_OBJECT); 3727 RelocInfo::EMBEDDED_OBJECT);
3728 cmpq(Operand(rsp, 0), kScratchRegister); 3728 cmpq(Operand(rsp, 0), kScratchRegister);
3729 Check(not_equal, kCodeObjectNotProperlyPatched); 3729 Check(not_equal, kCodeObjectNotProperlyPatched);
3730 } 3730 }
3731 } 3731 }
3732 3732
3733 3733
3734 void MacroAssembler::LeaveFrame(StackFrame::Type type) { 3734 void MacroAssembler::LeaveFrame(StackFrame::Type type) {
3735 if (emit_debug_code()) { 3735 if (emit_debug_code()) {
(...skipping 12 matching lines...) Expand all
3748 ASSERT(ExitFrameConstants::kCallerSPDisplacement == 3748 ASSERT(ExitFrameConstants::kCallerSPDisplacement ==
3749 kFPOnStackSize + kPCOnStackSize); 3749 kFPOnStackSize + kPCOnStackSize);
3750 ASSERT(ExitFrameConstants::kCallerPCOffset == kFPOnStackSize); 3750 ASSERT(ExitFrameConstants::kCallerPCOffset == kFPOnStackSize);
3751 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); 3751 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize);
3752 push(rbp); 3752 push(rbp);
3753 movq(rbp, rsp); 3753 movq(rbp, rsp);
3754 3754
3755 // Reserve room for entry stack pointer and push the code object. 3755 // Reserve room for entry stack pointer and push the code object.
3756 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); 3756 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize);
3757 push(Immediate(0)); // Saved entry sp, patched before call. 3757 push(Immediate(0)); // Saved entry sp, patched before call.
3758 movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT); 3758 Move(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT);
3759 push(kScratchRegister); // Accessed from EditFrame::code_slot. 3759 push(kScratchRegister); // Accessed from EditFrame::code_slot.
3760 3760
3761 // Save the frame pointer and the context in top. 3761 // Save the frame pointer and the context in top.
3762 if (save_rax) { 3762 if (save_rax) {
3763 movq(r14, rax); // Backup rax in callee-save register. 3763 movq(r14, rax); // Backup rax in callee-save register.
3764 } 3764 }
3765 3765
3766 Store(ExternalReference(Isolate::kCEntryFPAddress, isolate()), rbp); 3766 Store(ExternalReference(Isolate::kCEntryFPAddress, isolate()), rbp);
3767 Store(ExternalReference(Isolate::kContextAddress, isolate()), rsi); 3767 Store(ExternalReference(Isolate::kContextAddress, isolate()), rsi);
3768 } 3768 }
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
5047 j(equal, found); 5047 j(equal, found);
5048 movq(current, FieldOperand(current, Map::kPrototypeOffset)); 5048 movq(current, FieldOperand(current, Map::kPrototypeOffset));
5049 CompareRoot(current, Heap::kNullValueRootIndex); 5049 CompareRoot(current, Heap::kNullValueRootIndex);
5050 j(not_equal, &loop_again); 5050 j(not_equal, &loop_again);
5051 } 5051 }
5052 5052
5053 5053
5054 } } // namespace v8::internal 5054 } } // namespace v8::internal
5055 5055
5056 #endif // V8_TARGET_ARCH_X64 5056 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698