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

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

Issue 7628021: Make function proxies work as constructors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/heap.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 610
611 611
612 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { 612 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) {
613 // ----------- S t a t e ------------- 613 // ----------- S t a t e -------------
614 // -- r0 : number of arguments 614 // -- r0 : number of arguments
615 // -- r1 : constructor function 615 // -- r1 : constructor function
616 // -- lr : return address 616 // -- lr : return address
617 // -- sp[...]: constructor arguments 617 // -- sp[...]: constructor arguments
618 // ----------------------------------- 618 // -----------------------------------
619 619
620 Label non_function_call; 620 Label slow, non_function_call;
621 // Check that the function is not a smi. 621 // Check that the function is not a smi.
622 __ JumpIfSmi(r1, &non_function_call); 622 __ JumpIfSmi(r1, &non_function_call);
623 // Check that the function is a JSFunction. 623 // Check that the function is a JSFunction.
624 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); 624 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE);
625 __ b(ne, &non_function_call); 625 __ b(ne, &slow);
626 626
627 // Jump to the function-specific construct stub. 627 // Jump to the function-specific construct stub.
628 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 628 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
629 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset)); 629 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset));
630 __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); 630 __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
631 631
632 // r0: number of arguments 632 // r0: number of arguments
633 // r1: called object 633 // r1: called object
634 // r2: object type
635 Label do_call;
636 __ bind(&slow);
637 __ cmp(r2, Operand(JS_FUNCTION_PROXY_TYPE));
638 __ b(ne, &non_function_call);
639 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
640 __ jmp(&do_call);
641
634 __ bind(&non_function_call); 642 __ bind(&non_function_call);
643 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
644 __ bind(&do_call);
635 // Set expected number of arguments to zero (not changing r0). 645 // Set expected number of arguments to zero (not changing r0).
636 __ mov(r2, Operand(0, RelocInfo::NONE)); 646 __ mov(r2, Operand(0, RelocInfo::NONE));
637 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
638 __ SetCallKind(r5, CALL_AS_METHOD); 647 __ SetCallKind(r5, CALL_AS_METHOD);
639 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 648 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
640 RelocInfo::CODE_TARGET); 649 RelocInfo::CODE_TARGET);
641 } 650 }
642 651
643 652
644 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 653 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
645 bool is_api_function, 654 bool is_api_function,
646 bool count_constructions) { 655 bool count_constructions) {
647 // Should never count constructions for api objects. 656 // Should never count constructions for api objects.
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 __ bind(&dont_adapt_arguments); 1695 __ bind(&dont_adapt_arguments);
1687 __ Jump(r3); 1696 __ Jump(r3);
1688 } 1697 }
1689 1698
1690 1699
1691 #undef __ 1700 #undef __
1692 1701
1693 } } // namespace v8::internal 1702 } } // namespace v8::internal
1694 1703
1695 #endif // V8_TARGET_ARCH_ARM 1704 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698