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