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

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

Issue 1754593007: X87: [proxies] throw TypeError if is_callable Map bit is unset. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.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 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 2221
2222 Label non_callable, non_function, non_smi; 2222 Label non_callable, non_function, non_smi;
2223 __ JumpIfSmi(edi, &non_callable); 2223 __ JumpIfSmi(edi, &non_callable);
2224 __ bind(&non_smi); 2224 __ bind(&non_smi);
2225 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 2225 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
2226 __ j(equal, masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), 2226 __ j(equal, masm->isolate()->builtins()->CallFunction(mode, tail_call_mode),
2227 RelocInfo::CODE_TARGET); 2227 RelocInfo::CODE_TARGET);
2228 __ CmpInstanceType(ecx, JS_BOUND_FUNCTION_TYPE); 2228 __ CmpInstanceType(ecx, JS_BOUND_FUNCTION_TYPE);
2229 __ j(equal, masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), 2229 __ j(equal, masm->isolate()->builtins()->CallBoundFunction(tail_call_mode),
2230 RelocInfo::CODE_TARGET); 2230 RelocInfo::CODE_TARGET);
2231
2232 // Check if target has a [[Call]] internal method.
2233 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), 1 << Map::kIsCallable);
2234 __ j(zero, &non_callable);
2235
2231 __ CmpInstanceType(ecx, JS_PROXY_TYPE); 2236 __ CmpInstanceType(ecx, JS_PROXY_TYPE);
2232 __ j(not_equal, &non_function); 2237 __ j(not_equal, &non_function);
2233 2238
2234 // 0. Prepare for tail call if necessary. 2239 // 0. Prepare for tail call if necessary.
2235 if (tail_call_mode == TailCallMode::kAllow) { 2240 if (tail_call_mode == TailCallMode::kAllow) {
2236 PrepareForTailCall(masm, eax, ebx, ecx, edx); 2241 PrepareForTailCall(masm, eax, ebx, ecx, edx);
2237 } 2242 }
2238 2243
2239 // 1. Runtime fallback for Proxy [[Call]]. 2244 // 1. Runtime fallback for Proxy [[Call]].
2240 __ PopReturnAddressTo(ecx); 2245 __ PopReturnAddressTo(ecx);
2241 __ Push(edi); 2246 __ Push(edi);
2242 __ PushReturnAddressFrom(ecx); 2247 __ PushReturnAddressFrom(ecx);
2243 // Increase the arguments size to include the pushed function and the 2248 // Increase the arguments size to include the pushed function and the
2244 // existing receiver on the stack. 2249 // existing receiver on the stack.
2245 __ add(eax, Immediate(2)); 2250 __ add(eax, Immediate(2));
2246 // Tail-call to the runtime. 2251 // Tail-call to the runtime.
2247 __ JumpToExternalReference( 2252 __ JumpToExternalReference(
2248 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); 2253 ExternalReference(Runtime::kJSProxyCall, masm->isolate()));
2249 2254
2250 // 2. Call to something else, which might have a [[Call]] internal method (if 2255 // 2. Call to something else, which might have a [[Call]] internal method (if
2251 // not we raise an exception). 2256 // not we raise an exception).
2252 __ bind(&non_function); 2257 __ bind(&non_function);
2253 // Check if target has a [[Call]] internal method.
2254 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), 1 << Map::kIsCallable);
2255 __ j(zero, &non_callable, Label::kNear);
2256 // Overwrite the original receiver with the (original) target. 2258 // Overwrite the original receiver with the (original) target.
2257 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); 2259 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi);
2258 // Let the "call_as_function_delegate" take care of the rest. 2260 // Let the "call_as_function_delegate" take care of the rest.
2259 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, edi); 2261 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, edi);
2260 __ Jump(masm->isolate()->builtins()->CallFunction( 2262 __ Jump(masm->isolate()->builtins()->CallFunction(
2261 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), 2263 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode),
2262 RelocInfo::CODE_TARGET); 2264 RelocInfo::CODE_TARGET);
2263 2265
2264 // 3. Call to something that is not callable. 2266 // 3. Call to something that is not callable.
2265 __ bind(&non_callable); 2267 __ bind(&non_callable);
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 2688
2687 __ bind(&ok); 2689 __ bind(&ok);
2688 __ ret(0); 2690 __ ret(0);
2689 } 2691 }
2690 2692
2691 #undef __ 2693 #undef __
2692 } // namespace internal 2694 } // namespace internal
2693 } // namespace v8 2695 } // namespace v8
2694 2696
2695 #endif // V8_TARGET_ARCH_X87 2697 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698