author | Kannan Vijayan <kvijayan@mozilla.com> |
Fri, 11 Apr 2014 11:58:55 -0400 | |
changeset 178120 | b7fd2d587e148b3fcc19692dbb2ed2517078f6ec |
parent 178119 | cbd4cf2c140d65a162b6bffa80eccf7d51d4a94b |
child 178121 | eff44f055d4ac7c4e12b8506cbd23b167b089d93 |
push id | 26574 |
push user | ryanvm@gmail.com |
push date | Fri, 11 Apr 2014 20:47:50 +0000 |
treeherder | mozilla-central@71a02d5403f9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | luke |
bugs | 993071 |
milestone | 31.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/public/ProfilingStack.h | file | annotate | diff | comparison | revisions | |
js/src/jit/IonMacroAssembler.h | file | annotate | diff | comparison | revisions |
--- a/js/public/ProfilingStack.h +++ b/js/public/ProfilingStack.h @@ -35,34 +35,47 @@ class ProfileEntry // if a sample were taken it would be examining bogus information. // // A ProfileEntry represents both a C++ profile entry and a JS one. Both use // the string as a description, but JS uses the sp as nullptr or (void*)1 to // indicate that it is a JS entry. The script_ is then only ever examined for // a JS entry, and the idx is used by both, but with different meanings. // const char * volatile string; // Descriptive string of this entry - void * volatile sp; // Relevant stack pointer for the entry - JSScript * volatile script_; // if js(), non-null script which is running + void * volatile sp; // Relevant stack pointer for the entry, + // less than or equal to SCRIPT_OPT_STACKPOINTER for js + // script entries, greater for non-js entries. + JSScript * volatile script_; // if js(), non-null script which is running - low bit + // indicates if script is optimized or not. int32_t volatile idx; // if js(), idx of pc, otherwise line number public: + static const uintptr_t SCRIPT_OPT_STACKPOINTER = 0x1; + // All of these methods are marked with the 'volatile' keyword because SPS's // representation of the stack is stored such that all ProfileEntry // instances are volatile. These methods would not be available unless they // were marked as volatile as well. bool js() const volatile { - MOZ_ASSERT_IF(sp == nullptr, script_ != nullptr); - return sp == nullptr; + MOZ_ASSERT_IF(uintptr_t(sp) <= SCRIPT_OPT_STACKPOINTER, script_ != nullptr); + return uintptr_t(sp) <= SCRIPT_OPT_STACKPOINTER; } uint32_t line() const volatile { MOZ_ASSERT(!js()); return idx; } JSScript *script() const volatile { MOZ_ASSERT(js()); return script_; } - void *stackAddress() const volatile { return sp; } + bool scriptIsOptimized() const volatile { + MOZ_ASSERT(js()); + return uintptr_t(sp) <= SCRIPT_OPT_STACKPOINTER; + } + void *stackAddress() const volatile { + if (js()) + return nullptr; + return sp; + } const char *label() const volatile { return string; } void setLine(uint32_t aLine) volatile { MOZ_ASSERT(!js()); idx = aLine; } void setLabel(const char *aString) volatile { string = aString; } void setStackAddress(void *aSp) volatile { sp = aSp; } void setScript(JSScript *aScript) volatile { script_ = aScript; } // We can't know the layout of JSScript, so look in vm/SPSProfiler.cpp.
--- a/js/src/jit/IonMacroAssembler.h +++ b/js/src/jit/IonMacroAssembler.h @@ -1028,31 +1028,34 @@ class MacroAssembler : public MacroAssem void spsUpdatePCIdx(SPSProfiler *p, Register idx, Register temp) { Label stackFull; spsProfileEntryAddressSafe(p, -1, temp, &stackFull); store32(idx, Address(temp, ProfileEntry::offsetOfPCIdx())); bind(&stackFull); } + // spsPushFrame variant for Ion-optimized scripts. void spsPushFrame(SPSProfiler *p, const char *str, JSScript *s, Register temp) { Label stackFull; spsProfileEntryAddress(p, 0, temp, &stackFull); storePtr(ImmPtr(str), Address(temp, ProfileEntry::offsetOfString())); storePtr(ImmGCPtr(s), Address(temp, ProfileEntry::offsetOfScript())); - storePtr(ImmPtr(nullptr), Address(temp, ProfileEntry::offsetOfStackAddress())); + storePtr(ImmPtr((void*) ProfileEntry::SCRIPT_OPT_STACKPOINTER), + Address(temp, ProfileEntry::offsetOfStackAddress())); store32(Imm32(ProfileEntry::NullPCIndex), Address(temp, ProfileEntry::offsetOfPCIdx())); /* Always increment the stack size, whether or not we actually pushed. */ bind(&stackFull); movePtr(ImmPtr(p->sizePointer()), temp); add32(Imm32(1), Address(temp, 0)); } + // spsPushFrame variant for Baseline-optimized scripts. void spsPushFrame(SPSProfiler *p, const Address &str, const Address &script, Register temp, Register temp2) { Label stackFull; spsProfileEntryAddressSafe(p, 0, temp, &stackFull); loadPtr(str, temp2); storePtr(temp2, Address(temp, ProfileEntry::offsetOfString()));