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

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

Issue 146022: X64: Addition binary operation. (Closed)
Patch Set: Addressed review comments (and updated from svn) Created 11 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 unified diff | Download patch
« 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 movq(kScratchRegister, reg_addr); 537 movq(kScratchRegister, reg_addr);
538 movq(Operand(kScratchRegister, 0), scratch); 538 movq(Operand(kScratchRegister, 0), scratch);
539 lea(base, Operand(base, kPointerSize)); 539 lea(base, Operand(base, kPointerSize));
540 } 540 }
541 } 541 }
542 } 542 }
543 543
544 #endif // ENABLE_DEBUGGER_SUPPORT 544 #endif // ENABLE_DEBUGGER_SUPPORT
545 545
546 546
547 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) {
548 bool resolved;
549 Handle<Code> code = ResolveBuiltin(id, &resolved);
550
551 // Calls are not allowed in some stubs.
552 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls());
553
554 // Rely on the assertion to check that the number of provided
555 // arguments match the expected number of arguments. Fake a
556 // parameter count to avoid emitting code to do the check.
557 ParameterCount expected(0);
558 InvokeCode(Handle<Code>(code), expected, expected,
559 RelocInfo::CODE_TARGET, flag);
560
561 const char* name = Builtins::GetName(id);
562 int argc = Builtins::GetArgumentsCount(id);
563 // The target address for the jump is stored as an immediate at offset
564 // kInvokeCodeAddressOffset.
565 if (!resolved) {
566 uint32_t flags =
567 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
568 Bootstrapper::FixupFlagsIsPCRelative::encode(true) |
569 Bootstrapper::FixupFlagsUseCodeObject::encode(false);
570 Unresolved entry = { pc_offset() - kInvokeCodeAddressOffset, flags, name };
571 unresolved_.Add(entry);
572 }
573 }
574
575
576
577
547 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 578 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
548 const ParameterCount& actual, 579 const ParameterCount& actual,
549 Handle<Code> code_constant, 580 Handle<Code> code_constant,
550 Register code_register, 581 Register code_register,
551 Label* done, 582 Label* done,
552 InvokeFlag flag) { 583 InvokeFlag flag) {
553 bool definitely_matches = false; 584 bool definitely_matches = false;
554 Label invoke; 585 Label invoke;
555 if (expected.is_immediate()) { 586 if (expected.is_immediate()) {
556 ASSERT(actual.is_immediate()); 587 ASSERT(actual.is_immediate());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 661
631 void MacroAssembler::InvokeCode(Handle<Code> code, 662 void MacroAssembler::InvokeCode(Handle<Code> code,
632 const ParameterCount& expected, 663 const ParameterCount& expected,
633 const ParameterCount& actual, 664 const ParameterCount& actual,
634 RelocInfo::Mode rmode, 665 RelocInfo::Mode rmode,
635 InvokeFlag flag) { 666 InvokeFlag flag) {
636 Label done; 667 Label done;
637 Register dummy = rax; 668 Register dummy = rax;
638 InvokePrologue(expected, actual, code, dummy, &done, flag); 669 InvokePrologue(expected, actual, code, dummy, &done, flag);
639 movq(kScratchRegister, code, rmode); 670 movq(kScratchRegister, code, rmode);
671 #ifdef DEBUG
672 // Address of the immediate code pointer.
673 int immediate_address = pc_offset() - kPointerSize;
674 #endif
675 // The kInvokeCodeAddressOffset computations assumes the REX.B prefix
676 // on the jmp and call opcodes.
677 ASSERT_EQ(1, kScratchRegister.high_bit());
640 if (flag == CALL_FUNCTION) { 678 if (flag == CALL_FUNCTION) {
641 call(kScratchRegister); 679 call(kScratchRegister);
642 } else { 680 } else {
643 ASSERT(flag == JUMP_FUNCTION); 681 ASSERT(flag == JUMP_FUNCTION);
644 jmp(kScratchRegister); 682 jmp(kScratchRegister);
645 } 683 }
684 ASSERT_EQ(kInvokeCodeAddressOffset, immediate_address - pc_offset());
646 bind(&done); 685 bind(&done);
647 } 686 }
648 687
649 688
650 void MacroAssembler::InvokeFunction(Register function, 689 void MacroAssembler::InvokeFunction(Register function,
651 const ParameterCount& actual, 690 const ParameterCount& actual,
652 InvokeFlag flag) { 691 InvokeFlag flag) {
653 ASSERT(function.is(rdi)); 692 ASSERT(function.is(rdi));
654 movq(rdx, FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); 693 movq(rdx, FieldOperand(function, JSFunction::kSharedFunctionInfoOffset));
655 movq(rsi, FieldOperand(function, JSFunction::kContextOffset)); 694 movq(rsi, FieldOperand(function, JSFunction::kContextOffset));
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 push(rcx); 827 push(rcx);
789 828
790 // Clear the top frame. 829 // Clear the top frame.
791 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); 830 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
792 movq(kScratchRegister, c_entry_fp_address); 831 movq(kScratchRegister, c_entry_fp_address);
793 movq(Operand(kScratchRegister, 0), Immediate(0)); 832 movq(Operand(kScratchRegister, 0), Immediate(0));
794 } 833 }
795 834
796 835
797 } } // namespace v8::internal 836 } } // namespace v8::internal
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