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

Side by Side Diff: src/mips/builtins-mips.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 | « src/ia32/code-stubs-ia32.cc ('k') | src/mips/code-stubs-mips.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_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
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 // TODO(bmeurer): Throw a TypeError if function's [[FunctionKind]] internal 1566 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1567 // slot is "classConstructor". 1567
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
1568 // Enter the context of the function; ToObject has to run in the function 1584 // Enter the context of the function; ToObject has to run in the function
1569 // context, and we also need to take the global proxy from the function 1585 // context, and we also need to take the global proxy from the function
1570 // context in case of conversion. 1586 // context in case of conversion.
1571 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) 1587 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList)
1572 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset == 1588 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset ==
1573 SharedFunctionInfo::kStrictModeByteOffset); 1589 SharedFunctionInfo::kStrictModeByteOffset);
1574 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 1590 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
1575 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1576 // We need to convert the receiver for non-native sloppy mode functions. 1591 // We need to convert the receiver for non-native sloppy mode functions.
1577 __ lbu(a3, FieldMemOperand(a2, SharedFunctionInfo::kNativeByteOffset)); 1592 __ lbu(a3, FieldMemOperand(a2, SharedFunctionInfo::kNativeByteOffset));
1578 __ And(at, a3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) | 1593 __ And(at, a3, Operand((1 << SharedFunctionInfo::kNativeBitWithinByte) |
1579 (1 << SharedFunctionInfo::kStrictModeBitWithinByte))); 1594 (1 << SharedFunctionInfo::kStrictModeBitWithinByte)));
1580 __ Branch(&done_convert, ne, at, Operand(zero_reg)); 1595 __ Branch(&done_convert, ne, at, Operand(zero_reg));
1581 { 1596 {
1582 __ sll(at, a0, kPointerSizeLog2); 1597 __ sll(at, a0, kPointerSizeLog2);
1583 __ addu(at, sp, at); 1598 __ addu(at, sp, at);
1584 __ lw(a3, MemOperand(at)); 1599 __ lw(a3, MemOperand(at));
1585 1600
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 } 1942 }
1928 } 1943 }
1929 1944
1930 1945
1931 #undef __ 1946 #undef __
1932 1947
1933 } // namespace internal 1948 } // namespace internal
1934 } // namespace v8 1949 } // namespace v8
1935 1950
1936 #endif // V8_TARGET_ARCH_MIPS 1951 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698