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

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

Issue 2841913003: [WIP] Initial CallFunctionCallback builtin.
Patch Set: Fix wrong register for arm64. Created 3 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
« no previous file with comments | « src/builtins/x64/builtins-x64.cc ('k') | src/ia32/macro-assembler-ia32.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_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 } 2663 }
2664 __ LeaveApiExitFrame(!restore_context); 2664 __ LeaveApiExitFrame(!restore_context);
2665 2665
2666 // Check if the function scheduled an exception. 2666 // Check if the function scheduled an exception.
2667 ExternalReference scheduled_exception_address = 2667 ExternalReference scheduled_exception_address =
2668 ExternalReference::scheduled_exception_address(isolate); 2668 ExternalReference::scheduled_exception_address(isolate);
2669 __ cmp(Operand::StaticVariable(scheduled_exception_address), 2669 __ cmp(Operand::StaticVariable(scheduled_exception_address),
2670 Immediate(isolate->factory()->the_hole_value())); 2670 Immediate(isolate->factory()->the_hole_value()));
2671 __ j(not_equal, &promote_scheduled_exception); 2671 __ j(not_equal, &promote_scheduled_exception);
2672 2672
2673 #if DEBUG
2674 // Check if the function returned a valid JavaScript value. 2673 // Check if the function returned a valid JavaScript value.
2675 Label ok; 2674 __ AssertApiCallResult(eax);
2676 Register return_value = eax;
2677 Register map = ecx;
2678
2679 __ JumpIfSmi(return_value, &ok, Label::kNear);
2680 __ mov(map, FieldOperand(return_value, HeapObject::kMapOffset));
2681
2682 __ CmpInstanceType(map, LAST_NAME_TYPE);
2683 __ j(below_equal, &ok, Label::kNear);
2684
2685 __ CmpInstanceType(map, FIRST_JS_RECEIVER_TYPE);
2686 __ j(above_equal, &ok, Label::kNear);
2687
2688 __ cmp(map, isolate->factory()->heap_number_map());
2689 __ j(equal, &ok, Label::kNear);
2690
2691 __ cmp(return_value, isolate->factory()->undefined_value());
2692 __ j(equal, &ok, Label::kNear);
2693
2694 __ cmp(return_value, isolate->factory()->true_value());
2695 __ j(equal, &ok, Label::kNear);
2696
2697 __ cmp(return_value, isolate->factory()->false_value());
2698 __ j(equal, &ok, Label::kNear);
2699
2700 __ cmp(return_value, isolate->factory()->null_value());
2701 __ j(equal, &ok, Label::kNear);
2702
2703 __ Abort(kAPICallReturnedInvalidObject);
2704
2705 __ bind(&ok);
2706 #endif
2707 2675
2708 if (stack_space_operand != nullptr) { 2676 if (stack_space_operand != nullptr) {
2709 DCHECK_EQ(0, stack_space); 2677 DCHECK_EQ(0, stack_space);
2710 __ pop(ecx); 2678 __ pop(ecx);
2711 __ add(esp, ebx); 2679 __ add(esp, ebx);
2712 __ jmp(ecx); 2680 __ jmp(ecx);
2713 } else { 2681 } else {
2714 __ ret(stack_space * kPointerSize); 2682 __ ret(stack_space * kPointerSize);
2715 } 2683 }
2716 2684
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 __ mov(scratch, esp); 2761 __ mov(scratch, esp);
2794 2762
2795 // push return address 2763 // push return address
2796 __ push(return_address); 2764 __ push(return_address);
2797 2765
2798 if (!is_lazy()) { 2766 if (!is_lazy()) {
2799 // load context from callee 2767 // load context from callee
2800 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); 2768 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset));
2801 } 2769 }
2802 2770
2771 if (!this->is_store()) {
2772 __ mov(eax, Immediate(this->argc()));
2773 __ Jump(masm->isolate()->builtins()->CallFunctionCallback(),
2774 RelocInfo::CODE_TARGET);
2775 }
2776
2803 // API function gets reference to the v8::Arguments. If CPU profiler 2777 // API function gets reference to the v8::Arguments. If CPU profiler
2804 // is enabled wrapper function will be called and we need to pass 2778 // is enabled wrapper function will be called and we need to pass
2805 // address of the callback as additional parameter, always allocate 2779 // address of the callback as additional parameter, always allocate
2806 // space for it. 2780 // space for it.
2807 const int kApiArgc = 1 + 1; 2781 const int kApiArgc = 1 + 1;
2808 2782
2809 // Allocate the v8::Arguments structure in the arguments' space since 2783 // Allocate the v8::Arguments structure in the arguments' space since
2810 // it's not controlled by GC. 2784 // it's not controlled by GC.
2811 const int kApiStackSpace = 3; 2785 const int kApiStackSpace = 3;
2812 2786
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2919 kStackUnwindSpace, nullptr, return_value_operand, 2893 kStackUnwindSpace, nullptr, return_value_operand,
2920 NULL); 2894 NULL);
2921 } 2895 }
2922 2896
2923 #undef __ 2897 #undef __
2924 2898
2925 } // namespace internal 2899 } // namespace internal
2926 } // namespace v8 2900 } // namespace v8
2927 2901
2928 #endif // V8_TARGET_ARCH_IA32 2902 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/builtins/x64/builtins-x64.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698