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

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

Issue 1328963004: Revert of [builtins] Unify the various versions of [[Call]] with a Call builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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/arm/builtins-arm.cc ('k') | src/arm/macro-assembler-arm.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 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 __ tst(r4, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + 2388 __ tst(r4, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
2389 kSmiTagSize))); 2389 kSmiTagSize)));
2390 __ b(ne, cont); 2390 __ b(ne, cont);
2391 2391
2392 // Do not transform the receiver for native (Compilerhints already in r3). 2392 // Do not transform the receiver for native (Compilerhints already in r3).
2393 __ tst(r4, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); 2393 __ tst(r4, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
2394 __ b(ne, cont); 2394 __ b(ne, cont);
2395 } 2395 }
2396 2396
2397 2397
2398 static void EmitSlowCase(MacroAssembler* masm, int argc) { 2398 static void EmitSlowCase(MacroAssembler* masm,
2399 __ mov(r0, Operand(argc)); 2399 int argc,
2400 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 2400 Label* non_function) {
2401 // Check for function proxy.
2402 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE));
2403 __ b(ne, non_function);
2404 __ push(r1); // put proxy as additional argument
2405 __ mov(r0, Operand(argc + 1, RelocInfo::NONE32));
2406 __ mov(r2, Operand::Zero());
2407 __ GetBuiltinFunction(r1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX);
2408 {
2409 Handle<Code> adaptor =
2410 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
2411 __ Jump(adaptor, RelocInfo::CODE_TARGET);
2412 }
2413
2414 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
2415 // of the original receiver from the call site).
2416 __ bind(non_function);
2417 __ str(r1, MemOperand(sp, argc * kPointerSize));
2418 __ mov(r0, Operand(argc)); // Set up the number of arguments.
2419 __ mov(r2, Operand::Zero());
2420 __ GetBuiltinFunction(r1, Context::CALL_NON_FUNCTION_BUILTIN_INDEX);
2421 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
2422 RelocInfo::CODE_TARGET);
2401 } 2423 }
2402 2424
2403 2425
2404 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { 2426 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) {
2405 // Wrap the receiver and patch it back onto the stack. 2427 // Wrap the receiver and patch it back onto the stack.
2406 { FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); 2428 { FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL);
2407 __ push(r1); 2429 __ push(r1);
2408 __ mov(r0, r3); 2430 __ mov(r0, r3);
2409 ToObjectStub stub(masm->isolate()); 2431 ToObjectStub stub(masm->isolate());
2410 __ CallStub(&stub); 2432 __ CallStub(&stub);
2411 __ pop(r1); 2433 __ pop(r1);
2412 } 2434 }
2413 __ str(r0, MemOperand(sp, argc * kPointerSize)); 2435 __ str(r0, MemOperand(sp, argc * kPointerSize));
2414 __ jmp(cont); 2436 __ jmp(cont);
2415 } 2437 }
2416 2438
2417 2439
2418 static void CallFunctionNoFeedback(MacroAssembler* masm, 2440 static void CallFunctionNoFeedback(MacroAssembler* masm,
2419 int argc, bool needs_checks, 2441 int argc, bool needs_checks,
2420 bool call_as_method) { 2442 bool call_as_method) {
2421 // r1 : the function to call 2443 // r1 : the function to call
2422 Label slow, wrap, cont; 2444 Label slow, non_function, wrap, cont;
2423 2445
2424 if (needs_checks) { 2446 if (needs_checks) {
2425 // Check that the function is really a JavaScript function. 2447 // Check that the function is really a JavaScript function.
2426 // r1: pushed function (to be verified) 2448 // r1: pushed function (to be verified)
2427 __ JumpIfSmi(r1, &slow); 2449 __ JumpIfSmi(r1, &non_function);
2428 2450
2429 // Goto slow case if we do not have a function. 2451 // Goto slow case if we do not have a function.
2430 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); 2452 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE);
2431 __ b(ne, &slow); 2453 __ b(ne, &slow);
2432 } 2454 }
2433 2455
2434 // Fast-case: Invoke the function now. 2456 // Fast-case: Invoke the function now.
2435 // r1: pushed function 2457 // r1: pushed function
2436 ParameterCount actual(argc); 2458 ParameterCount actual(argc);
2437 2459
(...skipping 14 matching lines...) Expand all
2452 } 2474 }
2453 2475
2454 __ bind(&cont); 2476 __ bind(&cont);
2455 } 2477 }
2456 2478
2457 __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper()); 2479 __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper());
2458 2480
2459 if (needs_checks) { 2481 if (needs_checks) {
2460 // Slow-case: Non-function called. 2482 // Slow-case: Non-function called.
2461 __ bind(&slow); 2483 __ bind(&slow);
2462 EmitSlowCase(masm, argc); 2484 EmitSlowCase(masm, argc, &non_function);
2463 } 2485 }
2464 2486
2465 if (call_as_method) { 2487 if (call_as_method) {
2466 __ bind(&wrap); 2488 __ bind(&wrap);
2467 EmitWrapCase(masm, argc, &cont); 2489 EmitWrapCase(masm, argc, &cont);
2468 } 2490 }
2469 } 2491 }
2470 2492
2471 2493
2472 void CallFunctionStub::Generate(MacroAssembler* masm) { 2494 void CallFunctionStub::Generate(MacroAssembler* masm) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 2608
2587 __ mov(r2, r4); 2609 __ mov(r2, r4);
2588 __ mov(r3, r1); 2610 __ mov(r3, r1);
2589 ArrayConstructorStub stub(masm->isolate(), arg_count()); 2611 ArrayConstructorStub stub(masm->isolate(), arg_count());
2590 __ TailCallStub(&stub); 2612 __ TailCallStub(&stub);
2591 2613
2592 __ bind(&miss); 2614 __ bind(&miss);
2593 GenerateMiss(masm); 2615 GenerateMiss(masm);
2594 2616
2595 // The slow case, we need this no matter what to complete a call after a miss. 2617 // The slow case, we need this no matter what to complete a call after a miss.
2596 __ mov(r0, Operand(arg_count())); 2618 CallFunctionNoFeedback(masm,
2597 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 2619 arg_count(),
2620 true,
2621 CallAsMethod());
2622
2623 // Unreachable.
2624 __ stop("Unexpected code address");
2598 } 2625 }
2599 2626
2600 2627
2601 void CallICStub::Generate(MacroAssembler* masm) { 2628 void CallICStub::Generate(MacroAssembler* masm) {
2602 // r1 - function 2629 // r1 - function
2603 // r3 - slot id (Smi) 2630 // r3 - slot id (Smi)
2604 // r2 - vector 2631 // r2 - vector
2605 const int with_types_offset = 2632 const int with_types_offset =
2606 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); 2633 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
2607 const int generic_offset = 2634 const int generic_offset =
2608 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); 2635 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
2609 Label extra_checks_or_miss, slow_start; 2636 Label extra_checks_or_miss, slow_start;
2610 Label slow, wrap, cont; 2637 Label slow, non_function, wrap, cont;
2611 Label have_js_function; 2638 Label have_js_function;
2612 int argc = arg_count(); 2639 int argc = arg_count();
2613 ParameterCount actual(argc); 2640 ParameterCount actual(argc);
2614 2641
2615 // The checks. First, does r1 match the recorded monomorphic target? 2642 // The checks. First, does r1 match the recorded monomorphic target?
2616 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 2643 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
2617 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); 2644 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize));
2618 2645
2619 // We don't know that we have a weak cell. We might have a private symbol 2646 // We don't know that we have a weak cell. We might have a private symbol
2620 // or an AllocationSite, but the memory is safe to examine. 2647 // or an AllocationSite, but the memory is safe to examine.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 __ JumpIfSmi(r3, &wrap); 2681 __ JumpIfSmi(r3, &wrap);
2655 __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE); 2682 __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE);
2656 __ b(lt, &wrap); 2683 __ b(lt, &wrap);
2657 2684
2658 __ bind(&cont); 2685 __ bind(&cont);
2659 } 2686 }
2660 2687
2661 __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper()); 2688 __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper());
2662 2689
2663 __ bind(&slow); 2690 __ bind(&slow);
2664 EmitSlowCase(masm, argc); 2691 EmitSlowCase(masm, argc, &non_function);
2665 2692
2666 if (CallAsMethod()) { 2693 if (CallAsMethod()) {
2667 __ bind(&wrap); 2694 __ bind(&wrap);
2668 EmitWrapCase(masm, argc, &cont); 2695 EmitWrapCase(masm, argc, &cont);
2669 } 2696 }
2670 2697
2671 __ bind(&extra_checks_or_miss); 2698 __ bind(&extra_checks_or_miss);
2672 Label uninitialized, miss; 2699 Label uninitialized, miss;
2673 2700
2674 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex); 2701 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 2768
2742 // We are here because tracing is on or we encountered a MISS case we can't 2769 // We are here because tracing is on or we encountered a MISS case we can't
2743 // handle here. 2770 // handle here.
2744 __ bind(&miss); 2771 __ bind(&miss);
2745 GenerateMiss(masm); 2772 GenerateMiss(masm);
2746 2773
2747 // the slow case 2774 // the slow case
2748 __ bind(&slow_start); 2775 __ bind(&slow_start);
2749 // Check that the function is really a JavaScript function. 2776 // Check that the function is really a JavaScript function.
2750 // r1: pushed function (to be verified) 2777 // r1: pushed function (to be verified)
2751 __ JumpIfSmi(r1, &slow); 2778 __ JumpIfSmi(r1, &non_function);
2752 2779
2753 // Goto slow case if we do not have a function. 2780 // Goto slow case if we do not have a function.
2754 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); 2781 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE);
2755 __ b(ne, &slow); 2782 __ b(ne, &slow);
2756 __ jmp(&have_js_function); 2783 __ jmp(&have_js_function);
2757 } 2784 }
2758 2785
2759 2786
2760 void CallICStub::GenerateMiss(MacroAssembler* masm) { 2787 void CallICStub::GenerateMiss(MacroAssembler* masm) {
2761 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 2788 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
(...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after
5564 MemOperand(fp, 6 * kPointerSize), NULL); 5591 MemOperand(fp, 6 * kPointerSize), NULL);
5565 } 5592 }
5566 5593
5567 5594
5568 #undef __ 5595 #undef __
5569 5596
5570 } // namespace internal 5597 } // namespace internal
5571 } // namespace v8 5598 } // namespace v8
5572 5599
5573 #endif // V8_TARGET_ARCH_ARM 5600 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698