Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 6550d6e016cb587cb9bc22a6ac3c61333ac1ad6b..9053a431cf9cfed99a79f4c18d835c0171acecb9 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -2670,40 +2670,8 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm, |
Immediate(isolate->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 = eax; |
- Register map = ecx; |
- |
- __ JumpIfSmi(return_value, &ok, Label::kNear); |
- __ mov(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); |
- |
- __ cmp(map, isolate->factory()->heap_number_map()); |
- __ j(equal, &ok, Label::kNear); |
- |
- __ cmp(return_value, isolate->factory()->undefined_value()); |
- __ j(equal, &ok, Label::kNear); |
- |
- __ cmp(return_value, isolate->factory()->true_value()); |
- __ j(equal, &ok, Label::kNear); |
- |
- __ cmp(return_value, isolate->factory()->false_value()); |
- __ j(equal, &ok, Label::kNear); |
- |
- __ cmp(return_value, isolate->factory()->null_value()); |
- __ j(equal, &ok, Label::kNear); |
- |
- __ Abort(kAPICallReturnedInvalidObject); |
- |
- __ bind(&ok); |
-#endif |
+ __ AssertApiCallResult(eax); |
if (stack_space_operand != nullptr) { |
DCHECK_EQ(0, stack_space); |
@@ -2800,6 +2768,12 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
__ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); |
} |
+ if (!this->is_store()) { |
+ __ mov(eax, Immediate(this->argc())); |
+ __ Jump(masm->isolate()->builtins()->CallFunctionCallback(), |
+ RelocInfo::CODE_TARGET); |
+ } |
+ |
// API function gets reference to the v8::Arguments. If CPU profiler |
// is enabled wrapper function will be called and we need to pass |
// address of the callback as additional parameter, always allocate |