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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1540 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver | 1540 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver |
1541 } | 1541 } |
1542 | 1542 |
1543 | 1543 |
1544 // static | 1544 // static |
1545 void Builtins::Generate_CallFunction(MacroAssembler* masm) { | 1545 void Builtins::Generate_CallFunction(MacroAssembler* masm) { |
1546 // ----------- S t a t e ------------- | 1546 // ----------- S t a t e ------------- |
1547 // -- r0 : the number of arguments (not including the receiver) | 1547 // -- r0 : the number of arguments (not including the receiver) |
1548 // -- r1 : the function to call (checked to be a JSFunction) | 1548 // -- r1 : the function to call (checked to be a JSFunction) |
1549 // ----------------------------------- | 1549 // ----------------------------------- |
1550 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) | |
1550 | 1551 |
1551 Label convert, convert_global_proxy, convert_to_object, done_convert; | 1552 Label convert, convert_global_proxy, convert_to_object, done_convert; |
1552 __ AssertFunction(r1); | 1553 __ AssertFunction(r1); |
1553 // TODO(bmeurer): Throw a TypeError if function's [[FunctionKind]] internal | 1554 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
1554 // slot is "classConstructor". | 1555 { |
1556 Label non_class_constructor; | |
1557 // Check whether the current function is a classConstructor This only works | |
1558 // since kClassConstructor is more than 1 bit away from the byte boundary in | |
1559 // CompilerHints (note that compiler_hints is stored as smi on 32bit | |
1560 // architectures) | |
1561 STATIC_ASSERT((FunctionKind::kClassConstructor << kSmiTagSize) < | |
Benedikt Meurer
2015/11/04 02:56:43
Please use the kFooBitWithinByte trick that we use
Camillo Bruni
2015/11/04 10:47:32
done
| |
1562 (1 << kBitsPerByte)); | |
1563 __ ldrb(r3, | |
1564 FieldMemOperand(r2, SharedFunctionInfo::kFunctionKindByteOffset)); | |
1565 // Left-shift to account for smi storage in 32bits. | |
1566 __ tst(r3, Operand(FunctionKind::kClassConstructor << kSmiTagSize)); | |
1567 __ b(eq, &non_class_constructor); | |
1568 // Step: 2, If we call a classConstructor Function throw a TypeError. | |
1569 { | |
1570 FrameScope frame(masm, StackFrame::INTERNAL); | |
1571 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); | |
1572 } | |
1573 __ bind(&non_class_constructor); | |
1574 } | |
1575 | |
1555 // Enter the context of the function; ToObject has to run in the function | 1576 // Enter the context of the function; ToObject has to run in the function |
1556 // context, and we also need to take the global proxy from the function | 1577 // context, and we also need to take the global proxy from the function |
1557 // context in case of conversion. | 1578 // context in case of conversion. |
1558 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) | |
1559 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset == | 1579 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset == |
1560 SharedFunctionInfo::kStrictModeByteOffset); | 1580 SharedFunctionInfo::kStrictModeByteOffset); |
1561 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1581 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
1562 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | |
1563 // We need to convert the receiver for non-native sloppy mode functions. | 1582 // We need to convert the receiver for non-native sloppy mode functions. |
1564 __ ldrb(r3, FieldMemOperand(r2, SharedFunctionInfo::kNativeByteOffset)); | 1583 __ ldrb(r3, FieldMemOperand(r2, SharedFunctionInfo::kNativeByteOffset)); |
1565 __ tst(r3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) | | 1584 __ tst(r3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) | |
1566 (1 << SharedFunctionInfo::kStrictModeBitWithinByte))); | 1585 (1 << SharedFunctionInfo::kStrictModeBitWithinByte))); |
1567 __ b(ne, &done_convert); | 1586 __ b(ne, &done_convert); |
1568 { | 1587 { |
1569 __ ldr(r3, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1588 __ ldr(r3, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
1570 | 1589 |
1571 // ----------- S t a t e ------------- | 1590 // ----------- S t a t e ------------- |
1572 // -- r0 : the number of arguments (not including the receiver) | 1591 // -- r0 : the number of arguments (not including the receiver) |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1898 } | 1917 } |
1899 } | 1918 } |
1900 | 1919 |
1901 | 1920 |
1902 #undef __ | 1921 #undef __ |
1903 | 1922 |
1904 } // namespace internal | 1923 } // namespace internal |
1905 } // namespace v8 | 1924 } // namespace v8 |
1906 | 1925 |
1907 #endif // V8_TARGET_ARCH_ARM | 1926 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |