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

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

Issue 7891033: MIPS: port Implement function proxies (except for their use as constructors). (Closed)
Patch Set: Rebased on bleeding_edge, resolved merge problem with r9297 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 | « src/mips/builtins-mips.cc ('k') | 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 4938 matching lines...) Expand 10 before | Expand all | Expand 10 after
4949 __ bind(&done); 4949 __ bind(&done);
4950 __ Addu(sp, sp, Operand(3 * kPointerSize)); 4950 __ Addu(sp, sp, Operand(3 * kPointerSize));
4951 __ Ret(); 4951 __ Ret();
4952 4952
4953 __ bind(&slowcase); 4953 __ bind(&slowcase);
4954 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1); 4954 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1);
4955 } 4955 }
4956 4956
4957 4957
4958 void CallFunctionStub::Generate(MacroAssembler* masm) { 4958 void CallFunctionStub::Generate(MacroAssembler* masm) {
4959 Label slow; 4959 Label slow, non_function;
4960 4960
4961 // The receiver might implicitly be the global object. This is 4961 // The receiver might implicitly be the global object. This is
4962 // indicated by passing the hole as the receiver to the call 4962 // indicated by passing the hole as the receiver to the call
4963 // function stub. 4963 // function stub.
4964 if (ReceiverMightBeImplicit()) { 4964 if (ReceiverMightBeImplicit()) {
4965 Label call; 4965 Label call;
4966 // Get the receiver from the stack. 4966 // Get the receiver from the stack.
4967 // function, receiver [, arguments] 4967 // function, receiver [, arguments]
4968 __ lw(t0, MemOperand(sp, argc_ * kPointerSize)); 4968 __ lw(t0, MemOperand(sp, argc_ * kPointerSize));
4969 // Call as function is indicated with the hole. 4969 // Call as function is indicated with the hole.
4970 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 4970 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
4971 __ Branch(&call, ne, t0, Operand(at)); 4971 __ Branch(&call, ne, t0, Operand(at));
4972 // Patch the receiver on the stack with the global receiver object. 4972 // Patch the receiver on the stack with the global receiver object.
4973 __ lw(a1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); 4973 __ lw(a1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
4974 __ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalReceiverOffset)); 4974 __ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalReceiverOffset));
4975 __ sw(a1, MemOperand(sp, argc_ * kPointerSize)); 4975 __ sw(a1, MemOperand(sp, argc_ * kPointerSize));
4976 __ bind(&call); 4976 __ bind(&call);
4977 } 4977 }
4978 4978
4979 // Get the function to call from the stack. 4979 // Get the function to call from the stack.
4980 // function, receiver [, arguments] 4980 // function, receiver [, arguments]
4981 __ lw(a1, MemOperand(sp, (argc_ + 1) * kPointerSize)); 4981 __ lw(a1, MemOperand(sp, (argc_ + 1) * kPointerSize));
4982 4982
4983 // Check that the function is really a JavaScript function. 4983 // Check that the function is really a JavaScript function.
4984 // a1: pushed function (to be verified) 4984 // a1: pushed function (to be verified)
4985 __ JumpIfSmi(a1, &slow); 4985 __ JumpIfSmi(a1, &non_function);
4986 // Get the map of the function object. 4986 // Get the map of the function object.
4987 __ GetObjectType(a1, a2, a2); 4987 __ GetObjectType(a1, a2, a2);
4988 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE)); 4988 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE));
4989 4989
4990 // Fast-case: Invoke the function now. 4990 // Fast-case: Invoke the function now.
4991 // a1: pushed function 4991 // a1: pushed function
4992 ParameterCount actual(argc_); 4992 ParameterCount actual(argc_);
4993 4993
4994 if (ReceiverMightBeImplicit()) { 4994 if (ReceiverMightBeImplicit()) {
4995 Label call_as_function; 4995 Label call_as_function;
4996 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 4996 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
4997 __ Branch(&call_as_function, eq, t0, Operand(at)); 4997 __ Branch(&call_as_function, eq, t0, Operand(at));
4998 __ InvokeFunction(a1, 4998 __ InvokeFunction(a1,
4999 actual, 4999 actual,
5000 JUMP_FUNCTION, 5000 JUMP_FUNCTION,
5001 NullCallWrapper(), 5001 NullCallWrapper(),
5002 CALL_AS_METHOD); 5002 CALL_AS_METHOD);
5003 __ bind(&call_as_function); 5003 __ bind(&call_as_function);
5004 } 5004 }
5005 __ InvokeFunction(a1, 5005 __ InvokeFunction(a1,
5006 actual, 5006 actual,
5007 JUMP_FUNCTION, 5007 JUMP_FUNCTION,
5008 NullCallWrapper(), 5008 NullCallWrapper(),
5009 CALL_AS_FUNCTION); 5009 CALL_AS_FUNCTION);
5010 5010
5011 // Slow-case: Non-function called. 5011 // Slow-case: Non-function called.
5012 __ bind(&slow); 5012 __ bind(&slow);
5013 // Check for function proxy.
5014 __ Branch(&non_function, ne, a2, Operand(JS_FUNCTION_PROXY_TYPE));
5015 __ push(a1); // Put proxy as additional argument.
5016 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE));
5017 __ li(a2, Operand(0, RelocInfo::NONE));
5018 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY);
5019 __ SetCallKind(t1, CALL_AS_FUNCTION);
5020 {
5021 Handle<Code> adaptor =
5022 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
5023 __ Jump(adaptor, RelocInfo::CODE_TARGET);
5024 }
5025
5013 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 5026 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
5014 // of the original receiver from the call site). 5027 // of the original receiver from the call site).
5028 __ bind(&non_function);
5015 __ sw(a1, MemOperand(sp, argc_ * kPointerSize)); 5029 __ sw(a1, MemOperand(sp, argc_ * kPointerSize));
5016 __ li(a0, Operand(argc_)); // Setup the number of arguments. 5030 __ li(a0, Operand(argc_)); // Setup the number of arguments.
5017 __ mov(a2, zero_reg); 5031 __ mov(a2, zero_reg);
5018 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); 5032 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION);
5019 __ SetCallKind(t1, CALL_AS_METHOD); 5033 __ SetCallKind(t1, CALL_AS_METHOD);
5020 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 5034 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
5021 RelocInfo::CODE_TARGET); 5035 RelocInfo::CODE_TARGET);
5022 } 5036 }
5023 5037
5024 5038
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
7007 __ mov(result, zero_reg); 7021 __ mov(result, zero_reg);
7008 __ Ret(); 7022 __ Ret();
7009 } 7023 }
7010 7024
7011 7025
7012 #undef __ 7026 #undef __
7013 7027
7014 } } // namespace v8::internal 7028 } } // namespace v8::internal
7015 7029
7016 #endif // V8_TARGET_ARCH_MIPS 7030 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698