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

Side by Side Diff: src/mips/code-stubs-mips.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 | « no previous file | src/mips/constants-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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 4827 matching lines...) Expand 10 before | Expand all | Expand 10 after
4838 4838
4839 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 4839 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
4840 return ref0.address() - ref1.address(); 4840 return ref0.address() - ref1.address();
4841 } 4841 }
4842 4842
4843 4843
4844 // Calls an API function. Allocates HandleScope, extracts returned value 4844 // Calls an API function. Allocates HandleScope, extracts returned value
4845 // from handle and propagates exceptions. Restores context. stack_space 4845 // from handle and propagates exceptions. Restores context. stack_space
4846 // - space to be unwound on exit (includes the call JS arguments space and 4846 // - space to be unwound on exit (includes the call JS arguments space and
4847 // the additional space allocated for the fast call). 4847 // the additional space allocated for the fast call).
4848 static void CallApiFunctionAndReturn(MacroAssembler* masm, 4848 static void CallApiFunctionAndReturn(
4849 Register function_address, 4849 MacroAssembler* masm, Register function_address,
4850 ExternalReference thunk_ref, 4850 ExternalReference thunk_ref, int stack_space, int32_t stack_space_offset,
4851 int stack_space, 4851 MemOperand return_value_operand, MemOperand* context_restore_operand) {
4852 MemOperand* stack_space_operand,
4853 MemOperand return_value_operand,
4854 MemOperand* context_restore_operand) {
4855 Isolate* isolate = masm->isolate(); 4852 Isolate* isolate = masm->isolate();
4856 ExternalReference next_address = 4853 ExternalReference next_address =
4857 ExternalReference::handle_scope_next_address(isolate); 4854 ExternalReference::handle_scope_next_address(isolate);
4858 const int kNextOffset = 0; 4855 const int kNextOffset = 0;
4859 const int kLimitOffset = AddressOffset( 4856 const int kLimitOffset = AddressOffset(
4860 ExternalReference::handle_scope_limit_address(isolate), next_address); 4857 ExternalReference::handle_scope_limit_address(isolate), next_address);
4861 const int kLevelOffset = AddressOffset( 4858 const int kLevelOffset = AddressOffset(
4862 ExternalReference::handle_scope_level_address(isolate), next_address); 4859 ExternalReference::handle_scope_level_address(isolate), next_address);
4863 4860
4864 DCHECK(function_address.is(a1) || function_address.is(a2)); 4861 DCHECK(function_address.is(a1) || function_address.is(a2));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4938 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 4935 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
4939 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate))); 4936 __ li(at, Operand(ExternalReference::scheduled_exception_address(isolate)));
4940 __ lw(t1, MemOperand(at)); 4937 __ lw(t1, MemOperand(at));
4941 __ Branch(&promote_scheduled_exception, ne, t0, Operand(t1)); 4938 __ Branch(&promote_scheduled_exception, ne, t0, Operand(t1));
4942 __ bind(&exception_handled); 4939 __ bind(&exception_handled);
4943 4940
4944 bool restore_context = context_restore_operand != NULL; 4941 bool restore_context = context_restore_operand != NULL;
4945 if (restore_context) { 4942 if (restore_context) {
4946 __ lw(cp, *context_restore_operand); 4943 __ lw(cp, *context_restore_operand);
4947 } 4944 }
4948 if (stack_space_operand != NULL) { 4945 if (stack_space_offset != kInvalidStackOffset) {
4949 __ lw(s0, *stack_space_operand); 4946 // ExitFrame contains four MIPS argument slots after DirectCEntryStub call
4947 // so this must be accounted for.
4948 __ lw(s0, MemOperand(sp, stack_space_offset + kCArgsSlotsSize));
4950 } else { 4949 } else {
4951 __ li(s0, Operand(stack_space)); 4950 __ li(s0, Operand(stack_space));
4952 } 4951 }
4953 __ LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN, 4952 __ LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN,
4954 stack_space_operand != NULL); 4953 stack_space_offset != kInvalidStackOffset);
4955 4954
4956 __ bind(&promote_scheduled_exception); 4955 __ bind(&promote_scheduled_exception);
4957 { 4956 {
4958 FrameScope frame(masm, StackFrame::INTERNAL); 4957 FrameScope frame(masm, StackFrame::INTERNAL);
4959 __ CallExternalReference( 4958 __ CallExternalReference(
4960 ExternalReference(Runtime::kPromoteScheduledException, isolate), 0); 4959 ExternalReference(Runtime::kPromoteScheduledException, isolate), 0);
4961 } 4960 }
4962 __ jmp(&exception_handled); 4961 __ jmp(&exception_handled);
4963 4962
4964 // HandleScope limit has changed. Delete allocated extensions. 4963 // HandleScope limit has changed. Delete allocated extensions.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
5075 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5074 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5076 // Stores return the first js argument. 5075 // Stores return the first js argument.
5077 int return_value_offset = 0; 5076 int return_value_offset = 0;
5078 if (return_first_arg) { 5077 if (return_first_arg) {
5079 return_value_offset = 2 + FCA::kArgsLength; 5078 return_value_offset = 2 + FCA::kArgsLength;
5080 } else { 5079 } else {
5081 return_value_offset = 2 + FCA::kReturnValueOffset; 5080 return_value_offset = 2 + FCA::kReturnValueOffset;
5082 } 5081 }
5083 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 5082 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
5084 int stack_space = 0; 5083 int stack_space = 0;
5085 MemOperand is_construct_call_operand = 5084 int32_t stack_space_offset = 4 * kPointerSize;
5086 MemOperand(sp, 4 * kPointerSize + kCArgsSlotsSize);
5087 MemOperand* stack_space_operand = &is_construct_call_operand;
5088 if (argc.is_immediate()) { 5085 if (argc.is_immediate()) {
5089 stack_space = argc.immediate() + FCA::kArgsLength + 1; 5086 stack_space = argc.immediate() + FCA::kArgsLength + 1;
5090 stack_space_operand = NULL; 5087 stack_space_offset = kInvalidStackOffset;
5091 } 5088 }
5092 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 5089 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
5093 stack_space_operand, return_value_operand, 5090 stack_space_offset, return_value_operand,
5094 &context_restore_operand); 5091 &context_restore_operand);
5095 } 5092 }
5096 5093
5097 5094
5098 void CallApiFunctionStub::Generate(MacroAssembler* masm) { 5095 void CallApiFunctionStub::Generate(MacroAssembler* masm) {
5099 bool call_data_undefined = this->call_data_undefined(); 5096 bool call_data_undefined = this->call_data_undefined();
5100 CallApiFunctionStubHelper(masm, ParameterCount(a3), false, 5097 CallApiFunctionStubHelper(masm, ParameterCount(a3), false,
5101 call_data_undefined); 5098 call_data_undefined);
5102 } 5099 }
5103 5100
(...skipping 28 matching lines...) Expand all
5132 // Create PropertyAccessorInfo instance on the stack above the exit frame with 5129 // Create PropertyAccessorInfo instance on the stack above the exit frame with
5133 // a1 (internal::Object** args_) as the data. 5130 // a1 (internal::Object** args_) as the data.
5134 __ sw(a1, MemOperand(sp, 1 * kPointerSize)); 5131 __ sw(a1, MemOperand(sp, 1 * kPointerSize));
5135 __ Addu(a1, sp, Operand(1 * kPointerSize)); // a1 = AccessorInfo& 5132 __ Addu(a1, sp, Operand(1 * kPointerSize)); // a1 = AccessorInfo&
5136 5133
5137 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5134 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5138 5135
5139 ExternalReference thunk_ref = 5136 ExternalReference thunk_ref =
5140 ExternalReference::invoke_accessor_getter_callback(isolate()); 5137 ExternalReference::invoke_accessor_getter_callback(isolate());
5141 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5138 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5142 kStackUnwindSpace, NULL, 5139 kStackUnwindSpace, kInvalidStackOffset,
5143 MemOperand(fp, 6 * kPointerSize), NULL); 5140 MemOperand(fp, 6 * kPointerSize), NULL);
5144 } 5141 }
5145 5142
5146 5143
5147 #undef __ 5144 #undef __
5148 5145
5149 } } // namespace v8::internal 5146 } } // namespace v8::internal
5150 5147
5151 #endif // V8_TARGET_ARCH_MIPS 5148 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/constants-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698