| Index: src/ia32/macro-assembler-ia32.cc
|
| ===================================================================
|
| --- src/ia32/macro-assembler-ia32.cc (revision 3500)
|
| +++ src/ia32/macro-assembler-ia32.cc (working copy)
|
| @@ -1072,6 +1072,12 @@
|
| }
|
|
|
|
|
| +Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id,
|
| + int num_arguments) {
|
| + return TryCallRuntime(Runtime::FunctionForId(id), num_arguments);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
|
| // If the expected number of arguments of the runtime function is
|
| // constant, we check that the actual number of arguments match the
|
| @@ -1088,6 +1094,22 @@
|
| }
|
|
|
|
|
| +Object* MacroAssembler::TryCallRuntime(Runtime::Function* f,
|
| + int num_arguments) {
|
| + if (f->nargs >= 0 && f->nargs != num_arguments) {
|
| + IllegalOperation(num_arguments);
|
| + // Since we did not call the stub, there was no allocation failure.
|
| + // Return some non-failure object.
|
| + return Heap::undefined_value();
|
| + }
|
| +
|
| + Runtime::FunctionId function_id =
|
| + static_cast<Runtime::FunctionId>(f->stub_id);
|
| + RuntimeStub stub(function_id, num_arguments);
|
| + return TryCallStub(&stub);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::TailCallRuntime(const ExternalReference& ext,
|
| int num_arguments,
|
| int result_size) {
|
| @@ -1120,7 +1142,10 @@
|
| }
|
|
|
|
|
| -void MacroAssembler::PopHandleScope(Register saved, Register scratch) {
|
| +Object* MacroAssembler::PopHandleScopeHelper(Register saved,
|
| + Register scratch,
|
| + bool gc_allowed) {
|
| + Object* result = NULL;
|
| ExternalReference extensions_address =
|
| ExternalReference::handle_scope_extensions_address();
|
| Label write_back;
|
| @@ -1130,7 +1155,12 @@
|
| // Calling a runtime function messes with registers so we save and
|
| // restore any one we're asked not to change
|
| if (saved.is_valid()) push(saved);
|
| - CallRuntime(Runtime::kDeleteHandleScopeExtensions, 0);
|
| + if (gc_allowed) {
|
| + CallRuntime(Runtime::kDeleteHandleScopeExtensions, 0);
|
| + } else {
|
| + result = TryCallRuntime(Runtime::kDeleteHandleScopeExtensions, 0);
|
| + if (result->IsFailure()) return result;
|
| + }
|
| if (saved.is_valid()) pop(saved);
|
|
|
| bind(&write_back);
|
| @@ -1143,9 +1173,21 @@
|
| pop(scratch);
|
| shr(scratch, kSmiTagSize);
|
| mov(Operand::StaticVariable(extensions_address), scratch);
|
| +
|
| + return result;
|
| }
|
|
|
|
|
| +void MacroAssembler::PopHandleScope(Register saved, Register scratch) {
|
| + PopHandleScopeHelper(saved, scratch, true);
|
| +}
|
| +
|
| +
|
| +Object* MacroAssembler::TryPopHandleScope(Register saved, Register scratch) {
|
| + return PopHandleScopeHelper(saved, scratch, false);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::JumpToRuntime(const ExternalReference& ext) {
|
| // Set the entry point and jump to the C entry runtime stub.
|
| mov(ebx, Immediate(ext));
|
|
|