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

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

Issue 867183003: MIPS: Refactoring after 'MIPS: split api call stubs into accessor and function call stubs'. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo Created 5 years, 11 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/mips/constants-mips.h ('k') | src/mips64/constants-mips64.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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 4869 matching lines...) Expand 10 before | Expand all | Expand 10 after
4880 int64_t offset = (ref0.address() - ref1.address()); 4880 int64_t offset = (ref0.address() - ref1.address());
4881 DCHECK(static_cast<int>(offset) == offset); 4881 DCHECK(static_cast<int>(offset) == offset);
4882 return static_cast<int>(offset); 4882 return static_cast<int>(offset);
4883 } 4883 }
4884 4884
4885 4885
4886 // Calls an API function. Allocates HandleScope, extracts returned value 4886 // Calls an API function. Allocates HandleScope, extracts returned value
4887 // from handle and propagates exceptions. Restores context. stack_space 4887 // from handle and propagates exceptions. Restores context. stack_space
4888 // - space to be unwound on exit (includes the call JS arguments space and 4888 // - space to be unwound on exit (includes the call JS arguments space and
4889 // the additional space allocated for the fast call). 4889 // the additional space allocated for the fast call).
4890 static void CallApiFunctionAndReturn(MacroAssembler* masm, 4890 static void CallApiFunctionAndReturn(
4891 Register function_address, 4891 MacroAssembler* masm, Register function_address,
4892 ExternalReference thunk_ref, 4892 ExternalReference thunk_ref, int stack_space, int32_t stack_space_offset,
4893 int stack_space, 4893 MemOperand return_value_operand, MemOperand* context_restore_operand) {
4894 MemOperand* stack_space_operand,
4895 MemOperand return_value_operand,
4896 MemOperand* context_restore_operand) {
4897 Isolate* isolate = masm->isolate(); 4894 Isolate* isolate = masm->isolate();
4898 ExternalReference next_address = 4895 ExternalReference next_address =
4899 ExternalReference::handle_scope_next_address(isolate); 4896 ExternalReference::handle_scope_next_address(isolate);
4900 const int kNextOffset = 0; 4897 const int kNextOffset = 0;
4901 const int kLimitOffset = AddressOffset( 4898 const int kLimitOffset = AddressOffset(
4902 ExternalReference::handle_scope_limit_address(isolate), next_address); 4899 ExternalReference::handle_scope_limit_address(isolate), next_address);
4903 const int kLevelOffset = AddressOffset( 4900 const int kLevelOffset = AddressOffset(
4904 ExternalReference::handle_scope_level_address(isolate), next_address); 4901 ExternalReference::handle_scope_level_address(isolate), next_address);
4905 4902
4906 DCHECK(function_address.is(a1) || function_address.is(a2)); 4903 DCHECK(function_address.is(a1) || function_address.is(a2));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4980 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 4977 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
4981 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate))); 4978 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate)));
4982 __ ld(a5, MemOperand(at)); 4979 __ ld(a5, MemOperand(at));
4983 __ Branch(&promote_scheduled_exception, ne, a4, Operand(a5)); 4980 __ Branch(&promote_scheduled_exception, ne, a4, Operand(a5));
4984 __ bind(&exception_handled); 4981 __ bind(&exception_handled);
4985 4982
4986 bool restore_context = context_restore_operand != NULL; 4983 bool restore_context = context_restore_operand != NULL;
4987 if (restore_context) { 4984 if (restore_context) {
4988 __ ld(cp, *context_restore_operand); 4985 __ ld(cp, *context_restore_operand);
4989 } 4986 }
4990 if (stack_space_operand != NULL) { 4987 if (stack_space_offset != kInvalidStackOffset) {
4991 __ lw(s0, *stack_space_operand); 4988 DCHECK(kCArgsSlotsSize == 0);
4989 __ ld(s0, MemOperand(sp, stack_space_offset));
4992 } else { 4990 } else {
4993 __ li(s0, Operand(stack_space)); 4991 __ li(s0, Operand(stack_space));
4994 } 4992 }
4995 __ LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN, 4993 __ LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN,
4996 stack_space_operand != NULL); 4994 stack_space_offset != kInvalidStackOffset);
4997 __ bind(&promote_scheduled_exception); 4995 __ bind(&promote_scheduled_exception);
4998 { 4996 {
4999 FrameScope frame(masm, StackFrame::INTERNAL); 4997 FrameScope frame(masm, StackFrame::INTERNAL);
5000 __ CallExternalReference( 4998 __ CallExternalReference(
5001 ExternalReference(Runtime::kPromoteScheduledException, isolate), 0); 4999 ExternalReference(Runtime::kPromoteScheduledException, isolate), 0);
5002 } 5000 }
5003 __ jmp(&exception_handled); 5001 __ jmp(&exception_handled);
5004 5002
5005 // HandleScope limit has changed. Delete allocated extensions. 5003 // HandleScope limit has changed. Delete allocated extensions.
5006 __ bind(&delete_allocated_handles); 5004 __ bind(&delete_allocated_handles);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
5116 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5114 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5117 // Stores return the first js argument. 5115 // Stores return the first js argument.
5118 int return_value_offset = 0; 5116 int return_value_offset = 0;
5119 if (return_first_arg) { 5117 if (return_first_arg) {
5120 return_value_offset = 2 + FCA::kArgsLength; 5118 return_value_offset = 2 + FCA::kArgsLength;
5121 } else { 5119 } else {
5122 return_value_offset = 2 + FCA::kReturnValueOffset; 5120 return_value_offset = 2 + FCA::kReturnValueOffset;
5123 } 5121 }
5124 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 5122 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
5125 int stack_space = 0; 5123 int stack_space = 0;
5126 MemOperand is_construct_call_operand = MemOperand(sp, 4 * kPointerSize); 5124 int32_t stack_space_offset = 4 * kPointerSize;
5127 MemOperand* stack_space_operand = &is_construct_call_operand;
5128 if (argc.is_immediate()) { 5125 if (argc.is_immediate()) {
5129 stack_space = argc.immediate() + FCA::kArgsLength + 1; 5126 stack_space = argc.immediate() + FCA::kArgsLength + 1;
5130 stack_space_operand = NULL; 5127 stack_space_offset = kInvalidStackOffset;
5131 } 5128 }
5132 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 5129 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
5133 stack_space_operand, return_value_operand, 5130 stack_space_offset, return_value_operand,
5134 &context_restore_operand); 5131 &context_restore_operand);
5135 } 5132 }
5136 5133
5137 5134
5138 void CallApiFunctionStub::Generate(MacroAssembler* masm) { 5135 void CallApiFunctionStub::Generate(MacroAssembler* masm) {
5139 bool call_data_undefined = this->call_data_undefined(); 5136 bool call_data_undefined = this->call_data_undefined();
5140 CallApiFunctionStubHelper(masm, ParameterCount(a3), false, 5137 CallApiFunctionStubHelper(masm, ParameterCount(a3), false,
5141 call_data_undefined); 5138 call_data_undefined);
5142 } 5139 }
5143 5140
(...skipping 28 matching lines...) Expand all
5172 // Create PropertyAccessorInfo instance on the stack above the exit frame with 5169 // Create PropertyAccessorInfo instance on the stack above the exit frame with
5173 // a1 (internal::Object** args_) as the data. 5170 // a1 (internal::Object** args_) as the data.
5174 __ sd(a1, MemOperand(sp, 1 * kPointerSize)); 5171 __ sd(a1, MemOperand(sp, 1 * kPointerSize));
5175 __ Daddu(a1, sp, Operand(1 * kPointerSize)); // a1 = AccessorInfo& 5172 __ Daddu(a1, sp, Operand(1 * kPointerSize)); // a1 = AccessorInfo&
5176 5173
5177 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5174 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5178 5175
5179 ExternalReference thunk_ref = 5176 ExternalReference thunk_ref =
5180 ExternalReference::invoke_accessor_getter_callback(isolate()); 5177 ExternalReference::invoke_accessor_getter_callback(isolate());
5181 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5178 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5182 kStackUnwindSpace, NULL, 5179 kStackUnwindSpace, kInvalidStackOffset,
5183 MemOperand(fp, 6 * kPointerSize), NULL); 5180 MemOperand(fp, 6 * kPointerSize), NULL);
5184 } 5181 }
5185 5182
5186 5183
5187 #undef __ 5184 #undef __
5188 5185
5189 } } // namespace v8::internal 5186 } } // namespace v8::internal
5190 5187
5191 #endif // V8_TARGET_ARCH_MIPS64 5188 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/constants-mips.h ('k') | src/mips64/constants-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698