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 7931002: MIPS: port Make function proxies work as constructors. (Closed)
Patch Set: Created 9 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 617
618 618
619 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { 619 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) {
620 // ----------- S t a t e ------------- 620 // ----------- S t a t e -------------
621 // -- a0 : number of arguments 621 // -- a0 : number of arguments
622 // -- a1 : constructor function 622 // -- a1 : constructor function
623 // -- ra : return address 623 // -- ra : return address
624 // -- sp[...]: constructor arguments 624 // -- sp[...]: constructor arguments
625 // ----------------------------------- 625 // -----------------------------------
626 626
627 Label non_function_call; 627 Label slow, non_function_call;
628 // Check that the function is not a smi. 628 // Check that the function is not a smi.
629 __ And(t0, a1, Operand(kSmiTagMask)); 629 __ And(t0, a1, Operand(kSmiTagMask));
630 __ Branch(&non_function_call, eq, t0, Operand(zero_reg)); 630 __ Branch(&non_function_call, eq, t0, Operand(zero_reg));
631 // Check that the function is a JSFunction. 631 // Check that the function is a JSFunction.
632 __ GetObjectType(a1, a2, a2); 632 __ GetObjectType(a1, a2, a2);
633 __ Branch(&non_function_call, ne, a2, Operand(JS_FUNCTION_TYPE)); 633 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE));
634 634
635 // Jump to the function-specific construct stub. 635 // Jump to the function-specific construct stub.
636 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 636 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
637 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kConstructStubOffset)); 637 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kConstructStubOffset));
638 __ Addu(t9, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); 638 __ Addu(t9, a2, Operand(Code::kHeaderSize - kHeapObjectTag));
639 __ Jump(t9); 639 __ Jump(t9);
640 640
641 // a0: number of arguments 641 // a0: number of arguments
642 // a1: called object 642 // a1: called object
643 // a2: object type
644 Label do_call;
645 __ bind(&slow);
646 __ Branch(&non_function_call, ne, a2, Operand(JS_FUNCTION_PROXY_TYPE));
647 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
648 __ jmp(&do_call);
649
643 __ bind(&non_function_call); 650 __ bind(&non_function_call);
651 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
652 __ bind(&do_call);
644 // CALL_NON_FUNCTION expects the non-function constructor as receiver 653 // CALL_NON_FUNCTION expects the non-function constructor as receiver
645 // (instead of the original receiver from the call site). The receiver is 654 // (instead of the original receiver from the call site). The receiver is
646 // stack element argc. 655 // stack element argc.
647 // Set expected number of arguments to zero (not changing a0). 656 // Set expected number of arguments to zero (not changing a0).
648 __ mov(a2, zero_reg); 657 __ mov(a2, zero_reg);
649 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
650 __ SetCallKind(t1, CALL_AS_METHOD); 658 __ SetCallKind(t1, CALL_AS_METHOD);
651 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 659 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
652 RelocInfo::CODE_TARGET); 660 RelocInfo::CODE_TARGET);
653 } 661 }
654 662
655 663
656 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 664 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
657 bool is_api_function, 665 bool is_api_function,
658 bool count_constructions) { 666 bool count_constructions) {
659 // Should never count constructions for api objects. 667 // Should never count constructions for api objects.
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 __ bind(&dont_adapt_arguments); 1640 __ bind(&dont_adapt_arguments);
1633 __ Jump(a3); 1641 __ Jump(a3);
1634 } 1642 }
1635 1643
1636 1644
1637 #undef __ 1645 #undef __
1638 1646
1639 } } // namespace v8::internal 1647 } } // namespace v8::internal
1640 1648
1641 #endif // V8_TARGET_ARCH_MIPS 1649 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698