From 162a40c066888ca07d559904256fdb7554abc6d9 Mon Sep 17 00:00:00 2001 From: Jacob Bramley Date: Thu, 13 Aug 2009 14:53:03 +0100 Subject: [PATCH] Relax the testTableSwitch2 test for non-x86 platforms which don't use ::tableswitch() in jstracer.cpp. (510193, r=jorendorff) --- js/src/jitstats.tbl | 6 ++++++ js/src/jstracer.cpp | 28 ++++++++++++++++++++++++++++ js/src/trace-test.js | 14 ++++++++------ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/js/src/jitstats.tbl b/js/src/jitstats.tbl index c9d0cdc96550..04cce5780d8e 100644 --- a/js/src/jitstats.tbl +++ b/js/src/jitstats.tbl @@ -54,3 +54,9 @@ JITSTAT(returnLoopExits) JITSTAT(mergedLoopExits) JITSTAT(noCompatInnerTrees) JITSTAT(blacklisted) +JITSTAT(archIsIA32) +JITSTAT(archIsAMD64) +JITSTAT(archIs64BIT) +JITSTAT(archIsARM) +JITSTAT(archIsSPARC) +JITSTAT(archIsPPC) diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index fc8c5d85fc2d..f46bf7e0f1fa 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -1704,6 +1704,34 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* _anchor, Fragment* _frag debug_only_printf(LC_TMTracer, "globalObj=%p, shape=%d\n", (void*)this->globalObj, OBJ_SHAPE(this->globalObj)); + + /* Set up jitstats so that trace-test.js can determine which architecture + * we're running on. */ + jitstats.archIsIA32 = 0; + jitstats.archIsAMD64 = 0; + jitstats.archIs64BIT = 0; + jitstats.archIsARM = 0; + jitstats.archIsSPARC = 0; + jitstats.archIsPPC = 0; +#if defined NANOJIT_IA32 + jitstats.archIsIA32 = 1; +#endif +#if defined NANOJIT_ARM64 + jitstats.archIsAMD64 = 1; +#endif +#if defined NANOJIT_64BIT + jitstats.archIs64BIT = 1; +#endif +#if defined NANOJIT_ARM + jitstats.archIsARM = 1; +#endif +#if defined NANOJIT_SPARC + jitstats.archIsSPARC = 1; +#endif +#if defined NANOJIT_PPC + jitstats.archIsPPC = 1; +#endif + #endif lir = lir_buf_writer = new (&gc) LirBufWriter(lirbuf); diff --git a/js/src/trace-test.js b/js/src/trace-test.js index 7e5eb747fa84..e31e90ddb94d 100644 --- a/js/src/trace-test.js +++ b/js/src/trace-test.js @@ -4410,12 +4410,14 @@ function testTableSwitch2() { } assertEq(s, arr.join("")); } -testTableSwitch2.jitstats = { - recorderStarted: 1, - sideExitIntoInterpreter: 4, - recorderAborted: 0, - traceCompleted: 3 -}; +if (jitstats.archIsIA32) { + testTableSwitch2.jitstats = { + recorderStarted: 1, + sideExitIntoInterpreter: 4, + recorderAborted: 0, + traceCompleted: 3 + }; +} test(testTableSwitch2); function testGeneratorDeepBail() {