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

Side by Side Diff: test/cctest/compiler/call-tester.h

Issue 1005123002: MIPS64: Unify and improve Word32 compares to use same instructions as Word64 compares. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_CCTEST_COMPILER_CALL_TESTER_H_ 5 #ifndef V8_CCTEST_COMPILER_CALL_TESTER_H_
6 #define V8_CCTEST_COMPILER_CALL_TESTER_H_ 6 #define V8_CCTEST_COMPILER_CALL_TESTER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/simulator.h" 10 #include "src/simulator.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 template <> 121 template <>
122 struct ParameterTraits<int*> { 122 struct ParameterTraits<int*> {
123 static uintptr_t Cast(int* r) { return reinterpret_cast<uintptr_t>(r); } 123 static uintptr_t Cast(int* r) { return reinterpret_cast<uintptr_t>(r); }
124 }; 124 };
125 125
126 template <typename T> 126 template <typename T>
127 struct ParameterTraits<T*> { 127 struct ParameterTraits<T*> {
128 static uintptr_t Cast(void* r) { return reinterpret_cast<uintptr_t>(r); } 128 static uintptr_t Cast(void* r) { return reinterpret_cast<uintptr_t>(r); }
129 }; 129 };
130 130
131 #if V8_TARGET_ARCH_MIPS64
titzer 2015/03/24 14:37:22 This should be good enough for all architectures,
dusmil.imgtec 2015/03/24 18:41:12 Yes, after all this only concerns simulated archit
titzer 2015/03/24 18:43:33 If you remove the ifdef and it works on all platfo
132 // Additional template specialization required for mips64 to sign-extend
133 // parameters defined by calling convention.
134 template <>
135 struct ParameterTraits<int32_t> {
136 static int64_t Cast(int32_t r) { return static_cast<int64_t>(r); }
137 };
138
139 template <>
140 struct ParameterTraits<uint32_t> {
141 static int64_t Cast(uint32_t r) {
142 return static_cast<int64_t>(static_cast<int32_t>(r));
143 }
144 };
145 #endif
146
131 class CallHelper { 147 class CallHelper {
132 public: 148 public:
133 explicit CallHelper(Isolate* isolate, MachineSignature* machine_sig) 149 explicit CallHelper(Isolate* isolate, MachineSignature* machine_sig)
134 : machine_sig_(machine_sig), isolate_(isolate) { 150 : machine_sig_(machine_sig), isolate_(isolate) {
135 USE(isolate_); 151 USE(isolate_);
136 } 152 }
137 virtual ~CallHelper() {} 153 virtual ~CallHelper() {}
138 154
139 static MachineSignature* MakeMachineSignature( 155 static MachineSignature* MakeMachineSignature(
140 Zone* zone, MachineType return_type, MachineType p0 = kMachNone, 156 Zone* zone, MachineType return_type, MachineType p0 = kMachNone,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 Simulator::CallArgument::End()}; 223 Simulator::CallArgument::End()};
208 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f), args)); 224 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f), args));
209 } 225 }
210 #elif USE_SIMULATOR && (V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64) 226 #elif USE_SIMULATOR && (V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64)
211 uintptr_t CallSimulator(byte* f, int64_t p1 = 0, int64_t p2 = 0, 227 uintptr_t CallSimulator(byte* f, int64_t p1 = 0, int64_t p2 = 0,
212 int64_t p3 = 0, int64_t p4 = 0) { 228 int64_t p3 = 0, int64_t p4 = 0) {
213 Simulator* simulator = Simulator::current(isolate_); 229 Simulator* simulator = Simulator::current(isolate_);
214 return static_cast<uintptr_t>(simulator->Call(f, 4, p1, p2, p3, p4)); 230 return static_cast<uintptr_t>(simulator->Call(f, 4, p1, p2, p3, p4));
215 } 231 }
216 232
233
217 template <typename R, typename F> 234 template <typename R, typename F>
218 R DoCall(F* f) { 235 R DoCall(F* f) {
219 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f))); 236 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f)));
220 } 237 }
221 template <typename R, typename F, typename P1> 238 template <typename R, typename F, typename P1>
222 R DoCall(F* f, P1 p1) { 239 R DoCall(F* f, P1 p1) {
223 return ReturnValueTraits<R>::Cast( 240 return ReturnValueTraits<R>::Cast(
224 CallSimulator(FUNCTION_ADDR(f), ParameterTraits<P1>::Cast(p1))); 241 CallSimulator(FUNCTION_ADDR(f), ParameterTraits<P1>::Cast(p1)));
225 } 242 }
226 template <typename R, typename F, typename P1, typename P2> 243 template <typename R, typename F, typename P1, typename P2>
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 438
422 private: 439 private:
423 CallHelper* helper() { return static_cast<C*>(this); } 440 CallHelper* helper() { return static_cast<C*>(this); }
424 }; 441 };
425 442
426 } // namespace compiler 443 } // namespace compiler
427 } // namespace internal 444 } // namespace internal
428 } // namespace v8 445 } // namespace v8
429 446
430 #endif // V8_CCTEST_COMPILER_CALL_TESTER_H_ 447 #endif // V8_CCTEST_COMPILER_CALL_TESTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698