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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 300693002: Revert "Customized support for feedback on calls to Array." and follow-up fixes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/typing.cc ('k') | test/mjsunit/array-constructor-feedback.js » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #include "v8.h" 5 #include "v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "bootstrapper.h" 9 #include "bootstrapper.h"
10 #include "code-stubs.h" 10 #include "code-stubs.h"
(...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 __ Push(rdi); 2221 __ Push(rdi);
2222 __ Push(rax); 2222 __ Push(rax);
2223 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 2223 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
2224 __ Pop(rdi); 2224 __ Pop(rdi);
2225 } 2225 }
2226 __ movp(args->GetReceiverOperand(), rax); 2226 __ movp(args->GetReceiverOperand(), rax);
2227 __ jmp(cont); 2227 __ jmp(cont);
2228 } 2228 }
2229 2229
2230 2230
2231 static void CallFunctionNoFeedback(MacroAssembler* masm, 2231 void CallFunctionStub::Generate(MacroAssembler* masm) {
2232 int argc, bool needs_checks,
2233 bool call_as_method) {
2234 // rdi : the function to call 2232 // rdi : the function to call
2235 2233
2236 // wrap_and_call can only be true if we are compiling a monomorphic method. 2234 // wrap_and_call can only be true if we are compiling a monomorphic method.
2237 Isolate* isolate = masm->isolate(); 2235 Isolate* isolate = masm->isolate();
2238 Label slow, non_function, wrap, cont; 2236 Label slow, non_function, wrap, cont;
2237 int argc = argc_;
2239 StackArgumentsAccessor args(rsp, argc); 2238 StackArgumentsAccessor args(rsp, argc);
2240 2239
2241 if (needs_checks) { 2240 if (NeedsChecks()) {
2242 // Check that the function really is a JavaScript function. 2241 // Check that the function really is a JavaScript function.
2243 __ JumpIfSmi(rdi, &non_function); 2242 __ JumpIfSmi(rdi, &non_function);
2244 2243
2245 // Goto slow case if we do not have a function. 2244 // Goto slow case if we do not have a function.
2246 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 2245 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
2247 __ j(not_equal, &slow); 2246 __ j(not_equal, &slow);
2248 } 2247 }
2249 2248
2250 // Fast-case: Just invoke the function. 2249 // Fast-case: Just invoke the function.
2251 ParameterCount actual(argc); 2250 ParameterCount actual(argc);
2252 2251
2253 if (call_as_method) { 2252 if (CallAsMethod()) {
2254 if (needs_checks) { 2253 if (NeedsChecks()) {
2255 EmitContinueIfStrictOrNative(masm, &cont); 2254 EmitContinueIfStrictOrNative(masm, &cont);
2256 } 2255 }
2257 2256
2258 // Load the receiver from the stack. 2257 // Load the receiver from the stack.
2259 __ movp(rax, args.GetReceiverOperand()); 2258 __ movp(rax, args.GetReceiverOperand());
2260 2259
2261 if (needs_checks) { 2260 if (NeedsChecks()) {
2262 __ JumpIfSmi(rax, &wrap); 2261 __ JumpIfSmi(rax, &wrap);
2263 2262
2264 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); 2263 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx);
2265 __ j(below, &wrap); 2264 __ j(below, &wrap);
2266 } else { 2265 } else {
2267 __ jmp(&wrap); 2266 __ jmp(&wrap);
2268 } 2267 }
2269 2268
2270 __ bind(&cont); 2269 __ bind(&cont);
2271 } 2270 }
2272 2271
2273 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); 2272 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper());
2274 2273
2275 if (needs_checks) { 2274 if (NeedsChecks()) {
2276 // Slow-case: Non-function called. 2275 // Slow-case: Non-function called.
2277 __ bind(&slow); 2276 __ bind(&slow);
2278 EmitSlowCase(isolate, masm, &args, argc, &non_function); 2277 EmitSlowCase(isolate, masm, &args, argc, &non_function);
2279 } 2278 }
2280 2279
2281 if (call_as_method) { 2280 if (CallAsMethod()) {
2282 __ bind(&wrap); 2281 __ bind(&wrap);
2283 EmitWrapCase(masm, &args, &cont); 2282 EmitWrapCase(masm, &args, &cont);
2284 } 2283 }
2285 } 2284 }
2286 2285
2287 2286
2288 void CallFunctionStub::Generate(MacroAssembler* masm) {
2289 CallFunctionNoFeedback(masm, argc_, NeedsChecks(), CallAsMethod());
2290 }
2291
2292
2293 void CallConstructStub::Generate(MacroAssembler* masm) { 2287 void CallConstructStub::Generate(MacroAssembler* masm) {
2294 // rax : number of arguments 2288 // rax : number of arguments
2295 // rbx : feedback vector 2289 // rbx : feedback vector
2296 // rdx : (only if rbx is not the megamorphic symbol) slot in feedback 2290 // rdx : (only if rbx is not the megamorphic symbol) slot in feedback
2297 // vector (Smi) 2291 // vector (Smi)
2298 // rdi : constructor function 2292 // rdi : constructor function
2299 Label slow, non_function_call; 2293 Label slow, non_function_call;
2300 2294
2301 // Check that function is not a smi. 2295 // Check that function is not a smi.
2302 __ JumpIfSmi(rdi, &non_function_call); 2296 __ JumpIfSmi(rdi, &non_function_call);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 2351
2358 2352
2359 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 2353 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
2360 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 2354 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
2361 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); 2355 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset));
2362 __ movp(vector, FieldOperand(vector, 2356 __ movp(vector, FieldOperand(vector,
2363 SharedFunctionInfo::kFeedbackVectorOffset)); 2357 SharedFunctionInfo::kFeedbackVectorOffset));
2364 } 2358 }
2365 2359
2366 2360
2367 void CallICStub::Generate_MonomorphicArray(MacroAssembler* masm, Label* miss) {
2368 // rdi - function
2369 // rbx - feedback vector
2370 // rdx - slot id (as integer)
2371 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx);
2372 __ cmpq(rdi, rcx);
2373 __ j(not_equal, miss);
2374
2375 __ movq(rax, Immediate(arg_count()));
2376 __ movp(rbx, FieldOperand(rbx, rdx, times_pointer_size,
2377 FixedArray::kHeaderSize));
2378
2379 // Verify that ecx contains an AllocationSite
2380 __ AssertUndefinedOrAllocationSite(rbx);
2381 ArrayConstructorStub stub(masm->isolate(), arg_count());
2382 __ TailCallStub(&stub);
2383 }
2384
2385
2386 void CallICStub::Generate_CustomFeedbackCall(MacroAssembler* masm) {
2387 // rdi - function
2388 // rbx - feedback vector
2389 // rdx - slot id
2390 Label miss;
2391
2392 __ SmiToInteger32(rdx, rdx);
2393
2394 if (state_.stub_type() == CallIC::MONOMORPHIC_ARRAY) {
2395 Generate_MonomorphicArray(masm, &miss);
2396 } else {
2397 // So far there is only one customer for our custom feedback scheme.
2398 UNREACHABLE();
2399 }
2400
2401 __ bind(&miss);
2402 GenerateMiss(masm);
2403
2404 // The slow case, we need this no matter what to complete a call after a miss.
2405 CallFunctionNoFeedback(masm,
2406 arg_count(),
2407 true,
2408 CallAsMethod());
2409
2410 // Unreachable.
2411 __ int3();
2412 }
2413
2414
2415 void CallICStub::Generate(MacroAssembler* masm) { 2361 void CallICStub::Generate(MacroAssembler* masm) {
2416 // rdi - function 2362 // rdi - function
2417 // rbx - vector 2363 // rbx - vector
2418 // rdx - slot id 2364 // rdx - slot id
2419 Isolate* isolate = masm->isolate(); 2365 Isolate* isolate = masm->isolate();
2420 Label extra_checks_or_miss, slow_start; 2366 Label extra_checks_or_miss, slow_start;
2421 Label slow, non_function, wrap, cont; 2367 Label slow, non_function, wrap, cont;
2422 Label have_js_function; 2368 Label have_js_function;
2423 int argc = state_.arg_count(); 2369 int argc = state_.arg_count();
2424 StackArgumentsAccessor args(rsp, argc); 2370 StackArgumentsAccessor args(rsp, argc);
2425 ParameterCount actual(argc); 2371 ParameterCount actual(argc);
2426 2372
2427 EmitLoadTypeFeedbackVector(masm, rbx); 2373 EmitLoadTypeFeedbackVector(masm, rbx);
2428 2374
2429 if (state_.stub_type() != CallIC::DEFAULT) {
2430 Generate_CustomFeedbackCall(masm);
2431 return;
2432 }
2433
2434 // The checks. First, does rdi match the recorded monomorphic target? 2375 // The checks. First, does rdi match the recorded monomorphic target?
2435 __ SmiToInteger32(rdx, rdx); 2376 __ SmiToInteger32(rdx, rdx);
2436 __ cmpq(rdi, FieldOperand(rbx, rdx, times_pointer_size, 2377 __ cmpq(rdi, FieldOperand(rbx, rdx, times_pointer_size,
2437 FixedArray::kHeaderSize)); 2378 FixedArray::kHeaderSize));
2438 __ j(not_equal, &extra_checks_or_miss); 2379 __ j(not_equal, &extra_checks_or_miss);
2439 2380
2440 __ bind(&have_js_function); 2381 __ bind(&have_js_function);
2441 if (state_.CallAsMethod()) { 2382 if (state_.CallAsMethod()) {
2442 EmitContinueIfStrictOrNative(masm, &cont); 2383 EmitContinueIfStrictOrNative(masm, &cont);
2443 2384
(...skipping 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after
5095 return_value_operand, 5036 return_value_operand,
5096 NULL); 5037 NULL);
5097 } 5038 }
5098 5039
5099 5040
5100 #undef __ 5041 #undef __
5101 5042
5102 } } // namespace v8::internal 5043 } } // namespace v8::internal
5103 5044
5104 #endif // V8_TARGET_ARCH_X64 5045 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/typing.cc ('k') | test/mjsunit/array-constructor-feedback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698