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

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

Issue 8509004: MIPS: Make _CallFunction proxy-aware. (Closed)
Patch Set: Created 9 years, 1 month 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 | src/mips/debug-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 5102 matching lines...) Expand 10 before | Expand all | Expand 10 after
5113 } 5113 }
5114 5114
5115 5115
5116 Object* CallFunctionStub::GetCachedValue(Address address) { 5116 Object* CallFunctionStub::GetCachedValue(Address address) {
5117 UNREACHABLE(); 5117 UNREACHABLE();
5118 return NULL; 5118 return NULL;
5119 } 5119 }
5120 5120
5121 5121
5122 void CallFunctionStub::Generate(MacroAssembler* masm) { 5122 void CallFunctionStub::Generate(MacroAssembler* masm) {
5123 // a1 : the function to call
5123 Label slow, non_function; 5124 Label slow, non_function;
5124 5125
5125 // The receiver might implicitly be the global object. This is 5126 // The receiver might implicitly be the global object. This is
5126 // indicated by passing the hole as the receiver to the call 5127 // indicated by passing the hole as the receiver to the call
5127 // function stub. 5128 // function stub.
5128 if (ReceiverMightBeImplicit()) { 5129 if (ReceiverMightBeImplicit()) {
5129 Label call; 5130 Label call;
5130 // Get the receiver from the stack. 5131 // Get the receiver from the stack.
5131 // function, receiver [, arguments] 5132 // function, receiver [, arguments]
5132 __ lw(t0, MemOperand(sp, argc_ * kPointerSize)); 5133 __ lw(t0, MemOperand(sp, argc_ * kPointerSize));
5133 // Call as function is indicated with the hole. 5134 // Call as function is indicated with the hole.
5134 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5135 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5135 __ Branch(&call, ne, t0, Operand(at)); 5136 __ Branch(&call, ne, t0, Operand(at));
5136 // Patch the receiver on the stack with the global receiver object. 5137 // Patch the receiver on the stack with the global receiver object.
5137 __ lw(a1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); 5138 __ lw(a2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
5138 __ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalReceiverOffset)); 5139 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset));
5139 __ sw(a1, MemOperand(sp, argc_ * kPointerSize)); 5140 __ sw(a2, MemOperand(sp, argc_ * kPointerSize));
5140 __ bind(&call); 5141 __ bind(&call);
5141 } 5142 }
5142 5143
5143 // Get the function to call from the stack.
5144 // function, receiver [, arguments]
5145 __ lw(a1, MemOperand(sp, (argc_ + 1) * kPointerSize));
5146
5147 // Check that the function is really a JavaScript function. 5144 // Check that the function is really a JavaScript function.
5148 // a1: pushed function (to be verified) 5145 // a1: pushed function (to be verified)
5149 __ JumpIfSmi(a1, &non_function); 5146 __ JumpIfSmi(a1, &non_function);
5150 // Get the map of the function object. 5147 // Get the map of the function object.
5151 __ GetObjectType(a1, a2, a2); 5148 __ GetObjectType(a1, a2, a2);
5152 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE)); 5149 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE));
5153 5150
5154 // Fast-case: Invoke the function now. 5151 // Fast-case: Invoke the function now.
5155 // a1: pushed function 5152 // a1: pushed function
5156 ParameterCount actual(argc_); 5153 ParameterCount actual(argc_);
(...skipping 16 matching lines...) Expand all
5173 CALL_AS_FUNCTION); 5170 CALL_AS_FUNCTION);
5174 5171
5175 // Slow-case: Non-function called. 5172 // Slow-case: Non-function called.
5176 __ bind(&slow); 5173 __ bind(&slow);
5177 // Check for function proxy. 5174 // Check for function proxy.
5178 __ Branch(&non_function, ne, a2, Operand(JS_FUNCTION_PROXY_TYPE)); 5175 __ Branch(&non_function, ne, a2, Operand(JS_FUNCTION_PROXY_TYPE));
5179 __ push(a1); // Put proxy as additional argument. 5176 __ push(a1); // Put proxy as additional argument.
5180 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE)); 5177 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE));
5181 __ li(a2, Operand(0, RelocInfo::NONE)); 5178 __ li(a2, Operand(0, RelocInfo::NONE));
5182 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); 5179 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY);
5183 __ SetCallKind(t1, CALL_AS_FUNCTION); 5180 __ SetCallKind(t1, CALL_AS_METHOD);
5184 { 5181 {
5185 Handle<Code> adaptor = 5182 Handle<Code> adaptor =
5186 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 5183 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
5187 __ Jump(adaptor, RelocInfo::CODE_TARGET); 5184 __ Jump(adaptor, RelocInfo::CODE_TARGET);
5188 } 5185 }
5189 5186
5190 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 5187 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
5191 // of the original receiver from the call site). 5188 // of the original receiver from the call site).
5192 __ bind(&non_function); 5189 __ bind(&non_function);
5193 __ sw(a1, MemOperand(sp, argc_ * kPointerSize)); 5190 __ sw(a1, MemOperand(sp, argc_ * kPointerSize));
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after
7467 7464
7468 // Fall through when we need to inform the incremental marker. 7465 // Fall through when we need to inform the incremental marker.
7469 } 7466 }
7470 7467
7471 7468
7472 #undef __ 7469 #undef __
7473 7470
7474 } } // namespace v8::internal 7471 } } // namespace v8::internal
7475 7472
7476 #endif // V8_TARGET_ARCH_MIPS 7473 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/debug-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698