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/code-stubs-mips.cc

Issue 138383002: MIPS: Make the strict-mode calling convention for contextual calls the default one. (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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3314 matching lines...) Expand 10 before | Expand all | Expand 10 after
3325 3325
3326 void CallFunctionStub::Generate(MacroAssembler* masm) { 3326 void CallFunctionStub::Generate(MacroAssembler* masm) {
3327 // a1 : the function to call 3327 // a1 : the function to call
3328 // a2 : cache cell for call target 3328 // a2 : cache cell for call target
3329 Label slow, non_function; 3329 Label slow, non_function;
3330 3330
3331 // Check that the function is really a JavaScript function. 3331 // Check that the function is really a JavaScript function.
3332 // a1: pushed function (to be verified) 3332 // a1: pushed function (to be verified)
3333 __ JumpIfSmi(a1, &non_function); 3333 __ JumpIfSmi(a1, &non_function);
3334 3334
3335 // The receiver might implicitly be the global object. This is 3335 // Goto slow case if we do not have a function.
3336 // indicated by passing the hole as the receiver to the call 3336 __ GetObjectType(a1, a3, a3);
3337 // function stub. 3337 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE));
3338 if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) {
3339 Label try_call, call, patch_current_context;
3340 if (ReceiverMightBeImplicit()) {
3341 // Get the receiver from the stack.
3342 // function, receiver [, arguments]
3343 __ lw(t0, MemOperand(sp, argc_ * kPointerSize));
3344 // Call as function is indicated with the hole.
3345 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3346 __ Branch(&try_call, ne, t0, Operand(at));
3347 }
3348 // Patch the receiver on the stack with the global receiver object.
3349 // Goto slow case if we do not have a function.
3350 __ GetObjectType(a1, a3, a3);
3351 __ Branch(&patch_current_context, ne, a3, Operand(JS_FUNCTION_TYPE));
3352 CallStubCompiler::FetchGlobalProxy(masm, a3, a1);
3353 __ sw(a3, MemOperand(sp, argc_ * kPointerSize));
3354 __ Branch(&call);
3355
3356 __ bind(&patch_current_context);
3357 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
3358 __ sw(t0, MemOperand(sp, argc_ * kPointerSize));
3359 __ Branch(&slow);
3360
3361 __ bind(&try_call);
3362 // Get the map of the function object.
3363 __ GetObjectType(a1, a3, a3);
3364 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE));
3365
3366 __ bind(&call);
3367 } else {
3368 // Get the map of the function object.
3369 __ GetObjectType(a1, a3, a3);
3370 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE));
3371 }
3372 3338
3373 if (RecordCallTarget()) { 3339 if (RecordCallTarget()) {
3374 GenerateRecordCallTarget(masm); 3340 GenerateRecordCallTarget(masm);
3375 } 3341 }
3376 3342
3377 // Fast-case: Invoke the function now. 3343 // Fast-case: Invoke the function now.
3378 // a1: pushed function 3344 // a1: pushed function
3379 ParameterCount actual(argc_); 3345 ParameterCount actual(argc_);
3380 3346
3381 if (ReceiverMightBeImplicit()) {
3382 Label call_as_function;
3383 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3384 __ Branch(&call_as_function, eq, t0, Operand(at));
3385 __ InvokeFunction(a1,
3386 actual,
3387 JUMP_FUNCTION,
3388 NullCallWrapper(),
3389 CALL_AS_METHOD);
3390 __ bind(&call_as_function);
3391 }
3392 __ InvokeFunction(a1, 3347 __ InvokeFunction(a1,
3393 actual, 3348 actual,
3394 JUMP_FUNCTION, 3349 JUMP_FUNCTION,
3395 NullCallWrapper(), 3350 NullCallWrapper(),
3396 CALL_AS_FUNCTION); 3351 CALL_AS_FUNCTION);
3397 3352
3398 // Slow-case: Non-function called. 3353 // Slow-case: Non-function called.
3399 __ bind(&slow); 3354 __ bind(&slow);
3400 if (RecordCallTarget()) { 3355 if (RecordCallTarget()) {
3401 // If there is a call target cache, mark it megamorphic in the 3356 // If there is a call target cache, mark it megamorphic in the
(...skipping 17 matching lines...) Expand all
3419 __ Jump(adaptor, RelocInfo::CODE_TARGET); 3374 __ Jump(adaptor, RelocInfo::CODE_TARGET);
3420 } 3375 }
3421 3376
3422 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 3377 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
3423 // of the original receiver from the call site). 3378 // of the original receiver from the call site).
3424 __ bind(&non_function); 3379 __ bind(&non_function);
3425 __ sw(a1, MemOperand(sp, argc_ * kPointerSize)); 3380 __ sw(a1, MemOperand(sp, argc_ * kPointerSize));
3426 __ li(a0, Operand(argc_)); // Set up the number of arguments. 3381 __ li(a0, Operand(argc_)); // Set up the number of arguments.
3427 __ mov(a2, zero_reg); 3382 __ mov(a2, zero_reg);
3428 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); 3383 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION);
3429 __ SetCallKind(t1, CALL_AS_METHOD); 3384 __ SetCallKind(t1, CALL_AS_FUNCTION);
3430 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 3385 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
3431 RelocInfo::CODE_TARGET); 3386 RelocInfo::CODE_TARGET);
3432 } 3387 }
3433 3388
3434 3389
3435 void CallConstructStub::Generate(MacroAssembler* masm) { 3390 void CallConstructStub::Generate(MacroAssembler* masm) {
3436 // a0 : number of arguments 3391 // a0 : number of arguments
3437 // a1 : the function to call 3392 // a1 : the function to call
3438 // a2 : cache cell for call target 3393 // a2 : cache cell for call target
3439 Label slow, non_function_call; 3394 Label slow, non_function_call;
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after
6023 __ bind(&fast_elements_case); 5978 __ bind(&fast_elements_case);
6024 GenerateCase(masm, FAST_ELEMENTS); 5979 GenerateCase(masm, FAST_ELEMENTS);
6025 } 5980 }
6026 5981
6027 5982
6028 #undef __ 5983 #undef __
6029 5984
6030 } } // namespace v8::internal 5985 } } // namespace v8::internal
6031 5986
6032 #endif // V8_TARGET_ARCH_MIPS 5987 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698