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

Side by Side Diff: src/mips64/macro-assembler-mips64.h

Issue 2547033002: MIPS[64]: Fix jump_tables6 test for r6 architectures (Closed)
Patch Set: Address comments Created 4 years 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/mips64/assembler-mips64.h ('k') | test/cctest/test-macro-assembler-mips.cc » ('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 #ifndef V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ 5 #ifndef V8_MIPS_MACRO_ASSEMBLER_MIPS_H_
6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ 6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 #include "src/mips64/assembler-mips64.h" 10 #include "src/mips64/assembler-mips64.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 229 }
230 230
231 bool IsNear(Label* L, Condition cond, int rs_reg); 231 bool IsNear(Label* L, Condition cond, int rs_reg);
232 232
233 void Branch(Label* L, 233 void Branch(Label* L,
234 Condition cond, 234 Condition cond,
235 Register rs, 235 Register rs,
236 Heap::RootListIndex index, 236 Heap::RootListIndex index,
237 BranchDelaySlot bdslot = PROTECT); 237 BranchDelaySlot bdslot = PROTECT);
238 238
239 // Number of instructions needed for calculation of switch table entry address
240 #ifdef _MIPS_ARCH_MIPS64R6
241 static const int kSwitchTablePrologueSize = 6;
242 #else
243 static const int kSwitchTablePrologueSize = 11;
244 #endif
245
239 // GetLabelFunction must be lambda '[](size_t index) -> Label*' or a 246 // GetLabelFunction must be lambda '[](size_t index) -> Label*' or a
240 // functor/function with 'Label *func(size_t index)' declaration. 247 // functor/function with 'Label *func(size_t index)' declaration.
241 template <typename Func> 248 template <typename Func>
242 void GenerateSwitchTable(Register index, size_t case_count, 249 void GenerateSwitchTable(Register index, size_t case_count,
243 Func GetLabelFunction); 250 Func GetLabelFunction);
244 #undef COND_ARGS 251 #undef COND_ARGS
245 252
246 // Emit code that loads |parameter_index|'th parameter from the stack to 253 // Emit code that loads |parameter_index|'th parameter from the stack to
247 // the register according to the CallInterfaceDescriptor definition. 254 // the register according to the CallInterfaceDescriptor definition.
248 // |sp_to_caller_sp_offset_in_words| specifies the number of words pushed 255 // |sp_to_caller_sp_offset_in_words| specifies the number of words pushed
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 MacroAssembler masm_; // Macro assembler used to generate the code. 1962 MacroAssembler masm_; // Macro assembler used to generate the code.
1956 FlushICache flush_cache_; // Whether to flush the I cache after patching. 1963 FlushICache flush_cache_; // Whether to flush the I cache after patching.
1957 }; 1964 };
1958 1965
1959 template <typename Func> 1966 template <typename Func>
1960 void MacroAssembler::GenerateSwitchTable(Register index, size_t case_count, 1967 void MacroAssembler::GenerateSwitchTable(Register index, size_t case_count,
1961 Func GetLabelFunction) { 1968 Func GetLabelFunction) {
1962 // Ensure that dd-ed labels following this instruction use 8 bytes aligned 1969 // Ensure that dd-ed labels following this instruction use 8 bytes aligned
1963 // addresses. 1970 // addresses.
1964 if (kArchVariant >= kMips64r6) { 1971 if (kArchVariant >= kMips64r6) {
1965 BlockTrampolinePoolFor(static_cast<int>(case_count) * 2 + 6); 1972 BlockTrampolinePoolFor(static_cast<int>(case_count) * 2 +
1973 kSwitchTablePrologueSize);
1966 // Opposite of Align(8) as we have odd number of instructions in this case. 1974 // Opposite of Align(8) as we have odd number of instructions in this case.
1967 if ((pc_offset() & 7) == 0) { 1975 if ((pc_offset() & 7) == 0) {
1968 nop(); 1976 nop();
1969 } 1977 }
1970 addiupc(at, 5); 1978 addiupc(at, 5);
1971 Dlsa(at, at, index, kPointerSizeLog2); 1979 Dlsa(at, at, index, kPointerSizeLog2);
1972 ld(at, MemOperand(at)); 1980 ld(at, MemOperand(at));
1973 } else { 1981 } else {
1974 Label here; 1982 Label here;
1975 BlockTrampolinePoolFor(static_cast<int>(case_count) * 2 + 11); 1983 BlockTrampolinePoolFor(static_cast<int>(case_count) * 2 +
1984 kSwitchTablePrologueSize);
1976 Align(8); 1985 Align(8);
1977 push(ra); 1986 push(ra);
1978 bal(&here); 1987 bal(&here);
1979 dsll(at, index, kPointerSizeLog2); // Branch delay slot. 1988 dsll(at, index, kPointerSizeLog2); // Branch delay slot.
1980 bind(&here); 1989 bind(&here);
1981 daddu(at, at, ra); 1990 daddu(at, at, ra);
1982 pop(ra); 1991 pop(ra);
1983 ld(at, MemOperand(at, 6 * v8::internal::Assembler::kInstrSize)); 1992 ld(at, MemOperand(at, 6 * v8::internal::Assembler::kInstrSize));
1984 } 1993 }
1985 jr(at); 1994 jr(at);
1986 nop(); // Branch delay slot nop. 1995 nop(); // Branch delay slot nop.
1987 for (size_t index = 0; index < case_count; ++index) { 1996 for (size_t index = 0; index < case_count; ++index) {
1988 dd(GetLabelFunction(index)); 1997 dd(GetLabelFunction(index));
1989 } 1998 }
1990 } 1999 }
1991 2000
1992 #define ACCESS_MASM(masm) masm-> 2001 #define ACCESS_MASM(masm) masm->
1993 2002
1994 } // namespace internal 2003 } // namespace internal
1995 } // namespace v8 2004 } // namespace v8
1996 2005
1997 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ 2006 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_
OLDNEW
« no previous file with comments | « src/mips64/assembler-mips64.h ('k') | test/cctest/test-macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698