Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index feb82684eaf52df66c83a4fcdadc39d188d49b0c..e3df6815b75c5d9683504f0d0eb0d25db4096193 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -1429,9 +1429,6 @@ void MacroAssembler::PrepareCallApiFunction(int argc, Register scratch) { |
// 1: arg1 |
// 0: pointer to the output cell |
// |
- // Note that this is one more "argument" than the function expects |
- // so the out cell will have to be popped explicitly after returning |
- // from the function. The out cell contains Handle. |
// pointer to out cell. |
lea(scratch, Operand(esp, (argc + 1) * kPointerSize)); |
@@ -1444,6 +1441,7 @@ void MacroAssembler::PrepareCallApiFunction(int argc, Register scratch) { |
MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(ApiFunction* function, |
+ int argc, |
int stack_space) { |
ExternalReference next_address = |
ExternalReference::handle_scope_next_address(); |
@@ -1452,6 +1450,11 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(ApiFunction* function, |
ExternalReference level_address = |
ExternalReference::handle_scope_level_address(); |
+ // Save out slot address in the callee-save register. |
Vitaly Repeshko
2011/07/04 22:41:36
Let's be consistent with "slot" vs. "cell" here in
Vyacheslav Egorov (Chromium)
2011/07/05 11:03:50
Done.
|
+ if (!kReturnHandlesDirectly) { |
+ lea(esi, Operand(esp, (argc + 1) * kPointerSize)); |
Vitaly Repeshko
2011/07/04 22:41:36
This is tightly coupled to PrepareCallApiFunction.
Vyacheslav Egorov (Chromium)
2011/07/05 11:03:50
I though about that but did not want to prolong es
|
+ } |
+ |
// Allocate HandleScope in callee-save registers. |
mov(ebx, Operand::StaticVariable(next_address)); |
mov(edi, Operand::StaticVariable(limit_address)); |
@@ -1461,9 +1464,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(ApiFunction* function, |
call(function->address(), RelocInfo::RUNTIME_ENTRY); |
if (!kReturnHandlesDirectly) { |
- // The returned value is a pointer to the handle holding the result. |
- // Dereference this to get to the location. |
- mov(eax, Operand(eax, 0)); |
+ mov(eax, Operand(esi, 0)); |
Vitaly Repeshko
2011/07/04 22:41:36
Some comment here would be helpful.
Vyacheslav Egorov (Chromium)
2011/07/05 11:03:50
Done.
|
} |
Label empty_handle; |