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

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

Issue 10693: Merged bleeding_edge -r 685:746 into regexp2000. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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/macro-assembler-arm.cc ('k') | src/mark-compact.h » ('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 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
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
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()));
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
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
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));
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 ParameterCount expected(0); 866 ParameterCount expected(0);
867 InvokeCode(Handle<Code>(code), expected, expected, 867 InvokeCode(Handle<Code>(code), expected, expected,
868 RelocInfo::CODE_TARGET, flag); 868 RelocInfo::CODE_TARGET, flag);
869 869
870 const char* name = Builtins::GetName(id); 870 const char* name = Builtins::GetName(id);
871 int argc = Builtins::GetArgumentsCount(id); 871 int argc = Builtins::GetArgumentsCount(id);
872 872
873 if (!resolved) { 873 if (!resolved) {
874 uint32_t flags = 874 uint32_t flags =
875 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | 875 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
876 Bootstrapper::FixupFlagsIsPCRelative::encode(true); 876 Bootstrapper::FixupFlagsIsPCRelative::encode(true) |
877 Bootstrapper::FixupFlagsUseCodeObject::encode(false);
877 Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name }; 878 Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name };
878 unresolved_.Add(entry); 879 unresolved_.Add(entry);
879 } 880 }
880 } 881 }
881 882
882 883
883 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { 884 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
884 bool resolved; 885 bool resolved;
885 Handle<Code> code = ResolveBuiltin(id, &resolved); 886 Handle<Code> code = ResolveBuiltin(id, &resolved);
886 887
887 const char* name = Builtins::GetName(id); 888 const char* name = Builtins::GetName(id);
888 int argc = Builtins::GetArgumentsCount(id); 889 int argc = Builtins::GetArgumentsCount(id);
889 890
890 mov(Operand(target), Immediate(code)); 891 mov(Operand(target), Immediate(code));
891 if (!resolved) { 892 if (!resolved) {
892 uint32_t flags = 893 uint32_t flags =
893 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | 894 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
894 Bootstrapper::FixupFlagsIsPCRelative::encode(false); 895 Bootstrapper::FixupFlagsIsPCRelative::encode(false) |
896 Bootstrapper::FixupFlagsUseCodeObject::encode(true);
895 Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name }; 897 Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name };
896 unresolved_.Add(entry); 898 unresolved_.Add(entry);
897 } 899 }
898 add(Operand(target), Immediate(Code::kHeaderSize - kHeapObjectTag)); 900 add(Operand(target), Immediate(Code::kHeaderSize - kHeapObjectTag));
899 } 901 }
900 902
901 903
902 Handle<Code> MacroAssembler::ResolveBuiltin(Builtins::JavaScript id, 904 Handle<Code> MacroAssembler::ResolveBuiltin(Builtins::JavaScript id,
903 bool* resolved) { 905 bool* resolved) {
904 // Move the builtin function into the temporary function slot by 906 // Move the builtin function into the temporary function slot by
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 // Indicate that code has changed. 1007 // Indicate that code has changed.
1006 CPU::FlushICache(address_, size_); 1008 CPU::FlushICache(address_, size_);
1007 1009
1008 // Check that the code was patched as expected. 1010 // Check that the code was patched as expected.
1009 ASSERT(masm_.pc_ == address_ + size_); 1011 ASSERT(masm_.pc_ == address_ + size_);
1010 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1012 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1011 } 1013 }
1012 1014
1013 1015
1014 } } // namespace v8::internal 1016 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/macro-assembler-arm.cc ('k') | src/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698