Use __builtin_frame_address instead of setjmp to get the frame pointer. b=323853 r=brendan

git-svn-id: svn://10.0.0.236/trunk@192599 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org
2006-03-19 01:27:17 +00:00
parent e47c93f9d1
commit f92b553d1b
3 changed files with 3 additions and 14 deletions

View File

@@ -2429,8 +2429,6 @@ void GC_save_callers(struct callinfo info[NFRAMES])
#if defined(SAVE_CALL_CHAIN) && defined(LINUX)
#include <setjmp.h>
#include "call_tree.h"
typedef struct stack_frame stack_frame;
@@ -2443,10 +2441,8 @@ struct stack_frame {
static stack_frame* getStackFrame()
{
jmp_buf jb;
stack_frame* currentFrame;
setjmp(jb);
currentFrame = (stack_frame*)(jb[0].__jmpbuf[JB_BP]);
currentFrame = (stack_frame*)__builtin_frame_address(0);
currentFrame = currentFrame->next;
return currentFrame;
}

View File

@@ -66,7 +66,6 @@ JS_PUBLIC_API(void) JS_Assert(const char *s, const char *file, JSIntn ln)
#define __USE_GNU 1
#include <dlfcn.h>
#include <setjmp.h>
#include <string.h>
#include "jshash.h"
#include "jsprf.h"
@@ -170,13 +169,10 @@ CallTree(uint32 *bp)
JSCallsite *
JS_Backtrace(int skip)
{
jmp_buf jb;
uint32 *bp, *bpdown;
setjmp(jb);
/* Stack walking code adapted from Kipp's "leaky". */
bp = (uint32*) jb[0].__jmpbuf[JB_BP];
bp = (uint32*) __builtin_frame_address(0);
while (--skip >= 0) {
bpdown = (uint32*) *bp++;
if (bpdown < bp)

View File

@@ -51,7 +51,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#ifdef XP_UNIX
#include <unistd.h>
#include <sys/stat.h>
@@ -1339,7 +1338,6 @@ backtrace(int skip)
callsite *
backtrace(int skip)
{
jmp_buf jb;
uint32 *bp, *bpdown;
callsite *site, **key;
PLHashNumber hash;
@@ -1348,10 +1346,9 @@ backtrace(int skip)
tmstats.backtrace_calls++;
suppress_tracing++;
setjmp(jb);
/* Stack walking code adapted from Kipp's "leaky". */
bp = (uint32*) jb[0].__jmpbuf[JB_BP];
bp = (uint32*) __builtin_frame_address(0);
while (--skip >= 0) {
bpdown = (uint32*) *bp++;
if (bpdown < bp)