| Index: src/ia32/macro-assembler-ia32.cc
|
| ===================================================================
|
| --- src/ia32/macro-assembler-ia32.cc (revision 5803)
|
| +++ src/ia32/macro-assembler-ia32.cc (working copy)
|
| @@ -1110,6 +1110,17 @@
|
| }
|
|
|
|
|
| +MaybeObject* MacroAssembler::TryTailCallExternalReference(
|
| + const ExternalReference& ext, int num_arguments, int result_size) {
|
| + // 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.
|
| + Set(eax, Immediate(num_arguments));
|
| + return TryJumpToExternalReference(ext);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid,
|
| int num_arguments,
|
| int result_size) {
|
| @@ -1117,6 +1128,14 @@
|
| }
|
|
|
|
|
| +MaybeObject* MacroAssembler::TryTailCallRuntime(Runtime::FunctionId fid,
|
| + int num_arguments,
|
| + int result_size) {
|
| + return TryTailCallExternalReference(
|
| + ExternalReference(fid), num_arguments, result_size);
|
| +}
|
| +
|
| +
|
| // If true, a Handle<T> passed by value is passed and returned by
|
| // using the location_ field directly. If false, it is passed and
|
| // returned as a pointer to a handle.
|
| @@ -1144,7 +1163,8 @@
|
| }
|
|
|
|
|
| -void MacroAssembler::CallApiFunctionAndReturn(ApiFunction* function, int argc) {
|
| +MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(ApiFunction* function,
|
| + int argc) {
|
| if (!kPassHandlesDirectly) {
|
| // The argument slots are filled as follows:
|
| //
|
| @@ -1213,7 +1233,11 @@
|
| LeaveExitFrame();
|
| ret(0);
|
| bind(&promote_scheduled_exception);
|
| - TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1);
|
| + MaybeObject* result =
|
| + TryTailCallRuntime(Runtime::kPromoteScheduledException, 0, 1);
|
| + if (result->IsFailure()) {
|
| + return result;
|
| + }
|
| bind(&empty_handle);
|
| // It was zero; the result is undefined.
|
| mov(eax, Factory::undefined_value());
|
| @@ -1227,6 +1251,8 @@
|
| call(Operand(eax));
|
| mov(eax, edi);
|
| jmp(&leave_exit_frame);
|
| +
|
| + return result;
|
| }
|
|
|
|
|
| @@ -1238,6 +1264,15 @@
|
| }
|
|
|
|
|
| +MaybeObject* MacroAssembler::TryJumpToExternalReference(
|
| + const ExternalReference& ext) {
|
| + // Set the entry point and jump to the C entry runtime stub.
|
| + mov(ebx, Immediate(ext));
|
| + CEntryStub ces(1);
|
| + return TryTailCallStub(&ces);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
| const ParameterCount& actual,
|
| Handle<Code> code_constant,
|
|
|