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

Side by Side Diff: src/mips/code-stubs-mips.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/ia32/macro-assembler-ia32.cc ('k') | src/mips/macro-assembler-mips.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 2777 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 } 2788 }
2789 2789
2790 Label fast_elements_case; 2790 Label fast_elements_case;
2791 __ Branch(&fast_elements_case, eq, a3, Operand(FAST_ELEMENTS)); 2791 __ Branch(&fast_elements_case, eq, a3, Operand(FAST_ELEMENTS));
2792 GenerateCase(masm, FAST_HOLEY_ELEMENTS); 2792 GenerateCase(masm, FAST_HOLEY_ELEMENTS);
2793 2793
2794 __ bind(&fast_elements_case); 2794 __ bind(&fast_elements_case);
2795 GenerateCase(masm, FAST_ELEMENTS); 2795 GenerateCase(masm, FAST_ELEMENTS);
2796 } 2796 }
2797 2797
2798 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
2799 return ref0.address() - ref1.address();
2800 }
2801
2802
2803 // Calls an API function. Allocates HandleScope, extracts returned value 2798 // Calls an API function. Allocates HandleScope, extracts returned value
2804 // from handle and propagates exceptions. Restores context. stack_space 2799 // from handle and propagates exceptions. Restores context. stack_space
2805 // - space to be unwound on exit (includes the call JS arguments space and 2800 // - space to be unwound on exit (includes the call JS arguments space and
2806 // the additional space allocated for the fast call). 2801 // the additional space allocated for the fast call).
2807 static void CallApiFunctionAndReturn( 2802 static void CallApiFunctionAndReturn(
2808 MacroAssembler* masm, Register function_address, 2803 MacroAssembler* masm, Register function_address,
2809 ExternalReference thunk_ref, int stack_space, int32_t stack_space_offset, 2804 ExternalReference thunk_ref, int stack_space, int32_t stack_space_offset,
2810 MemOperand return_value_operand, MemOperand* context_restore_operand) { 2805 MemOperand return_value_operand, MemOperand* context_restore_operand) {
2811 Isolate* isolate = masm->isolate(); 2806 Isolate* isolate = masm->isolate();
2812 ExternalReference next_address = 2807 ExternalReference next_address =
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2904 } 2899 }
2905 __ LeaveExitFrame(false, s0, !restore_context, NO_EMIT_RETURN, 2900 __ LeaveExitFrame(false, s0, !restore_context, NO_EMIT_RETURN,
2906 stack_space_offset != kInvalidStackOffset); 2901 stack_space_offset != kInvalidStackOffset);
2907 2902
2908 // Check if the function scheduled an exception. 2903 // Check if the function scheduled an exception.
2909 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2904 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2910 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate))); 2905 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate)));
2911 __ lw(t1, MemOperand(at)); 2906 __ lw(t1, MemOperand(at));
2912 __ Branch(&promote_scheduled_exception, ne, t0, Operand(t1)); 2907 __ Branch(&promote_scheduled_exception, ne, t0, Operand(t1));
2913 2908
2909 // Check if the function returned a valid JavaScript value.
2910 __ AssertApiCallResult(v0);
2911
2914 __ Ret(); 2912 __ Ret();
2915 2913
2916 // Re-throw by promoting a scheduled exception. 2914 // Re-throw by promoting a scheduled exception.
2917 __ bind(&promote_scheduled_exception); 2915 __ bind(&promote_scheduled_exception);
2918 __ TailCallRuntime(Runtime::kPromoteScheduledException); 2916 __ TailCallRuntime(Runtime::kPromoteScheduledException);
2919 2917
2920 // HandleScope limit has changed. Delete allocated extensions. 2918 // HandleScope limit has changed. Delete allocated extensions.
2921 __ bind(&delete_allocated_handles); 2919 __ bind(&delete_allocated_handles);
2922 __ sw(s1, MemOperand(s3, kLimitOffset)); 2920 __ sw(s1, MemOperand(s3, kLimitOffset));
2923 __ mov(s0, v0); 2921 __ mov(s0, v0);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2973 } 2971 }
2974 2972
2975 Register scratch = call_data; 2973 Register scratch = call_data;
2976 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 2974 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2977 // Push return value and default return value. 2975 // Push return value and default return value.
2978 __ Push(scratch, scratch); 2976 __ Push(scratch, scratch);
2979 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); 2977 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
2980 // Push isolate and holder. 2978 // Push isolate and holder.
2981 __ Push(scratch, holder); 2979 __ Push(scratch, holder);
2982 2980
2981 if (!is_store()) {
2982 __ li(a0, Operand(argc()));
2983 __ Jump(masm->isolate()->builtins()->CallFunctionCallback(),
2984 RelocInfo::CODE_TARGET);
2985 }
2986
2983 // Prepare arguments. 2987 // Prepare arguments.
2984 __ mov(scratch, sp); 2988 __ mov(scratch, sp);
2985 2989
2986 // Allocate the v8::Arguments structure in the arguments' space since 2990 // Allocate the v8::Arguments structure in the arguments' space since
2987 // it's not controlled by GC. 2991 // it's not controlled by GC.
2988 const int kApiStackSpace = 3; 2992 const int kApiStackSpace = 3;
2989 2993
2990 FrameScope frame_scope(masm, StackFrame::MANUAL); 2994 FrameScope frame_scope(masm, StackFrame::MANUAL);
2991 __ EnterExitFrame(false, kApiStackSpace); 2995 __ EnterExitFrame(false, kApiStackSpace);
2992 2996
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3098 kStackUnwindSpace, kInvalidStackOffset, 3102 kStackUnwindSpace, kInvalidStackOffset,
3099 return_value_operand, NULL); 3103 return_value_operand, NULL);
3100 } 3104 }
3101 3105
3102 #undef __ 3106 #undef __
3103 3107
3104 } // namespace internal 3108 } // namespace internal
3105 } // namespace v8 3109 } // namespace v8
3106 3110
3107 #endif // V8_TARGET_ARCH_MIPS 3111 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698