OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 __ Drop(1); | 1537 __ Drop(1); |
1538 } | 1538 } |
1539 | 1539 |
1540 | 1540 |
1541 // static | 1541 // static |
1542 void Builtins::Generate_CallFunction(MacroAssembler* masm) { | 1542 void Builtins::Generate_CallFunction(MacroAssembler* masm) { |
1543 // ----------- S t a t e ------------- | 1543 // ----------- S t a t e ------------- |
1544 // -- x0 : the number of arguments (not including the receiver) | 1544 // -- x0 : the number of arguments (not including the receiver) |
1545 // -- x1 : the function to call (checked to be a JSFunction) | 1545 // -- x1 : the function to call (checked to be a JSFunction) |
1546 // ----------------------------------- | 1546 // ----------------------------------- |
| 1547 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) |
1547 | 1548 |
1548 Label convert, convert_global_proxy, convert_to_object, done_convert; | 1549 Label convert, convert_global_proxy, convert_to_object, done_convert; |
1549 __ AssertFunction(x1); | 1550 __ AssertFunction(x1); |
1550 // TODO(bmeurer): Throw a TypeError if function's [[FunctionKind]] internal | 1551 |
1551 // slot is "classConstructor". | 1552 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
| 1553 { |
| 1554 Label non_class_constructor; |
| 1555 // Check whether the current function is a classConstructor |
| 1556 __ Ldr(w4, FieldMemOperand(x2, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1557 __ TestAndBranchIfAllClear( |
| 1558 w4, (1 << SharedFunctionInfo::kIsDefaultConstructor) | |
| 1559 (1 << SharedFunctionInfo::kIsSubclassConstructor) | |
| 1560 (1 << SharedFunctionInfo::kIsBaseConstructor), |
| 1561 &non_class_constructor); |
| 1562 // Step: 2, If we call a classConstructor Function throw a TypeError. |
| 1563 { |
| 1564 FrameScope frame(masm, StackFrame::INTERNAL); |
| 1565 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); |
| 1566 } |
| 1567 __ bind(&non_class_constructor); |
| 1568 } |
| 1569 |
1552 // Enter the context of the function; ToObject has to run in the function | 1570 // Enter the context of the function; ToObject has to run in the function |
1553 // context, and we also need to take the global proxy from the function | 1571 // context, and we also need to take the global proxy from the function |
1554 // context in case of conversion. | 1572 // context in case of conversion. |
1555 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) | |
1556 __ Ldr(cp, FieldMemOperand(x1, JSFunction::kContextOffset)); | 1573 __ Ldr(cp, FieldMemOperand(x1, JSFunction::kContextOffset)); |
1557 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | |
1558 // We need to convert the receiver for non-native sloppy mode functions. | 1574 // We need to convert the receiver for non-native sloppy mode functions. |
1559 __ Ldr(w3, FieldMemOperand(x2, SharedFunctionInfo::kCompilerHintsOffset)); | 1575 __ Ldr(w3, FieldMemOperand(x2, SharedFunctionInfo::kCompilerHintsOffset)); |
1560 __ TestAndBranchIfAnySet(w3, | 1576 __ TestAndBranchIfAnySet(w3, |
1561 (1 << SharedFunctionInfo::kNative) | | 1577 (1 << SharedFunctionInfo::kNative) | |
1562 (1 << SharedFunctionInfo::kStrictModeFunction), | 1578 (1 << SharedFunctionInfo::kStrictModeFunction), |
1563 &done_convert); | 1579 &done_convert); |
1564 { | 1580 { |
1565 __ Peek(x3, Operand(x0, LSL, kXRegSizeLog2)); | 1581 __ Peek(x3, Operand(x0, LSL, kXRegSizeLog2)); |
1566 | 1582 |
1567 // ----------- S t a t e ------------- | 1583 // ----------- S t a t e ------------- |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 } | 2003 } |
1988 } | 2004 } |
1989 | 2005 |
1990 | 2006 |
1991 #undef __ | 2007 #undef __ |
1992 | 2008 |
1993 } // namespace internal | 2009 } // namespace internal |
1994 } // namespace v8 | 2010 } // namespace v8 |
1995 | 2011 |
1996 #endif // V8_TARGET_ARCH_ARM | 2012 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |