Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: src/ppc/builtins-ppc.cc

Issue 1423713014: PPC: [runtime] Fix ES6 9.2.1 [[Call]] when encountering a classConstructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/builtins-ppc.cc
diff --git a/src/ppc/builtins-ppc.cc b/src/ppc/builtins-ppc.cc
index b9420c24057b6baf5624fd256cc7b5a1ae88dd6a..35873c3469df719e44e0b3c865f4840d58804724 100644
--- a/src/ppc/builtins-ppc.cc
+++ b/src/ppc/builtins-ppc.cc
@@ -1596,19 +1596,28 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm) {
Label convert, convert_global_proxy, convert_to_object, done_convert;
__ AssertFunction(r4);
- // TODO(bmeurer): Throw a TypeError if function's [[FunctionKind]] internal
- // slot is "classConstructor".
+ __ LoadP(r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
+ __ lwz(r6, FieldMemOperand(r5, SharedFunctionInfo::kCompilerHintsOffset));
+ {
+ Label non_class_constructor;
+ // Check whether the current function is a classConstructor.
+ __ TestBitMask(r6, SharedFunctionInfo::kClassConstructorBits, r0);
+ __ beq(&non_class_constructor, cr0);
+ // Step: 2, If we call a classConstructor Function throw a TypeError.
+ {
+ FrameAndConstantPoolScope 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.
- STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset ==
- SharedFunctionInfo::kStrictModeByteOffset);
__ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
- __ LoadP(r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
// We need to convert the receiver for non-native sloppy mode functions.
- __ lbz(r6, FieldMemOperand(r5, SharedFunctionInfo::kNativeByteOffset));
- __ andi(r0, r6, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) |
- (1 << SharedFunctionInfo::kStrictModeBitWithinByte)));
+ __ andi(r0, r6, Operand((1 << SharedFunctionInfo::kStrictModeBit) |
+ (1 << SharedFunctionInfo::kNativeBit)));
__ bne(&done_convert, cr0);
{
__ ShiftLeftImm(r6, r3, Operand(kPointerSizeLog2));
@@ -1866,13 +1875,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
Label no_strong_error;
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ lwz(r8, FieldMemOperand(r7, SharedFunctionInfo::kCompilerHintsOffset));
- __ TestBit(r8,
-#if V8_TARGET_ARCH_PPC64
- SharedFunctionInfo::kStrongModeFunction,
-#else
- SharedFunctionInfo::kStrongModeFunction + kSmiTagSize,
-#endif
- r0);
+ __ TestBit(r8, SharedFunctionInfo::kStrongModeBit, r0);
__ beq(&no_strong_error, cr0);
// What we really care about is the required number of arguments.
« no previous file with comments | « src/objects.h ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698