| Index: src/builtins/x64/builtins-x64.cc
|
| diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc
|
| index 35bef25b61a43e54174c287a4fdb21ed654988fa..51f734567bdb702bf4818cf3d68e2ed8b5594ca4 100644
|
| --- a/src/builtins/x64/builtins-x64.cc
|
| +++ b/src/builtins/x64/builtins-x64.cc
|
| @@ -226,11 +226,15 @@ void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function,
|
| }
|
|
|
| // ES6 9.2.2. Step 13+
|
| - // Check that the result is not a Smi, indicating that the constructor result
|
| - // from a derived class is neither undefined nor an Object.
|
| + // For derived class constructors, throw a TypeError here if the result
|
| + // is not a JSReceiver.
|
| if (check_derived_construct) {
|
| - Label dont_throw;
|
| - __ JumpIfNotSmi(rax, &dont_throw);
|
| + Label do_throw, dont_throw;
|
| + __ JumpIfSmi(rax, &do_throw, Label::kNear);
|
| + STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
|
| + __ CmpObjectType(rax, FIRST_JS_RECEIVER_TYPE, rcx);
|
| + __ j(above_equal, &dont_throw, Label::kNear);
|
| + __ bind(&do_throw);
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| __ CallRuntime(Runtime::kThrowDerivedConstructorReturnedNonObject);
|
|
|