Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index 92d7fbc2c350b921e1cc18b6a73aa6eb197e93a8..19d750cf4e9f8cee95a3bca1d0b15451c38c9465 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -1900,20 +1900,27 @@ void MacroAssembler::CallExternalReference(ExternalReference ref, |
} |
-void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, |
- int num_arguments) { |
- // TODO(1236192): Most runtime routines don't need the number of |
- // arguments passed in because it is constant. At some point we |
- // should remove this need and make the runtime routine entry code |
- // smarter. |
- Move(eax, Immediate(num_arguments)); |
- JumpToExternalReference(ext); |
-} |
- |
- |
-void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid, |
- int num_arguments) { |
- TailCallExternalReference(ExternalReference(fid, isolate()), num_arguments); |
+void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
+ // ----------- S t a t e ------------- |
Igor Sheludko
2015/12/30 14:48:17
Probably we don't need this comment here as all th
|
+ // -- esp[0] : return address |
+ // -- esp[8] : argument num_arguments - 1 |
+ // ... |
+ // -- esp[8 * num_arguments] : argument 0 (receiver) |
+ // |
+ // For runtime functions with variable arguments: |
+ // -- eax : number of arguments |
+ // ----------------------------------- |
+ |
+ const Runtime::Function* function = Runtime::FunctionForId(fid); |
+ DCHECK_EQ(1, function->result_size); |
+ if (function->nargs >= 0) { |
+ // TODO(1236192): Most runtime routines don't need the number of |
+ // arguments passed in because it is constant. At some point we |
+ // should remove this need and make the runtime routine entry code |
+ // smarter. |
+ mov(eax, Immediate(function->nargs)); |
+ } |
+ JumpToExternalReference(ExternalReference(fid, isolate())); |
} |