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

Unified Diff: test/cctest/compiler/c-signature.h

Issue 1146173005: [test] Refactor call-tester to use c-signature.h. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/compiler/call-tester.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/c-signature.h
diff --git a/test/cctest/compiler/c-signature.h b/test/cctest/compiler/c-signature.h
index fee8cb946d05fc0e3e6e36b0c581a13af66b5cc3..83b3328a3b4e256274f7a2c898fee26d42825dd7 100644
--- a/test/cctest/compiler/c-signature.h
+++ b/test/cctest/compiler/c-signature.h
@@ -53,21 +53,50 @@ class CSignature : public MachineSignature {
public:
template <typename P1 = void, typename P2 = void, typename P3 = void,
typename P4 = void, typename P5 = void>
- void Verify() {
+ void VerifyParams() {
// Verifies the C signature against the machine types. Maximum {5} params.
- CHECK_LT(parameter_count(), 6);
+ CHECK_LT(parameter_count(), 6u);
const int kMax = 5;
MachineType params[] = {MachineTypeForC<P1>(), MachineTypeForC<P2>(),
MachineTypeForC<P3>(), MachineTypeForC<P4>(),
MachineTypeForC<P5>()};
for (int p = kMax - 1; p >= 0; p--) {
- if (p < parameter_count()) {
+ if (p < static_cast<int>(parameter_count())) {
CHECK_EQ(GetParam(p), params[p]);
} else {
CHECK_EQ(kMachNone, params[p]);
}
}
}
+
+ static CSignature* New(Zone* zone, MachineType ret,
+ MachineType p1 = kMachNone, MachineType p2 = kMachNone,
+ MachineType p3 = kMachNone, MachineType p4 = kMachNone,
+ MachineType p5 = kMachNone) {
+ MachineType* buffer = zone->NewArray<MachineType>(6);
+ int pos = 0;
+ size_t return_count = 0;
+ if (ret != kMachNone) {
+ buffer[pos++] = ret;
+ return_count++;
+ }
+ buffer[pos++] = p1;
+ buffer[pos++] = p2;
+ buffer[pos++] = p3;
+ buffer[pos++] = p4;
+ buffer[pos++] = p5;
+ size_t param_count = 5;
+ if (p5 == kMachNone) param_count--;
+ if (p4 == kMachNone) param_count--;
+ if (p3 == kMachNone) param_count--;
+ if (p2 == kMachNone) param_count--;
+ if (p1 == kMachNone) param_count--;
+ for (size_t i = 0; i < param_count; i++) {
+ // Check that there are no kMachNone's in the middle of parameters.
+ CHECK_NE(kMachNone, buffer[return_count + i]);
+ }
+ return new (zone) CSignature(return_count, param_count, buffer);
+ }
};
« no previous file with comments | « no previous file | test/cctest/compiler/call-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698