Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 lea(base, Operand(base, kPointerSize)); | 286 lea(base, Operand(base, kPointerSize)); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 | 290 |
| 291 | 291 |
| 292 void MacroAssembler::Set(Register dst, const Immediate& x) { | 292 void MacroAssembler::Set(Register dst, const Immediate& x) { |
| 293 if (x.is_zero()) { | 293 if (x.is_zero()) { |
| 294 xor_(dst, Operand(dst)); // shorter than mov | 294 xor_(dst, Operand(dst)); // shorter than mov |
| 295 } else { | 295 } else { |
| 296 mov(Operand(dst), x); | 296 mov(dst, x); |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 | 299 |
| 300 | 300 |
| 301 void MacroAssembler::Set(const Operand& dst, const Immediate& x) { | 301 void MacroAssembler::Set(const Operand& dst, const Immediate& x) { |
| 302 mov(dst, x); | 302 mov(dst, x); |
| 303 } | 303 } |
| 304 | 304 |
| 305 | 305 |
| 306 void MacroAssembler::FCmp() { | 306 void MacroAssembler::FCmp() { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 688 void MacroAssembler::StubReturn(int argc) { | 688 void MacroAssembler::StubReturn(int argc) { |
| 689 ASSERT(argc >= 1 && generating_stub()); | 689 ASSERT(argc >= 1 && generating_stub()); |
| 690 ret((argc - 1) * kPointerSize); | 690 ret((argc - 1) * kPointerSize); |
| 691 } | 691 } |
| 692 | 692 |
| 693 | 693 |
| 694 void MacroAssembler::IllegalOperation(int num_arguments) { | 694 void MacroAssembler::IllegalOperation(int num_arguments) { |
| 695 if (num_arguments > 0) { | 695 if (num_arguments > 0) { |
| 696 add(Operand(esp), Immediate(num_arguments * kPointerSize)); | 696 add(Operand(esp), Immediate(num_arguments * kPointerSize)); |
| 697 } | 697 } |
| 698 mov(Operand(eax), Immediate(Factory::undefined_value())); | 698 mov(eax, Immediate(Factory::undefined_value())); |
|
Kevin Millikin (Chromium)
2008/11/10 15:05:41
Just mov(eax, Factory::undefined_value())?
| |
| 699 } | 699 } |
| 700 | 700 |
| 701 | 701 |
| 702 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { | 702 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { |
| 703 CallRuntime(Runtime::FunctionForId(id), num_arguments); | 703 CallRuntime(Runtime::FunctionForId(id), num_arguments); |
| 704 } | 704 } |
| 705 | 705 |
| 706 | 706 |
| 707 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { | 707 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { |
| 708 // If the expected number of arguments of the runtime function is | 708 // If the expected number of arguments of the runtime function is |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 719 CallStub(&stub); | 719 CallStub(&stub); |
| 720 } | 720 } |
| 721 | 721 |
| 722 | 722 |
| 723 void MacroAssembler::TailCallRuntime(const ExternalReference& ext, | 723 void MacroAssembler::TailCallRuntime(const ExternalReference& ext, |
| 724 int num_arguments) { | 724 int num_arguments) { |
| 725 // TODO(1236192): Most runtime routines don't need the number of | 725 // TODO(1236192): Most runtime routines don't need the number of |
| 726 // arguments passed in because it is constant. At some point we | 726 // arguments passed in because it is constant. At some point we |
| 727 // should remove this need and make the runtime routine entry code | 727 // should remove this need and make the runtime routine entry code |
| 728 // smarter. | 728 // smarter. |
| 729 mov(Operand(eax), Immediate(num_arguments)); | 729 Set(eax, Immediate(num_arguments)); |
| 730 JumpToBuiltin(ext); | 730 JumpToBuiltin(ext); |
| 731 } | 731 } |
| 732 | 732 |
| 733 | 733 |
| 734 void MacroAssembler::JumpToBuiltin(const ExternalReference& ext) { | 734 void MacroAssembler::JumpToBuiltin(const ExternalReference& ext) { |
| 735 // Set the entry point and jump to the C entry runtime stub. | 735 // Set the entry point and jump to the C entry runtime stub. |
| 736 mov(Operand(ebx), Immediate(ext)); | 736 mov(ebx, Immediate(ext)); |
| 737 CEntryStub ces; | 737 CEntryStub ces; |
| 738 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); | 738 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); |
| 739 } | 739 } |
| 740 | 740 |
| 741 | 741 |
| 742 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 742 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
| 743 const ParameterCount& actual, | 743 const ParameterCount& actual, |
| 744 Handle<Code> code_constant, | 744 Handle<Code> code_constant, |
| 745 const Operand& code_operand, | 745 const Operand& code_operand, |
| 746 Label* done, | 746 Label* done, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 780 j(equal, &invoke); | 780 j(equal, &invoke); |
| 781 ASSERT(actual.reg().is(eax)); | 781 ASSERT(actual.reg().is(eax)); |
| 782 ASSERT(expected.reg().is(ebx)); | 782 ASSERT(expected.reg().is(ebx)); |
| 783 } | 783 } |
| 784 } | 784 } |
| 785 | 785 |
| 786 if (!definitely_matches) { | 786 if (!definitely_matches) { |
| 787 Handle<Code> adaptor = | 787 Handle<Code> adaptor = |
| 788 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); | 788 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); |
| 789 if (!code_constant.is_null()) { | 789 if (!code_constant.is_null()) { |
| 790 mov(Operand(edx), Immediate(code_constant)); | 790 mov(edx, Immediate(code_constant)); |
|
Kevin Millikin (Chromium)
2008/11/10 15:05:41
Ditto.
| |
| 791 add(Operand(edx), Immediate(Code::kHeaderSize - kHeapObjectTag)); | 791 add(Operand(edx), Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 792 } else if (!code_operand.is_reg(edx)) { | 792 } else if (!code_operand.is_reg(edx)) { |
| 793 mov(edx, code_operand); | 793 mov(edx, code_operand); |
| 794 } | 794 } |
| 795 | 795 |
| 796 if (flag == CALL_FUNCTION) { | 796 if (flag == CALL_FUNCTION) { |
| 797 call(adaptor, RelocInfo::CODE_TARGET); | 797 call(adaptor, RelocInfo::CODE_TARGET); |
| 798 jmp(done); | 798 jmp(done); |
| 799 } else { | 799 } else { |
| 800 jmp(adaptor, RelocInfo::CODE_TARGET); | 800 jmp(adaptor, RelocInfo::CODE_TARGET); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1005 // Indicate that code has changed. | 1005 // Indicate that code has changed. |
| 1006 CPU::FlushICache(address_, size_); | 1006 CPU::FlushICache(address_, size_); |
| 1007 | 1007 |
| 1008 // Check that the code was patched as expected. | 1008 // Check that the code was patched as expected. |
| 1009 ASSERT(masm_.pc_ == address_ + size_); | 1009 ASSERT(masm_.pc_ == address_ + size_); |
| 1010 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1010 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 | 1013 |
| 1014 } } // namespace v8::internal | 1014 } } // namespace v8::internal |
| OLD | NEW |