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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 // static 1589 // static
1590 void Builtins::Generate_CallFunction(MacroAssembler* masm) { 1590 void Builtins::Generate_CallFunction(MacroAssembler* masm) {
1591 // ----------- S t a t e ------------- 1591 // ----------- S t a t e -------------
1592 // -- r3 : the number of arguments (not including the receiver) 1592 // -- r3 : the number of arguments (not including the receiver)
1593 // -- r4 : the function to call (checked to be a JSFunction) 1593 // -- r4 : the function to call (checked to be a JSFunction)
1594 // ----------------------------------- 1594 // -----------------------------------
1595 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) 1595 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList)
1596 1596
1597 Label convert, convert_global_proxy, convert_to_object, done_convert; 1597 Label convert, convert_global_proxy, convert_to_object, done_convert;
1598 __ AssertFunction(r4); 1598 __ AssertFunction(r4);
1599 // TODO(bmeurer): Throw a TypeError if function's [[FunctionKind]] internal 1599 __ LoadP(r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1600 // slot is "classConstructor". 1600 __ lwz(r6, FieldMemOperand(r5, SharedFunctionInfo::kCompilerHintsOffset));
1601 {
1602 Label non_class_constructor;
1603 // Check whether the current function is a classConstructor.
1604 __ TestBitMask(r6, SharedFunctionInfo::kClassConstructorBits, r0);
1605 __ beq(&non_class_constructor, cr0);
1606 // Step: 2, If we call a classConstructor Function throw a TypeError.
1607 {
1608 FrameAndConstantPoolScope frame(masm, StackFrame::INTERNAL);
1609 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0);
1610 }
1611 __ bind(&non_class_constructor);
1612 }
1613
1601 // Enter the context of the function; ToObject has to run in the function 1614 // Enter the context of the function; ToObject has to run in the function
1602 // context, and we also need to take the global proxy from the function 1615 // context, and we also need to take the global proxy from the function
1603 // context in case of conversion. 1616 // context in case of conversion.
1604 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset ==
1605 SharedFunctionInfo::kStrictModeByteOffset);
1606 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); 1617 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
1607 __ LoadP(r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1608 // We need to convert the receiver for non-native sloppy mode functions. 1618 // We need to convert the receiver for non-native sloppy mode functions.
1609 __ lbz(r6, FieldMemOperand(r5, SharedFunctionInfo::kNativeByteOffset)); 1619 __ andi(r0, r6, Operand((1 << SharedFunctionInfo::kStrictModeBit) |
1610 __ andi(r0, r6, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) | 1620 (1 << SharedFunctionInfo::kNativeBit)));
1611 (1 << SharedFunctionInfo::kStrictModeBitWithinByte)));
1612 __ bne(&done_convert, cr0); 1621 __ bne(&done_convert, cr0);
1613 { 1622 {
1614 __ ShiftLeftImm(r6, r3, Operand(kPointerSizeLog2)); 1623 __ ShiftLeftImm(r6, r3, Operand(kPointerSizeLog2));
1615 __ LoadPX(r6, MemOperand(sp, r6)); 1624 __ LoadPX(r6, MemOperand(sp, r6));
1616 1625
1617 // ----------- S t a t e ------------- 1626 // ----------- S t a t e -------------
1618 // -- r3 : the number of arguments (not including the receiver) 1627 // -- r3 : the number of arguments (not including the receiver)
1619 // -- r4 : the function to call (checked to be a JSFunction) 1628 // -- r4 : the function to call (checked to be a JSFunction)
1620 // -- r5 : the shared function info. 1629 // -- r5 : the shared function info.
1621 // -- r6 : the receiver 1630 // -- r6 : the receiver
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 __ b(&invoke); 1868 __ b(&invoke);
1860 } 1869 }
1861 1870
1862 { // Too few parameters: Actual < expected 1871 { // Too few parameters: Actual < expected
1863 __ bind(&too_few); 1872 __ bind(&too_few);
1864 1873
1865 // If the function is strong we need to throw an error. 1874 // If the function is strong we need to throw an error.
1866 Label no_strong_error; 1875 Label no_strong_error;
1867 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); 1876 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1868 __ lwz(r8, FieldMemOperand(r7, SharedFunctionInfo::kCompilerHintsOffset)); 1877 __ lwz(r8, FieldMemOperand(r7, SharedFunctionInfo::kCompilerHintsOffset));
1869 __ TestBit(r8, 1878 __ TestBit(r8, SharedFunctionInfo::kStrongModeBit, r0);
1870 #if V8_TARGET_ARCH_PPC64
1871 SharedFunctionInfo::kStrongModeFunction,
1872 #else
1873 SharedFunctionInfo::kStrongModeFunction + kSmiTagSize,
1874 #endif
1875 r0);
1876 __ beq(&no_strong_error, cr0); 1879 __ beq(&no_strong_error, cr0);
1877 1880
1878 // What we really care about is the required number of arguments. 1881 // What we really care about is the required number of arguments.
1879 __ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kLengthOffset)); 1882 __ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kLengthOffset));
1880 #if V8_TARGET_ARCH_PPC64 1883 #if V8_TARGET_ARCH_PPC64
1881 // See commment near kLenghtOffset in src/objects.h 1884 // See commment near kLenghtOffset in src/objects.h
1882 __ srawi(r7, r7, kSmiTagSize); 1885 __ srawi(r7, r7, kSmiTagSize);
1883 #else 1886 #else
1884 __ SmiUntag(r7); 1887 __ SmiUntag(r7);
1885 #endif 1888 #endif
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 __ bkpt(0); 1967 __ bkpt(0);
1965 } 1968 }
1966 } 1969 }
1967 1970
1968 1971
1969 #undef __ 1972 #undef __
1970 } // namespace internal 1973 } // namespace internal
1971 } // namespace v8 1974 } // namespace v8
1972 1975
1973 #endif // V8_TARGET_ARCH_PPC 1976 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« 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