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

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

Issue 1467473002: Install ConstructNonConstructable as construct stub for non-constructables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years 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/runtime/runtime-object.cc ('k') | test/cctest/test-api.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_X64 5 #if V8_TARGET_ARCH_X64
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { 385 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
386 Generate_JSConstructStubHelper(masm, true, true); 386 Generate_JSConstructStubHelper(masm, true, true);
387 } 387 }
388 388
389 389
390 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { 390 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) {
391 Generate_JSConstructStubHelper(masm, false, false); 391 Generate_JSConstructStubHelper(masm, false, false);
392 } 392 }
393 393
394 394
395 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) {
396 FrameScope scope(masm, StackFrame::INTERNAL);
397 __ Push(rdi);
398 __ CallRuntime(Runtime::kThrowConstructedNonConstructable, 1);
399 }
400
401
395 enum IsTagged { kRaxIsSmiTagged, kRaxIsUntaggedInt }; 402 enum IsTagged { kRaxIsSmiTagged, kRaxIsUntaggedInt };
396 403
397 404
398 // Clobbers rcx, r11, kScratchRegister; preserves all other registers. 405 // Clobbers rcx, r11, kScratchRegister; preserves all other registers.
399 static void Generate_CheckStackOverflow(MacroAssembler* masm, 406 static void Generate_CheckStackOverflow(MacroAssembler* masm,
400 IsTagged rax_is_tagged) { 407 IsTagged rax_is_tagged) {
401 // rax : the number of items to be pushed to the stack 408 // rax : the number of items to be pushed to the stack
402 // 409 //
403 // Check the stack for overflow. We are not trying to catch 410 // Check the stack for overflow. We are not trying to catch
404 // interruptions (e.g. debug break and preemption) here, so the "real stack 411 // interruptions (e.g. debug break and preemption) here, so the "real stack
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 rbx, rdx, SharedFunctionInfo::kFormalParameterCountOffset); 1726 rbx, rdx, SharedFunctionInfo::kFormalParameterCountOffset);
1720 __ movp(r8, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); 1727 __ movp(r8, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
1721 ParameterCount actual(rax); 1728 ParameterCount actual(rax);
1722 ParameterCount expected(rbx); 1729 ParameterCount expected(rbx);
1723 __ InvokeCode(r8, no_reg, expected, actual, JUMP_FUNCTION, NullCallWrapper()); 1730 __ InvokeCode(r8, no_reg, expected, actual, JUMP_FUNCTION, NullCallWrapper());
1724 1731
1725 // The function is a "classConstructor", need to raise an exception. 1732 // The function is a "classConstructor", need to raise an exception.
1726 __ bind(&class_constructor); 1733 __ bind(&class_constructor);
1727 { 1734 {
1728 FrameScope frame(masm, StackFrame::INTERNAL); 1735 FrameScope frame(masm, StackFrame::INTERNAL);
1729 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); 1736 __ Push(rdi);
1737 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 1);
1730 } 1738 }
1731 } 1739 }
1732 1740
1733 1741
1734 // static 1742 // static
1735 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) { 1743 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
1736 // ----------- S t a t e ------------- 1744 // ----------- S t a t e -------------
1737 // -- rax : the number of arguments (not including the receiver) 1745 // -- rax : the number of arguments (not including the receiver)
1738 // -- rdi : the target to call (can be any Object) 1746 // -- rdi : the target to call (can be any Object)
1739 // ----------------------------------- 1747 // -----------------------------------
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 __ movp(args.GetReceiverOperand(), rdi); 1858 __ movp(args.GetReceiverOperand(), rdi);
1851 // Let the "call_as_constructor_delegate" take care of the rest. 1859 // Let the "call_as_constructor_delegate" take care of the rest.
1852 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, rdi); 1860 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, rdi);
1853 __ Jump(masm->isolate()->builtins()->CallFunction(), 1861 __ Jump(masm->isolate()->builtins()->CallFunction(),
1854 RelocInfo::CODE_TARGET); 1862 RelocInfo::CODE_TARGET);
1855 } 1863 }
1856 1864
1857 // Called Construct on an Object that doesn't have a [[Construct]] internal 1865 // Called Construct on an Object that doesn't have a [[Construct]] internal
1858 // method. 1866 // method.
1859 __ bind(&non_constructor); 1867 __ bind(&non_constructor);
1860 { 1868 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(),
1861 FrameScope scope(masm, StackFrame::INTERNAL); 1869 RelocInfo::CODE_TARGET);
1862 __ Push(rdi);
1863 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1);
1864 }
1865 } 1870 }
1866 1871
1867 1872
1868 static void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver, 1873 static void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver,
1869 Register function_template_info, 1874 Register function_template_info,
1870 Register scratch0, Register scratch1, 1875 Register scratch0, Register scratch1,
1871 Register scratch2, 1876 Register scratch2,
1872 Label* receiver_check_failed) { 1877 Label* receiver_check_failed) {
1873 Register signature = scratch0; 1878 Register signature = scratch0;
1874 Register map = scratch1; 1879 Register map = scratch1;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 __ ret(0); 2050 __ ret(0);
2046 } 2051 }
2047 2052
2048 2053
2049 #undef __ 2054 #undef __
2050 2055
2051 } // namespace internal 2056 } // namespace internal
2052 } // namespace v8 2057 } // namespace v8
2053 2058
2054 #endif // V8_TARGET_ARCH_X64 2059 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698