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

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 6992051: MIPS: port Fix calls of strict mode function with an implicit receiver. (Closed)
Patch Set: Created 9 years, 7 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 | « src/mips/builtins-mips.cc ('k') | src/mips/full-codegen-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 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 4637 matching lines...) Expand 10 before | Expand all | Expand 10 after
4648 __ Ret(); 4648 __ Ret();
4649 4649
4650 __ bind(&slowcase); 4650 __ bind(&slowcase);
4651 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1); 4651 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1);
4652 } 4652 }
4653 4653
4654 4654
4655 void CallFunctionStub::Generate(MacroAssembler* masm) { 4655 void CallFunctionStub::Generate(MacroAssembler* masm) {
4656 Label slow; 4656 Label slow;
4657 4657
4658 // If the receiver might be a value (string, number or boolean) check 4658 // The receiver might implicitly be the global object. This is
4659 // for this and box it if it is. 4659 // indicated by passing the hole as the receiver to the call
4660 if (ReceiverMightBeValue()) { 4660 // function stub.
4661 if (ReceiverMightBeImplicit()) {
4662 Label call;
4661 // Get the receiver from the stack. 4663 // Get the receiver from the stack.
4662 // function, receiver [, arguments] 4664 // function, receiver [, arguments]
4663 Label receiver_is_value, receiver_is_js_object; 4665 __ lw(t0, MemOperand(sp, argc_ * kPointerSize));
4664 __ lw(a1, MemOperand(sp, argc_ * kPointerSize)); 4666 // Call as function is indicated with the hole.
4665 4667 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
4666 // Check if receiver is a smi (which is a number value). 4668 __ Branch(&call, ne, t0, Operand(at));
4667 __ JumpIfSmi(a1, &receiver_is_value); 4669 // Patch the receiver on the stack with the global receiver object.
4668 4670 __ lw(a1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
4669 // Check if the receiver is a valid JS object. 4671 __ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalReceiverOffset));
4670 __ GetObjectType(a1, a2, a2); 4672 __ sw(a1, MemOperand(sp, argc_ * kPointerSize));
4671 __ Branch(&receiver_is_js_object, 4673 __ bind(&call);
4672 ge,
4673 a2,
4674 Operand(FIRST_JS_OBJECT_TYPE));
4675
4676 // Call the runtime to box the value.
4677 __ bind(&receiver_is_value);
4678 // We need natives to execute this.
4679 __ EnterInternalFrame();
4680 __ push(a1);
4681 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
4682 __ LeaveInternalFrame();
4683 __ sw(v0, MemOperand(sp, argc_ * kPointerSize));
4684
4685 __ bind(&receiver_is_js_object);
4686 } 4674 }
4687 4675
4688 // Get the function to call from the stack. 4676 // Get the function to call from the stack.
4689 // function, receiver [, arguments] 4677 // function, receiver [, arguments]
4690 __ lw(a1, MemOperand(sp, (argc_ + 1) * kPointerSize)); 4678 __ lw(a1, MemOperand(sp, (argc_ + 1) * kPointerSize));
4691 4679
4692 // Check that the function is really a JavaScript function. 4680 // Check that the function is really a JavaScript function.
4693 // a1: pushed function (to be verified) 4681 // a1: pushed function (to be verified)
4694 __ JumpIfSmi(a1, &slow); 4682 __ JumpIfSmi(a1, &slow);
4695 // Get the map of the function object. 4683 // Get the map of the function object.
4696 __ GetObjectType(a1, a2, a2); 4684 __ GetObjectType(a1, a2, a2);
4697 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE)); 4685 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE));
4698 4686
4699 // Fast-case: Invoke the function now. 4687 // Fast-case: Invoke the function now.
4700 // a1: pushed function 4688 // a1: pushed function
4701 ParameterCount actual(argc_); 4689 ParameterCount actual(argc_);
4702 __ InvokeFunction(a1, actual, JUMP_FUNCTION); 4690
4691 if (ReceiverMightBeImplicit()) {
4692 Label call_as_function;
4693 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
4694 __ Branch(&call_as_function, eq, t0, Operand(at));
4695 __ InvokeFunction(a1, actual, JUMP_FUNCTION);
4696 __ bind(&call_as_function);
4697 }
4698 __ InvokeFunction(a1,
4699 actual,
4700 JUMP_FUNCTION,
4701 NullCallWrapper(),
4702 CALL_AS_FUNCTION);
4703 4703
4704 // Slow-case: Non-function called. 4704 // Slow-case: Non-function called.
4705 __ bind(&slow); 4705 __ bind(&slow);
4706 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 4706 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
4707 // of the original receiver from the call site). 4707 // of the original receiver from the call site).
4708 __ sw(a1, MemOperand(sp, argc_ * kPointerSize)); 4708 __ sw(a1, MemOperand(sp, argc_ * kPointerSize));
4709 __ li(a0, Operand(argc_)); // Setup the number of arguments. 4709 __ li(a0, Operand(argc_)); // Setup the number of arguments.
4710 __ mov(a2, zero_reg); 4710 __ mov(a2, zero_reg);
4711 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); 4711 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION);
4712 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 4712 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after
6647 __ mov(result, zero_reg); 6647 __ mov(result, zero_reg);
6648 __ Ret(); 6648 __ Ret();
6649 } 6649 }
6650 6650
6651 6651
6652 #undef __ 6652 #undef __
6653 6653
6654 } } // namespace v8::internal 6654 } } // namespace v8::internal
6655 6655
6656 #endif // V8_TARGET_ARCH_MIPS 6656 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698