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

Side by Side Diff: src/mips/builtins-mips.cc

Issue 1752133004: [proxies] throw TypeError in [[Call]] if is_callable Map bit is unset (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: move bit test for MIPS/MIPS64 ports, too Created 4 years, 9 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/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.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 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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 // ----------------------------------- 2267 // -----------------------------------
2268 2268
2269 Label non_callable, non_function, non_smi; 2269 Label non_callable, non_function, non_smi;
2270 __ JumpIfSmi(a1, &non_callable); 2270 __ JumpIfSmi(a1, &non_callable);
2271 __ bind(&non_smi); 2271 __ bind(&non_smi);
2272 __ GetObjectType(a1, t1, t2); 2272 __ GetObjectType(a1, t1, t2);
2273 __ Jump(masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), 2273 __ Jump(masm->isolate()->builtins()->CallFunction(mode, tail_call_mode),
2274 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); 2274 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
2275 __ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), 2275 __ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode),
2276 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_BOUND_FUNCTION_TYPE)); 2276 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_BOUND_FUNCTION_TYPE));
2277
2278 // Check if target has a [[Call]] internal method.
2279 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset));
2280 __ And(t1, t1, Operand(1 << Map::kIsCallable));
2281 __ Branch(&non_callable, eq, t1, Operand(zero_reg));
2282
2277 __ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE)); 2283 __ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE));
2278 2284
2279 // 0. Prepare for tail call if necessary. 2285 // 0. Prepare for tail call if necessary.
2280 if (tail_call_mode == TailCallMode::kAllow) { 2286 if (tail_call_mode == TailCallMode::kAllow) {
2281 PrepareForTailCall(masm, a0, t0, t1, t2); 2287 PrepareForTailCall(masm, a0, t0, t1, t2);
2282 } 2288 }
2283 2289
2284 // 1. Runtime fallback for Proxy [[Call]]. 2290 // 1. Runtime fallback for Proxy [[Call]].
2285 __ Push(a1); 2291 __ Push(a1);
2286 // Increase the arguments size to include the pushed function and the 2292 // Increase the arguments size to include the pushed function and the
2287 // existing receiver on the stack. 2293 // existing receiver on the stack.
2288 __ Addu(a0, a0, 2); 2294 __ Addu(a0, a0, 2);
2289 // Tail-call to the runtime. 2295 // Tail-call to the runtime.
2290 __ JumpToExternalReference( 2296 __ JumpToExternalReference(
2291 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); 2297 ExternalReference(Runtime::kJSProxyCall, masm->isolate()));
2292 2298
2293 // 2. Call to something else, which might have a [[Call]] internal method (if 2299 // 2. Call to something else, which might have a [[Call]] internal method (if
2294 // not we raise an exception). 2300 // not we raise an exception).
2295 __ bind(&non_function); 2301 __ bind(&non_function);
2296 // Check if target has a [[Call]] internal method.
2297 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset));
2298 __ And(t1, t1, Operand(1 << Map::kIsCallable));
2299 __ Branch(&non_callable, eq, t1, Operand(zero_reg));
2300 // Overwrite the original receiver with the (original) target. 2302 // Overwrite the original receiver with the (original) target.
2301 __ Lsa(at, sp, a0, kPointerSizeLog2); 2303 __ Lsa(at, sp, a0, kPointerSizeLog2);
2302 __ sw(a1, MemOperand(at)); 2304 __ sw(a1, MemOperand(at));
2303 // Let the "call_as_function_delegate" take care of the rest. 2305 // Let the "call_as_function_delegate" take care of the rest.
2304 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); 2306 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1);
2305 __ Jump(masm->isolate()->builtins()->CallFunction( 2307 __ Jump(masm->isolate()->builtins()->CallFunction(
2306 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), 2308 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode),
2307 RelocInfo::CODE_TARGET); 2309 RelocInfo::CODE_TARGET);
2308 2310
2309 // 3. Call to something that is not callable. 2311 // 3. Call to something that is not callable.
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 } 2655 }
2654 } 2656 }
2655 2657
2656 2658
2657 #undef __ 2659 #undef __
2658 2660
2659 } // namespace internal 2661 } // namespace internal
2660 } // namespace v8 2662 } // namespace v8
2661 2663
2662 #endif // V8_TARGET_ARCH_MIPS 2664 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698