| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index 84630928d49ee3a256af73a9a2268d49e029d49c..ae15de94d299d644e8cfd6e7949569c7a8b15793 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -2636,40 +2636,8 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
|
| __ Cmp(Operand(rdi, 0), factory->the_hole_value());
|
| __ j(not_equal, &promote_scheduled_exception);
|
|
|
| -#if DEBUG
|
| // Check if the function returned a valid JavaScript value.
|
| - Label ok;
|
| - Register return_value = rax;
|
| - Register map = rcx;
|
| -
|
| - __ JumpIfSmi(return_value, &ok, Label::kNear);
|
| - __ movp(map, FieldOperand(return_value, HeapObject::kMapOffset));
|
| -
|
| - __ CmpInstanceType(map, LAST_NAME_TYPE);
|
| - __ j(below_equal, &ok, Label::kNear);
|
| -
|
| - __ CmpInstanceType(map, FIRST_JS_RECEIVER_TYPE);
|
| - __ j(above_equal, &ok, Label::kNear);
|
| -
|
| - __ CompareRoot(map, Heap::kHeapNumberMapRootIndex);
|
| - __ j(equal, &ok, Label::kNear);
|
| -
|
| - __ CompareRoot(return_value, Heap::kUndefinedValueRootIndex);
|
| - __ j(equal, &ok, Label::kNear);
|
| -
|
| - __ CompareRoot(return_value, Heap::kTrueValueRootIndex);
|
| - __ j(equal, &ok, Label::kNear);
|
| -
|
| - __ CompareRoot(return_value, Heap::kFalseValueRootIndex);
|
| - __ j(equal, &ok, Label::kNear);
|
| -
|
| - __ CompareRoot(return_value, Heap::kNullValueRootIndex);
|
| - __ j(equal, &ok, Label::kNear);
|
| -
|
| - __ Abort(kAPICallReturnedInvalidObject);
|
| -
|
| - __ bind(&ok);
|
| -#endif
|
| + __ AssertApiCallResult(rax);
|
|
|
| if (stack_space_operand != nullptr) {
|
| DCHECK_EQ(stack_space, 0);
|
| @@ -2764,6 +2732,12 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
| __ movp(context, FieldOperand(callee, JSFunction::kContextOffset));
|
| }
|
|
|
| + if (!this->is_store()) {
|
| + __ Set(rax, this->argc());
|
| + __ jmp(masm->isolate()->builtins()->CallFunctionCallback(),
|
| + RelocInfo::CODE_TARGET);
|
| + }
|
| +
|
| // Allocate the v8::Arguments structure in the arguments' space since
|
| // it's not controlled by GC.
|
| const int kApiStackSpace = 3;
|
|
|