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

Unified Diff: src/mips/code-stubs-mips.cc

Issue 126043002: MIPS: Reland v8:18458 "Load the global proxy from the context of the target function." (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 438837f49587d8581ba4dd739f2c79aa002f7f1d..f4d35bb5bf11713aa73fe167b4d9c6c339bc6bfb 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -3328,32 +3328,48 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
// a2 : cache cell for call target
Label slow, non_function;
+ // Check that the function is really a JavaScript function.
+ // a1: pushed function (to be verified)
+ __ JumpIfSmi(a1, &non_function);
+
// The receiver might implicitly be the global object. This is
// indicated by passing the hole as the receiver to the call
// function stub.
- if (ReceiverMightBeImplicit()) {
- Label call;
- // Get the receiver from the stack.
- // function, receiver [, arguments]
- __ lw(t0, MemOperand(sp, argc_ * kPointerSize));
- // Call as function is indicated with the hole.
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
- __ Branch(&call, ne, t0, Operand(at));
+ if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) {
+ Label try_call, call, patch_current_context;
+ if (ReceiverMightBeImplicit()) {
+ // Get the receiver from the stack.
+ // function, receiver [, arguments]
+ __ lw(t0, MemOperand(sp, argc_ * kPointerSize));
+ // Call as function is indicated with the hole.
+ __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
+ __ Branch(&try_call, ne, t0, Operand(at));
+ }
// Patch the receiver on the stack with the global receiver object.
- __ lw(a3,
- MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
- __ lw(a3, FieldMemOperand(a3, GlobalObject::kGlobalReceiverOffset));
+ // Goto slow case if we do not have a function.
+ __ GetObjectType(a1, a3, a3);
+ __ Branch(&patch_current_context, ne, a3, Operand(JS_FUNCTION_TYPE));
+ CallStubCompiler::FetchGlobalProxy(masm, a3, a1);
__ sw(a3, MemOperand(sp, argc_ * kPointerSize));
+ __ Branch(&call);
+
+ __ bind(&patch_current_context);
+ __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
+ __ sw(t0, MemOperand(sp, argc_ * kPointerSize));
+ __ Branch(&slow);
+
+ __ bind(&try_call);
+ // Get the map of the function object.
+ __ GetObjectType(a1, a3, a3);
+ __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE));
+
__ bind(&call);
+ } else {
+ // Get the map of the function object.
+ __ GetObjectType(a1, a3, a3);
+ __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE));
}
- // Check that the function is really a JavaScript function.
- // a1: pushed function (to be verified)
- __ JumpIfSmi(a1, &non_function);
- // Get the map of the function object.
- __ GetObjectType(a1, a3, a3);
- __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE));
-
if (RecordCallTarget()) {
GenerateRecordCallTarget(masm);
}
@@ -3396,7 +3412,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
__ li(a0, Operand(argc_ + 1, RelocInfo::NONE32));
__ li(a2, Operand(0, RelocInfo::NONE32));
__ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY);
- __ SetCallKind(t1, CALL_AS_METHOD);
+ __ SetCallKind(t1, CALL_AS_FUNCTION);
{
Handle<Code> adaptor =
masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
« 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