| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 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 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 | 1553 |
| 1554 // static | 1554 // static |
| 1555 void Builtins::Generate_CallFunction(MacroAssembler* masm) { | 1555 void Builtins::Generate_CallFunction(MacroAssembler* masm) { |
| 1556 // ----------- S t a t e ------------- | 1556 // ----------- S t a t e ------------- |
| 1557 // -- a0 : the number of arguments (not including the receiver) | 1557 // -- a0 : the number of arguments (not including the receiver) |
| 1558 // -- a1 : the function to call (checked to be a JSFunction) | 1558 // -- a1 : the function to call (checked to be a JSFunction) |
| 1559 // ----------------------------------- | 1559 // ----------------------------------- |
| 1560 | 1560 |
| 1561 Label convert, convert_global_proxy, convert_to_object, done_convert; | 1561 Label convert, convert_global_proxy, convert_to_object, done_convert; |
| 1562 __ AssertFunction(a1); | 1562 __ AssertFunction(a1); |
| 1563 __ ld(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1563 // TODO(bmeurer): Throw a TypeError if function's [[FunctionKind]] internal |
| 1564 | 1564 // slot is "classConstructor". |
| 1565 { | |
| 1566 Label non_class_constructor; | |
| 1567 // Check whether the current function is a classConstructor | |
| 1568 __ lbu(a3, | |
| 1569 FieldMemOperand(a2, SharedFunctionInfo::kFunctionKindByteOffset)); | |
| 1570 __ And(at, a3, | |
| 1571 Operand(SharedFunctionInfo::kClassConstructorBitsWithinByte)); | |
| 1572 __ Branch(&non_class_constructor, eq, at, Operand(zero_reg)); | |
| 1573 // Step: 2, If we call a classConstructor Function throw a TypeError. | |
| 1574 { | |
| 1575 FrameScope frame(masm, StackFrame::INTERNAL); | |
| 1576 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); | |
| 1577 } | |
| 1578 __ bind(&non_class_constructor); | |
| 1579 } | |
| 1580 | |
| 1581 // Enter the context of the function; ToObject has to run in the function | 1565 // Enter the context of the function; ToObject has to run in the function |
| 1582 // context, and we also need to take the global proxy from the function | 1566 // context, and we also need to take the global proxy from the function |
| 1583 // context in case of conversion. | 1567 // context in case of conversion. |
| 1584 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) | 1568 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 1585 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset == | 1569 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset == |
| 1586 SharedFunctionInfo::kStrictModeByteOffset); | 1570 SharedFunctionInfo::kStrictModeByteOffset); |
| 1587 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 1571 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 1572 __ ld(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 1588 // We need to convert the receiver for non-native sloppy mode functions. | 1573 // We need to convert the receiver for non-native sloppy mode functions. |
| 1589 __ lbu(a3, FieldMemOperand(a2, SharedFunctionInfo::kNativeByteOffset)); | 1574 __ lbu(a3, FieldMemOperand(a2, SharedFunctionInfo::kNativeByteOffset)); |
| 1590 __ And(at, a3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) | | 1575 __ And(at, a3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) | |
| 1591 (1 << SharedFunctionInfo::kStrictModeBitWithinByte))); | 1576 (1 << SharedFunctionInfo::kStrictModeBitWithinByte))); |
| 1592 __ Branch(&done_convert, ne, at, Operand(zero_reg)); | 1577 __ Branch(&done_convert, ne, at, Operand(zero_reg)); |
| 1593 { | 1578 { |
| 1594 __ dsll(at, a0, kPointerSizeLog2); | 1579 __ dsll(at, a0, kPointerSizeLog2); |
| 1595 __ daddu(at, sp, at); | 1580 __ daddu(at, sp, at); |
| 1596 __ ld(a3, MemOperand(at)); | 1581 __ ld(a3, MemOperand(at)); |
| 1597 | 1582 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1937 } | 1922 } |
| 1938 } | 1923 } |
| 1939 | 1924 |
| 1940 | 1925 |
| 1941 #undef __ | 1926 #undef __ |
| 1942 | 1927 |
| 1943 } // namespace internal | 1928 } // namespace internal |
| 1944 } // namespace v8 | 1929 } // namespace v8 |
| 1945 | 1930 |
| 1946 #endif // V8_TARGET_ARCH_MIPS64 | 1931 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |