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

Side by Side Diff: src/ia32/code-stubs-ia32.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/hydrogen.cc ('k') | src/ic.h » ('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 #include "v8.h" 5 #include "v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "bootstrapper.h" 9 #include "bootstrapper.h"
10 #include "code-stubs.h" 10 #include "code-stubs.h"
(...skipping 2317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 __ push(edi); 2328 __ push(edi);
2329 __ push(eax); 2329 __ push(eax);
2330 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 2330 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
2331 __ pop(edi); 2331 __ pop(edi);
2332 } 2332 }
2333 __ mov(Operand(esp, (argc + 1) * kPointerSize), eax); 2333 __ mov(Operand(esp, (argc + 1) * kPointerSize), eax);
2334 __ jmp(cont); 2334 __ jmp(cont);
2335 } 2335 }
2336 2336
2337 2337
2338 static void CallFunctionNoFeedback(MacroAssembler* masm, 2338 void CallFunctionStub::Generate(MacroAssembler* masm) {
2339 int argc, bool needs_checks,
2340 bool call_as_method) {
2341 // edi : the function to call 2339 // edi : the function to call
2342 Label slow, non_function, wrap, cont; 2340 Label slow, non_function, wrap, cont;
2343 2341
2344 if (needs_checks) { 2342 if (NeedsChecks()) {
2345 // Check that the function really is a JavaScript function. 2343 // Check that the function really is a JavaScript function.
2346 __ JumpIfSmi(edi, &non_function); 2344 __ JumpIfSmi(edi, &non_function);
2347 2345
2348 // Goto slow case if we do not have a function. 2346 // Goto slow case if we do not have a function.
2349 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 2347 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
2350 __ j(not_equal, &slow); 2348 __ j(not_equal, &slow);
2351 } 2349 }
2352 2350
2353 // Fast-case: Just invoke the function. 2351 // Fast-case: Just invoke the function.
2354 ParameterCount actual(argc); 2352 ParameterCount actual(argc_);
2355 2353
2356 if (call_as_method) { 2354 if (CallAsMethod()) {
2357 if (needs_checks) { 2355 if (NeedsChecks()) {
2358 EmitContinueIfStrictOrNative(masm, &cont); 2356 EmitContinueIfStrictOrNative(masm, &cont);
2359 } 2357 }
2360 2358
2361 // Load the receiver from the stack. 2359 // Load the receiver from the stack.
2362 __ mov(eax, Operand(esp, (argc + 1) * kPointerSize)); 2360 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize));
2363 2361
2364 if (call_as_method) { 2362 if (NeedsChecks()) {
2365 __ JumpIfSmi(eax, &wrap); 2363 __ JumpIfSmi(eax, &wrap);
2366 2364
2367 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); 2365 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
2368 __ j(below, &wrap); 2366 __ j(below, &wrap);
2369 } else { 2367 } else {
2370 __ jmp(&wrap); 2368 __ jmp(&wrap);
2371 } 2369 }
2372 2370
2373 __ bind(&cont); 2371 __ bind(&cont);
2374 } 2372 }
2375 2373
2376 __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); 2374 __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper());
2377 2375
2378 if (needs_checks) { 2376 if (NeedsChecks()) {
2379 // Slow-case: Non-function called. 2377 // Slow-case: Non-function called.
2380 __ bind(&slow); 2378 __ bind(&slow);
2381 // (non_function is bound in EmitSlowCase) 2379 // (non_function is bound in EmitSlowCase)
2382 EmitSlowCase(masm->isolate(), masm, argc, &non_function); 2380 EmitSlowCase(isolate(), masm, argc_, &non_function);
2383 } 2381 }
2384 2382
2385 if (call_as_method) { 2383 if (CallAsMethod()) {
2386 __ bind(&wrap); 2384 __ bind(&wrap);
2387 EmitWrapCase(masm, argc, &cont); 2385 EmitWrapCase(masm, argc_, &cont);
2388 } 2386 }
2389 } 2387 }
2390 2388
2391 2389
2392 void CallFunctionStub::Generate(MacroAssembler* masm) {
2393 CallFunctionNoFeedback(masm, argc_, NeedsChecks(), CallAsMethod());
2394 }
2395
2396
2397 void CallConstructStub::Generate(MacroAssembler* masm) { 2390 void CallConstructStub::Generate(MacroAssembler* masm) {
2398 // eax : number of arguments 2391 // eax : number of arguments
2399 // ebx : feedback vector 2392 // ebx : feedback vector
2400 // edx : (only if ebx is not the megamorphic symbol) slot in feedback 2393 // edx : (only if ebx is not the megamorphic symbol) slot in feedback
2401 // vector (Smi) 2394 // vector (Smi)
2402 // edi : constructor function 2395 // edi : constructor function
2403 Label slow, non_function_call; 2396 Label slow, non_function_call;
2404 2397
2405 // Check that function is not a smi. 2398 // Check that function is not a smi.
2406 __ JumpIfSmi(edi, &non_function_call); 2399 __ JumpIfSmi(edi, &non_function_call);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 2456
2464 2457
2465 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 2458 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
2466 __ mov(vector, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 2459 __ mov(vector, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
2467 __ mov(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); 2460 __ mov(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset));
2468 __ mov(vector, FieldOperand(vector, 2461 __ mov(vector, FieldOperand(vector,
2469 SharedFunctionInfo::kFeedbackVectorOffset)); 2462 SharedFunctionInfo::kFeedbackVectorOffset));
2470 } 2463 }
2471 2464
2472 2465
2473 void CallICStub::Generate_MonomorphicArray(MacroAssembler* masm, Label* miss) {
2474 // edi - function
2475 // ebx - feedback vector
2476 // edx - slot id
2477 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx);
2478 __ cmp(edi, ecx);
2479 __ j(not_equal, miss);
2480
2481 __ mov(eax, arg_count());
2482 __ mov(ebx, FieldOperand(ebx, edx, times_half_pointer_size,
2483 FixedArray::kHeaderSize));
2484 // Verify that ecx contains an AllocationSite
2485 __ AssertUndefinedOrAllocationSite(ebx);
2486 ArrayConstructorStub stub(masm->isolate(), arg_count());
2487 __ TailCallStub(&stub);
2488 }
2489
2490
2491 void CallICStub::Generate_CustomFeedbackCall(MacroAssembler* masm) {
2492 // edi - function
2493 // ebx - feedback vector
2494 // edx - slot id
2495 Label miss;
2496
2497 if (state_.stub_type() == CallIC::MONOMORPHIC_ARRAY) {
2498 Generate_MonomorphicArray(masm, &miss);
2499 } else {
2500 // So far there is only one customer for our custom feedback scheme.
2501 UNREACHABLE();
2502 }
2503
2504 __ bind(&miss);
2505 GenerateMiss(masm);
2506
2507 // The slow case, we need this no matter what to complete a call after a miss.
2508 CallFunctionNoFeedback(masm,
2509 arg_count(),
2510 true,
2511 CallAsMethod());
2512
2513 // Unreachable.
2514 __ int3();
2515 }
2516
2517
2518 void CallICStub::Generate(MacroAssembler* masm) { 2466 void CallICStub::Generate(MacroAssembler* masm) {
2519 // edi - function 2467 // edi - function
2520 // edx - slot id 2468 // edx - slot id
2521 Isolate* isolate = masm->isolate(); 2469 Isolate* isolate = masm->isolate();
2522 Label extra_checks_or_miss, slow_start; 2470 Label extra_checks_or_miss, slow_start;
2523 Label slow, non_function, wrap, cont; 2471 Label slow, non_function, wrap, cont;
2524 Label have_js_function; 2472 Label have_js_function;
2525 int argc = state_.arg_count(); 2473 int argc = state_.arg_count();
2526 ParameterCount actual(argc); 2474 ParameterCount actual(argc);
2527 2475
2528 EmitLoadTypeFeedbackVector(masm, ebx); 2476 EmitLoadTypeFeedbackVector(masm, ebx);
2529 2477
2530 if (state_.stub_type() != CallIC::DEFAULT) {
2531 Generate_CustomFeedbackCall(masm);
2532 return;
2533 }
2534
2535 // The checks. First, does edi match the recorded monomorphic target? 2478 // The checks. First, does edi match the recorded monomorphic target?
2536 __ cmp(edi, FieldOperand(ebx, edx, times_half_pointer_size, 2479 __ cmp(edi, FieldOperand(ebx, edx, times_half_pointer_size,
2537 FixedArray::kHeaderSize)); 2480 FixedArray::kHeaderSize));
2538 __ j(not_equal, &extra_checks_or_miss); 2481 __ j(not_equal, &extra_checks_or_miss);
2539 2482
2540 __ bind(&have_js_function); 2483 __ bind(&have_js_function);
2541 if (state_.CallAsMethod()) { 2484 if (state_.CallAsMethod()) {
2542 EmitContinueIfStrictOrNative(masm, &cont); 2485 EmitContinueIfStrictOrNative(masm, &cont);
2543 2486
2544 // Load the receiver from the stack. 2487 // Load the receiver from the stack.
(...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after
5132 Operand(ebp, 7 * kPointerSize), 5075 Operand(ebp, 7 * kPointerSize),
5133 NULL); 5076 NULL);
5134 } 5077 }
5135 5078
5136 5079
5137 #undef __ 5080 #undef __
5138 5081
5139 } } // namespace v8::internal 5082 } } // namespace v8::internal
5140 5083
5141 #endif // V8_TARGET_ARCH_IA32 5084 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698