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

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

Issue 543207: Removing redundant stub for runtime native calls. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/runtime.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-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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 1091
1092 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { 1092 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
1093 // If the expected number of arguments of the runtime function is 1093 // If the expected number of arguments of the runtime function is
1094 // constant, we check that the actual number of arguments match the 1094 // constant, we check that the actual number of arguments match the
1095 // expectation. 1095 // expectation.
1096 if (f->nargs >= 0 && f->nargs != num_arguments) { 1096 if (f->nargs >= 0 && f->nargs != num_arguments) {
1097 IllegalOperation(num_arguments); 1097 IllegalOperation(num_arguments);
1098 return; 1098 return;
1099 } 1099 }
1100 1100
1101 Runtime::FunctionId function_id = 1101 // TODO(1236192): Most runtime routines don't need the number of
1102 static_cast<Runtime::FunctionId>(f->stub_id); 1102 // arguments passed in because it is constant. At some point we
1103 RuntimeStub stub(function_id, num_arguments); 1103 // should remove this need and make the runtime routine entry code
1104 CallStub(&stub); 1104 // smarter.
1105 Set(eax, Immediate(num_arguments));
1106 mov(ebx, Immediate(ExternalReference(f)));
1107 CEntryStub ces(1);
1108 CallStub(&ces);
1105 } 1109 }
1106 1110
1107 1111
1108 Object* MacroAssembler::TryCallRuntime(Runtime::Function* f, 1112 Object* MacroAssembler::TryCallRuntime(Runtime::Function* f,
1109 int num_arguments) { 1113 int num_arguments) {
1110 if (f->nargs >= 0 && f->nargs != num_arguments) { 1114 if (f->nargs >= 0 && f->nargs != num_arguments) {
1111 IllegalOperation(num_arguments); 1115 IllegalOperation(num_arguments);
1112 // Since we did not call the stub, there was no allocation failure. 1116 // Since we did not call the stub, there was no allocation failure.
1113 // Return some non-failure object. 1117 // Return some non-failure object.
1114 return Heap::undefined_value(); 1118 return Heap::undefined_value();
1115 } 1119 }
1116 1120
1117 Runtime::FunctionId function_id = 1121 // TODO(1236192): Most runtime routines don't need the number of
1118 static_cast<Runtime::FunctionId>(f->stub_id); 1122 // arguments passed in because it is constant. At some point we
1119 RuntimeStub stub(function_id, num_arguments); 1123 // should remove this need and make the runtime routine entry code
1120 return TryCallStub(&stub); 1124 // smarter.
1125 Set(eax, Immediate(num_arguments));
1126 mov(ebx, Immediate(ExternalReference(f)));
1127 CEntryStub ces(1);
1128 return TryCallStub(&ces);
1121 } 1129 }
1122 1130
1123 1131
1124 void MacroAssembler::TailCallRuntime(const ExternalReference& ext, 1132 void MacroAssembler::TailCallRuntime(const ExternalReference& ext,
1125 int num_arguments, 1133 int num_arguments,
1126 int result_size) { 1134 int result_size) {
1127 // TODO(1236192): Most runtime routines don't need the number of 1135 // TODO(1236192): Most runtime routines don't need the number of
1128 // arguments passed in because it is constant. At some point we 1136 // arguments passed in because it is constant. At some point we
1129 // should remove this need and make the runtime routine entry code 1137 // should remove this need and make the runtime routine entry code
1130 // smarter. 1138 // smarter.
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 // Indicate that code has changed. 1578 // Indicate that code has changed.
1571 CPU::FlushICache(address_, size_); 1579 CPU::FlushICache(address_, size_);
1572 1580
1573 // Check that the code was patched as expected. 1581 // Check that the code was patched as expected.
1574 ASSERT(masm_.pc_ == address_ + size_); 1582 ASSERT(masm_.pc_ == address_ + size_);
1575 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1583 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1576 } 1584 }
1577 1585
1578 1586
1579 } } // namespace v8::internal 1587 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698