| Index: src/mips/builtins-mips.cc
|
| diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc
|
| index dfe501eb63edd430f85bc39b985ab9fefae8b9fe..7ec50ba363025210aa48e441e42d4f6803c0b0c2 100644
|
| --- a/src/mips/builtins-mips.cc
|
| +++ b/src/mips/builtins-mips.cc
|
| @@ -1563,8 +1563,29 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm) {
|
|
|
| Label convert, convert_global_proxy, convert_to_object, done_convert;
|
| __ AssertFunction(a1);
|
| - // TODO(bmeurer): Throw a TypeError if function's [[FunctionKind]] internal
|
| - // slot is "classConstructor".
|
| + __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
|
| +
|
| + {
|
| + Label non_class_constructor;
|
| + // Check whether the current function is a classConstructor This only works
|
| + // since kClassConstructor is more than 1 bit away from the byte boundary in
|
| + // CompilerHints (note that compiler_hints is stored as smi on 32bit
|
| + // architectures)
|
| + STATIC_ASSERT((FunctionKind::kClassConstructor << kSmiTagSize) <
|
| + (1 << kBitsPerByte));
|
| + __ lbu(a3,
|
| + FieldMemOperand(a2, SharedFunctionInfo::kFunctionKindByteOffset));
|
| + // Left-shift to account for smi storage in 32bits.
|
| + __ And(at, a3, Operand(FunctionKind::kClassConstructor << kSmiTagSize));
|
| + __ Branch(&non_class_constructor, eq, at, Operand(zero_reg));
|
| + // Step: 2, If we call a classConstructor Function throw a TypeError.
|
| + {
|
| + FrameScope frame(masm, StackFrame::INTERNAL);
|
| + __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0);
|
| + }
|
| + __ bind(&non_class_constructor);
|
| + }
|
| +
|
| // Enter the context of the function; ToObject has to run in the function
|
| // context, and we also need to take the global proxy from the function
|
| // context in case of conversion.
|
| @@ -1572,7 +1593,6 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm) {
|
| STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset ==
|
| SharedFunctionInfo::kStrictModeByteOffset);
|
| __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
|
| - __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
|
| // We need to convert the receiver for non-native sloppy mode functions.
|
| __ lbu(a3, FieldMemOperand(a2, SharedFunctionInfo::kNativeByteOffset));
|
| __ And(at, a3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) |
|
|
|