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

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

Issue 1576093004: [Interpreter] Add ForInPrepare runtime function which returns a ObjectTriple. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add MIPS port Created 4 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/simulator-mips.cc ('k') | src/mips64/macro-assembler-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 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 __ EnterExitFrame(save_doubles()); 1083 __ EnterExitFrame(save_doubles());
1084 1084
1085 // s0: number of arguments including receiver (C callee-saved) 1085 // s0: number of arguments including receiver (C callee-saved)
1086 // s1: pointer to first argument (C callee-saved) 1086 // s1: pointer to first argument (C callee-saved)
1087 // s2: pointer to builtin function (C callee-saved) 1087 // s2: pointer to builtin function (C callee-saved)
1088 1088
1089 // Prepare arguments for C routine. 1089 // Prepare arguments for C routine.
1090 // a0 = argc 1090 // a0 = argc
1091 __ mov(s0, a0); 1091 __ mov(s0, a0);
1092 __ mov(s2, a1); 1092 __ mov(s2, a1);
1093 // a1 = argv (set in the delay slot after find_ra below).
1094 1093
1095 // We are calling compiled C/C++ code. a0 and a1 hold our two arguments. We 1094 // We are calling compiled C/C++ code. a0 and a1 hold our two arguments. We
1096 // also need to reserve the 4 argument slots on the stack. 1095 // also need to reserve the 4 argument slots on the stack.
1097 1096
1098 __ AssertStackIsAligned(); 1097 __ AssertStackIsAligned();
1099 1098
1100 __ li(a2, Operand(ExternalReference::isolate_address(isolate()))); 1099 int frame_alignment = MacroAssembler::ActivationFrameAlignment();
1100 int frame_alignment_mask = frame_alignment - 1;
1101 int result_stack_size;
1102 if (result_size() <= 2) {
1103 // a0 = argc, a1 = argv, a2 = isolate
1104 __ li(a2, Operand(ExternalReference::isolate_address(isolate())));
1105 __ mov(a1, s1);
1106 result_stack_size = 0;
1107 } else {
1108 DCHECK_EQ(3, result_size());
1109 // Allocate additional space for the result.
1110 result_stack_size =
1111 ((result_size() * kPointerSize) + frame_alignment_mask) &
1112 ~frame_alignment_mask;
1113 __ Dsubu(sp, sp, Operand(result_stack_size));
1114
1115 // a0 = hidden result argument, a1 = argc, a2 = argv, a3 = isolate.
1116 __ li(a3, Operand(ExternalReference::isolate_address(isolate())));
1117 __ mov(a2, s1);
1118 __ mov(a1, a0);
1119 __ mov(a0, sp);
1120 }
1101 1121
1102 // To let the GC traverse the return address of the exit frames, we need to 1122 // To let the GC traverse the return address of the exit frames, we need to
1103 // know where the return address is. The CEntryStub is unmovable, so 1123 // know where the return address is. The CEntryStub is unmovable, so
1104 // we can store the address on the stack to be able to find it again and 1124 // we can store the address on the stack to be able to find it again and
1105 // we never have to restore it, because it will not change. 1125 // we never have to restore it, because it will not change.
1106 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); 1126 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
1107 // This branch-and-link sequence is needed to find the current PC on mips, 1127 // This branch-and-link sequence is needed to find the current PC on mips,
1108 // saved to the ra register. 1128 // saved to the ra register.
1109 // Use masm-> here instead of the double-underscore macro since extra 1129 // Use masm-> here instead of the double-underscore macro since extra
1110 // coverage code can interfere with the proper calculation of ra. 1130 // coverage code can interfere with the proper calculation of ra.
1111 Label find_ra; 1131 Label find_ra;
1112 masm->bal(&find_ra); // bal exposes branch delay slot. 1132 __ bal(&find_ra); // bal exposes branch delay slot.
1113 masm->mov(a1, s1); 1133 __ nop();
1114 masm->bind(&find_ra); 1134 __ bind(&find_ra);
1115 1135
1116 // Adjust the value in ra to point to the correct return location, 2nd 1136 // Adjust the value in ra to point to the correct return location, 2nd
1117 // instruction past the real call into C code (the jalr(t9)), and push it. 1137 // instruction past the real call into C code (the jalr(t9)), and push it.
1118 // This is the return address of the exit frame. 1138 // This is the return address of the exit frame.
1119 const int kNumInstructionsToJump = 5; 1139 const int kNumInstructionsToJump = 5;
1120 masm->Daddu(ra, ra, kNumInstructionsToJump * kInt32Size); 1140 __ Daddu(ra, ra, kNumInstructionsToJump * kInt32Size);
1121 masm->sd(ra, MemOperand(sp)); // This spot was reserved in EnterExitFrame. 1141 // This spot was reserved in EnterExitFrame.
1142 __ sd(ra, MemOperand(sp, result_stack_size));
1122 // Stack space reservation moved to the branch delay slot below. 1143 // Stack space reservation moved to the branch delay slot below.
1123 // Stack is still aligned. 1144 // Stack is still aligned.
1124 1145
1125 // Call the C routine. 1146 // Call the C routine.
1126 masm->mov(t9, s2); // Function pointer to t9 to conform to ABI for PIC. 1147 __ mov(t9, s2); // Function pointer to t9 to conform to ABI for PIC.
1127 masm->jalr(t9); 1148 __ jalr(t9);
1128 // Set up sp in the delay slot. 1149 // Set up sp in the delay slot.
1129 masm->daddiu(sp, sp, -kCArgsSlotsSize); 1150 __ daddiu(sp, sp, -kCArgsSlotsSize);
1130 // Make sure the stored 'ra' points to this position. 1151 // Make sure the stored 'ra' points to this position.
1131 DCHECK_EQ(kNumInstructionsToJump, 1152 DCHECK_EQ(kNumInstructionsToJump,
1132 masm->InstructionsGeneratedSince(&find_ra)); 1153 masm->InstructionsGeneratedSince(&find_ra));
1133 } 1154 }
1155 if (result_size() > 2) {
1156 DCHECK_EQ(3, result_size());
1157 // Read result values stored on stack.
1158 __ ld(a0, MemOperand(v0, 2 * kPointerSize));
1159 __ ld(v1, MemOperand(v0, 1 * kPointerSize));
1160 __ ld(v0, MemOperand(v0, 0 * kPointerSize));
1161 }
1162 // Result returned in v0, v1:v0 or a0:v1:v0 - do not destroy these registers!
1134 1163
1135 // Check result for exception sentinel. 1164 // Check result for exception sentinel.
1136 Label exception_returned; 1165 Label exception_returned;
1137 __ LoadRoot(a4, Heap::kExceptionRootIndex); 1166 __ LoadRoot(a4, Heap::kExceptionRootIndex);
1138 __ Branch(&exception_returned, eq, a4, Operand(v0)); 1167 __ Branch(&exception_returned, eq, a4, Operand(v0));
1139 1168
1140 // Check that there is no pending exception, otherwise we 1169 // Check that there is no pending exception, otherwise we
1141 // should have returned the exception sentinel. 1170 // should have returned the exception sentinel.
1142 if (FLAG_debug_code) { 1171 if (FLAG_debug_code) {
1143 Label okay; 1172 Label okay;
(...skipping 4478 matching lines...) Expand 10 before | Expand all | Expand 10 after
5622 MemOperand(fp, 6 * kPointerSize), NULL); 5651 MemOperand(fp, 6 * kPointerSize), NULL);
5623 } 5652 }
5624 5653
5625 5654
5626 #undef __ 5655 #undef __
5627 5656
5628 } // namespace internal 5657 } // namespace internal
5629 } // namespace v8 5658 } // namespace v8
5630 5659
5631 #endif // V8_TARGET_ARCH_MIPS64 5660 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/simulator-mips.cc ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698