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

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

Issue 3970005: Make Failure inherit from MaybeObject instead of Object. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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/ia32/macro-assembler-ia32.h ('k') | src/ia32/regexp-macro-assembler-ia32.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 bind(&done); 969 bind(&done);
970 } 970 }
971 971
972 972
973 void MacroAssembler::CallStub(CodeStub* stub) { 973 void MacroAssembler::CallStub(CodeStub* stub) {
974 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. 974 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
975 call(stub->GetCode(), RelocInfo::CODE_TARGET); 975 call(stub->GetCode(), RelocInfo::CODE_TARGET);
976 } 976 }
977 977
978 978
979 Object* MacroAssembler::TryCallStub(CodeStub* stub) { 979 MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub) {
980 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. 980 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
981 Object* result = stub->TryGetCode(); 981 Object* result;
982 if (!result->IsFailure()) { 982 { MaybeObject* maybe_result = stub->TryGetCode();
983 call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET); 983 if (!maybe_result->ToObject(&result)) return maybe_result;
984 } 984 }
985 call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET);
985 return result; 986 return result;
986 } 987 }
987 988
988 989
989 void MacroAssembler::TailCallStub(CodeStub* stub) { 990 void MacroAssembler::TailCallStub(CodeStub* stub) {
990 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. 991 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
991 jmp(stub->GetCode(), RelocInfo::CODE_TARGET); 992 jmp(stub->GetCode(), RelocInfo::CODE_TARGET);
992 } 993 }
993 994
994 995
995 Object* MacroAssembler::TryTailCallStub(CodeStub* stub) { 996 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub) {
996 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. 997 ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
997 Object* result = stub->TryGetCode(); 998 Object* result;
998 if (!result->IsFailure()) { 999 { MaybeObject* maybe_result = stub->TryGetCode();
999 jmp(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET); 1000 if (!maybe_result->ToObject(&result)) return maybe_result;
1000 } 1001 }
1002 jmp(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET);
1001 return result; 1003 return result;
1002 } 1004 }
1003 1005
1004 1006
1005 void MacroAssembler::StubReturn(int argc) { 1007 void MacroAssembler::StubReturn(int argc) {
1006 ASSERT(argc >= 1 && generating_stub()); 1008 ASSERT(argc >= 1 && generating_stub());
1007 ret((argc - 1) * kPointerSize); 1009 ret((argc - 1) * kPointerSize);
1008 } 1010 }
1009 1011
1010 1012
(...skipping 22 matching lines...) Expand all
1033 mov(index, hash); 1035 mov(index, hash);
1034 } 1036 }
1035 } 1037 }
1036 1038
1037 1039
1038 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { 1040 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) {
1039 CallRuntime(Runtime::FunctionForId(id), num_arguments); 1041 CallRuntime(Runtime::FunctionForId(id), num_arguments);
1040 } 1042 }
1041 1043
1042 1044
1043 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id, 1045 MaybeObject* MacroAssembler::TryCallRuntime(Runtime::FunctionId id,
1044 int num_arguments) { 1046 int num_arguments) {
1045 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments); 1047 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments);
1046 } 1048 }
1047 1049
1048 1050
1049 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { 1051 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
1050 // If the expected number of arguments of the runtime function is 1052 // If the expected number of arguments of the runtime function is
1051 // constant, we check that the actual number of arguments match the 1053 // constant, we check that the actual number of arguments match the
1052 // expectation. 1054 // expectation.
1053 if (f->nargs >= 0 && f->nargs != num_arguments) { 1055 if (f->nargs >= 0 && f->nargs != num_arguments) {
1054 IllegalOperation(num_arguments); 1056 IllegalOperation(num_arguments);
1055 return; 1057 return;
1056 } 1058 }
1057 1059
1058 // TODO(1236192): Most runtime routines don't need the number of 1060 // TODO(1236192): Most runtime routines don't need the number of
1059 // arguments passed in because it is constant. At some point we 1061 // arguments passed in because it is constant. At some point we
1060 // should remove this need and make the runtime routine entry code 1062 // should remove this need and make the runtime routine entry code
1061 // smarter. 1063 // smarter.
1062 Set(eax, Immediate(num_arguments)); 1064 Set(eax, Immediate(num_arguments));
1063 mov(ebx, Immediate(ExternalReference(f))); 1065 mov(ebx, Immediate(ExternalReference(f)));
1064 CEntryStub ces(1); 1066 CEntryStub ces(1);
1065 CallStub(&ces); 1067 CallStub(&ces);
1066 } 1068 }
1067 1069
1068 1070
1069 Object* MacroAssembler::TryCallRuntime(Runtime::Function* f, 1071 MaybeObject* MacroAssembler::TryCallRuntime(Runtime::Function* f,
1070 int num_arguments) { 1072 int num_arguments) {
1071 if (f->nargs >= 0 && f->nargs != num_arguments) { 1073 if (f->nargs >= 0 && f->nargs != num_arguments) {
1072 IllegalOperation(num_arguments); 1074 IllegalOperation(num_arguments);
1073 // Since we did not call the stub, there was no allocation failure. 1075 // Since we did not call the stub, there was no allocation failure.
1074 // Return some non-failure object. 1076 // Return some non-failure object.
1075 return Heap::undefined_value(); 1077 return Heap::undefined_value();
1076 } 1078 }
1077 1079
1078 // TODO(1236192): Most runtime routines don't need the number of 1080 // TODO(1236192): Most runtime routines don't need the number of
1079 // arguments passed in because it is constant. At some point we 1081 // arguments passed in because it is constant. At some point we
1080 // should remove this need and make the runtime routine entry code 1082 // should remove this need and make the runtime routine entry code
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 1764
1763 // Check that the code was patched as expected. 1765 // Check that the code was patched as expected.
1764 ASSERT(masm_.pc_ == address_ + size_); 1766 ASSERT(masm_.pc_ == address_ + size_);
1765 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1767 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1766 } 1768 }
1767 1769
1768 1770
1769 } } // namespace v8::internal 1771 } } // namespace v8::internal
1770 1772
1771 #endif // V8_TARGET_ARCH_IA32 1773 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698