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

Side by Side Diff: src/ia32/builtins-ia32.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/globals.h ('k') | src/ia32/code-stubs-ia32.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_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.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 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 __ push(ecx); 1499 __ push(ecx);
1500 } 1500 }
1501 1501
1502 1502
1503 // static 1503 // static
1504 void Builtins::Generate_CallFunction(MacroAssembler* masm) { 1504 void Builtins::Generate_CallFunction(MacroAssembler* masm) {
1505 // ----------- S t a t e ------------- 1505 // ----------- S t a t e -------------
1506 // -- eax : the number of arguments (not including the receiver) 1506 // -- eax : the number of arguments (not including the receiver)
1507 // -- edi : the function to call (checked to be a JSFunction) 1507 // -- edi : the function to call (checked to be a JSFunction)
1508 // ----------------------------------- 1508 // -----------------------------------
1509 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList)
1509 1510
1510 Label convert, convert_global_proxy, convert_to_object, done_convert; 1511 Label convert, convert_global_proxy, convert_to_object, done_convert;
1511 __ AssertFunction(edi); 1512 __ AssertFunction(edi);
1512 // TODO(bmeurer): Throw a TypeError if function's [[FunctionKind]] internal 1513 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
1513 // slot is "classConstructor". 1514
1515 {
1516 Label non_class_constructor;
1517 // Check whether the current function is a classConstructor.
1518 __ test_b(FieldOperand(edx, SharedFunctionInfo::kFunctionKindByteOffset),
1519 SharedFunctionInfo::kClassConstructorBitsWithinByte);
1520 __ j(zero, &non_class_constructor, Label::kNear);
1521 // Step: 2, If we call a classConstructor Function throw a TypeError.
1522 {
1523 FrameScope frame(masm, StackFrame::INTERNAL);
1524 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0);
1525 }
1526 __ bind(&non_class_constructor);
1527 }
1528
1514 // Enter the context of the function; ToObject has to run in the function 1529 // Enter the context of the function; ToObject has to run in the function
1515 // context, and we also need to take the global proxy from the function 1530 // context, and we also need to take the global proxy from the function
1516 // context in case of conversion. 1531 // context in case of conversion.
1517 // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList)
1518 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset == 1532 STATIC_ASSERT(SharedFunctionInfo::kNativeByteOffset ==
1519 SharedFunctionInfo::kStrictModeByteOffset); 1533 SharedFunctionInfo::kStrictModeByteOffset);
1520 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 1534 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
1521 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
1522 // We need to convert the receiver for non-native sloppy mode functions. 1535 // We need to convert the receiver for non-native sloppy mode functions.
1523 __ test_b(FieldOperand(edx, SharedFunctionInfo::kNativeByteOffset), 1536 __ test_b(FieldOperand(edx, SharedFunctionInfo::kNativeByteOffset),
1524 (1 << SharedFunctionInfo::kNativeBitWithinByte) | 1537 (1 << SharedFunctionInfo::kNativeBitWithinByte) |
1525 (1 << SharedFunctionInfo::kStrictModeBitWithinByte)); 1538 (1 << SharedFunctionInfo::kStrictModeBitWithinByte));
1526 __ j(not_zero, &done_convert); 1539 __ j(not_zero, &done_convert);
1527 { 1540 {
1528 __ mov(ecx, Operand(esp, eax, times_pointer_size, kPointerSize)); 1541 __ mov(ecx, Operand(esp, eax, times_pointer_size, kPointerSize));
1529 1542
1530 // ----------- S t a t e ------------- 1543 // ----------- S t a t e -------------
1531 // -- eax : the number of arguments (not including the receiver) 1544 // -- eax : the number of arguments (not including the receiver)
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 1911
1899 __ bind(&ok); 1912 __ bind(&ok);
1900 __ ret(0); 1913 __ ret(0);
1901 } 1914 }
1902 1915
1903 #undef __ 1916 #undef __
1904 } // namespace internal 1917 } // namespace internal
1905 } // namespace v8 1918 } // namespace v8
1906 1919
1907 #endif // V8_TARGET_ARCH_IA32 1920 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698