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

Side by Side Diff: src/arm/builtins-arm.cc

Issue 1418623007: [runtime] Fix ES6 9.2.1 [[Call]] when encountering a classConstructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do not use kNear jump on x64 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 | « no previous file | src/arm/code-stubs-arm.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 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
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.
1558 __ ldrb(r3,
1559 FieldMemOperand(r2, SharedFunctionInfo::kFunctionKindByteOffset));
1560 __ tst(r3, Operand(SharedFunctionInfo::kClassConstructorBitsWithinByte));
1561 __ b(eq, &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
1555 // 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
1556 // 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
1557 // context in case of conversion. 1572 // context in case of conversion.
1558 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList)
1559 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset == 1573 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset ==
1560 SharedFunctionInfo::kStrictModeByteOffset); 1574 SharedFunctionInfo::kStrictModeByteOffset);
1561 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 1575 __ 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. 1576 // We need to convert the receiver for non-native sloppy mode functions.
1564 __ ldrb(r3, FieldMemOperand(r2, SharedFunctionInfo::kNativeByteOffset)); 1577 __ ldrb(r3, FieldMemOperand(r2, SharedFunctionInfo::kNativeByteOffset));
1565 __ tst(r3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) | 1578 __ tst(r3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) |
1566 (1 << SharedFunctionInfo::kStrictModeBitWithinByte))); 1579 (1 << SharedFunctionInfo::kStrictModeBitWithinByte)));
1567 __ b(ne, &done_convert); 1580 __ b(ne, &done_convert);
1568 { 1581 {
1569 __ ldr(r3, MemOperand(sp, r0, LSL, kPointerSizeLog2)); 1582 __ ldr(r3, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1570 1583
1571 // ----------- S t a t e ------------- 1584 // ----------- S t a t e -------------
1572 // -- r0 : the number of arguments (not including the receiver) 1585 // -- r0 : the number of arguments (not including the receiver)
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 } 1911 }
1899 } 1912 }
1900 1913
1901 1914
1902 #undef __ 1915 #undef __
1903 1916
1904 } // namespace internal 1917 } // namespace internal
1905 } // namespace v8 1918 } // namespace v8
1906 1919
1907 #endif // V8_TARGET_ARCH_ARM 1920 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698