Index: src/ppc/code-stubs-ppc.cc |
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc |
index 624f702ce5c946bd96148c8a24489265c297a467..f4a4fa5184ba664f174f0568fec575ae488483bc 100644 |
--- a/src/ppc/code-stubs-ppc.cc |
+++ b/src/ppc/code-stubs-ppc.cc |
@@ -1430,13 +1430,7 @@ void InstanceOfStub::Generate(MacroAssembler* masm) { |
FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
__ lwz(scratch, FieldMemOperand(shared_info, |
SharedFunctionInfo::kCompilerHintsOffset)); |
- __ TestBit(scratch, |
-#if V8_TARGET_ARCH_PPC64 |
- SharedFunctionInfo::kBoundFunction, |
-#else |
- SharedFunctionInfo::kBoundFunction + kSmiTagSize, |
-#endif |
- r0); |
+ __ TestBit(scratch, SharedFunctionInfo::kBoundBit, r0); |
__ bne(&slow_case, cr0); |
// Get the "prototype" (or initial map) of the {function}. |
@@ -2536,26 +2530,14 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { |
static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
+ // ----------- S t a t e ------------- |
+ // -- r4 : the function to call |
+ // -- r6 : the function's shared function info |
+ // ----------------------------------- |
// Do not transform the receiver for strict mode functions and natives. |
- __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
__ lwz(r7, FieldMemOperand(r6, SharedFunctionInfo::kCompilerHintsOffset)); |
- __ TestBit(r7, |
-#if V8_TARGET_ARCH_PPC64 |
- SharedFunctionInfo::kStrictModeFunction, |
-#else |
- SharedFunctionInfo::kStrictModeFunction + kSmiTagSize, |
-#endif |
- r0); |
- __ bne(cont, cr0); |
- |
- // Do not transform the receiver for native. |
- __ TestBit(r7, |
-#if V8_TARGET_ARCH_PPC64 |
- SharedFunctionInfo::kNative, |
-#else |
- SharedFunctionInfo::kNative + kSmiTagSize, |
-#endif |
- r0); |
+ __ andi(r0, r7, Operand((1 << SharedFunctionInfo::kStrictModeBit) | |
+ (1 << SharedFunctionInfo::kNativeBit))); |
__ bne(cont, cr0); |
} |
@@ -2581,6 +2563,24 @@ static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { |
} |
+static void EmitClassConstructorCallCheck(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- r4 : the function to call |
+ // -- r6 : the function's shared function info |
+ // ----------------------------------- |
+ // ClassConstructor Check: ES6 section 9.2.1 [[Call]] |
+ Label non_class_constructor; |
+ // Check whether the current function is a classConstructor. |
+ __ lwz(r7, FieldMemOperand(r6, SharedFunctionInfo::kCompilerHintsOffset)); |
+ __ TestBitMask(r7, SharedFunctionInfo::kClassConstructorBits, r0); |
+ __ beq(&non_class_constructor, cr0); |
+ // If we call a classConstructor Function throw a TypeError |
+ // indirectly via the CallFunction builtin. |
+ __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); |
+ __ bind(&non_class_constructor); |
+} |
+ |
+ |
static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, |
bool needs_checks, bool call_as_method) { |
// r4 : the function to call |
@@ -2596,6 +2596,9 @@ static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, |
__ bne(&slow); |
} |
+ __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
+ EmitClassConstructorCallCheck(masm); |
+ |
// Fast-case: Invoke the function now. |
// r4: pushed function |
ParameterCount actual(argc); |
@@ -2769,6 +2772,10 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ StoreP(r6, FieldMemOperand(r9, count_offset), r0); |
__ bind(&have_js_function); |
+ |
+ __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
+ EmitClassConstructorCallCheck(masm); |
+ |
if (CallAsMethod()) { |
EmitContinueIfStrictOrNative(masm, &cont); |
// Compute the receiver in sloppy mode. |