OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 // ----------------------------------- | 2260 // ----------------------------------- |
2261 | 2261 |
2262 Label non_callable, non_function, non_smi; | 2262 Label non_callable, non_function, non_smi; |
2263 __ JumpIfSmi(a1, &non_callable); | 2263 __ JumpIfSmi(a1, &non_callable); |
2264 __ bind(&non_smi); | 2264 __ bind(&non_smi); |
2265 __ GetObjectType(a1, t1, t2); | 2265 __ GetObjectType(a1, t1, t2); |
2266 __ Jump(masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), | 2266 __ Jump(masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), |
2267 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 2267 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
2268 __ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), | 2268 __ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), |
2269 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_BOUND_FUNCTION_TYPE)); | 2269 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_BOUND_FUNCTION_TYPE)); |
| 2270 |
| 2271 // Check if target has a [[Call]] internal method. |
| 2272 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); |
| 2273 __ And(t1, t1, Operand(1 << Map::kIsCallable)); |
| 2274 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); |
| 2275 |
2270 __ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE)); | 2276 __ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE)); |
2271 | 2277 |
2272 // 0. Prepare for tail call if necessary. | 2278 // 0. Prepare for tail call if necessary. |
2273 if (tail_call_mode == TailCallMode::kAllow) { | 2279 if (tail_call_mode == TailCallMode::kAllow) { |
2274 PrepareForTailCall(masm, a0, t0, t1, t2); | 2280 PrepareForTailCall(masm, a0, t0, t1, t2); |
2275 } | 2281 } |
2276 | 2282 |
2277 // 1. Runtime fallback for Proxy [[Call]]. | 2283 // 1. Runtime fallback for Proxy [[Call]]. |
2278 __ Push(a1); | 2284 __ Push(a1); |
2279 // Increase the arguments size to include the pushed function and the | 2285 // Increase the arguments size to include the pushed function and the |
2280 // existing receiver on the stack. | 2286 // existing receiver on the stack. |
2281 __ Daddu(a0, a0, 2); | 2287 __ Daddu(a0, a0, 2); |
2282 // Tail-call to the runtime. | 2288 // Tail-call to the runtime. |
2283 __ JumpToExternalReference( | 2289 __ JumpToExternalReference( |
2284 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); | 2290 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); |
2285 | 2291 |
2286 // 2. Call to something else, which might have a [[Call]] internal method (if | 2292 // 2. Call to something else, which might have a [[Call]] internal method (if |
2287 // not we raise an exception). | 2293 // not we raise an exception). |
2288 __ bind(&non_function); | 2294 __ bind(&non_function); |
2289 // Check if target has a [[Call]] internal method. | |
2290 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); | |
2291 __ And(t1, t1, Operand(1 << Map::kIsCallable)); | |
2292 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); | |
2293 // Overwrite the original receiver with the (original) target. | 2295 // Overwrite the original receiver with the (original) target. |
2294 __ Dlsa(at, sp, a0, kPointerSizeLog2); | 2296 __ Dlsa(at, sp, a0, kPointerSizeLog2); |
2295 __ sd(a1, MemOperand(at)); | 2297 __ sd(a1, MemOperand(at)); |
2296 // Let the "call_as_function_delegate" take care of the rest. | 2298 // Let the "call_as_function_delegate" take care of the rest. |
2297 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); | 2299 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); |
2298 __ Jump(masm->isolate()->builtins()->CallFunction( | 2300 __ Jump(masm->isolate()->builtins()->CallFunction( |
2299 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), | 2301 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), |
2300 RelocInfo::CODE_TARGET); | 2302 RelocInfo::CODE_TARGET); |
2301 | 2303 |
2302 // 3. Call to something that is not callable. | 2304 // 3. Call to something that is not callable. |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2647 } | 2649 } |
2648 } | 2650 } |
2649 | 2651 |
2650 | 2652 |
2651 #undef __ | 2653 #undef __ |
2652 | 2654 |
2653 } // namespace internal | 2655 } // namespace internal |
2654 } // namespace v8 | 2656 } // namespace v8 |
2655 | 2657 |
2656 #endif // V8_TARGET_ARCH_MIPS64 | 2658 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |