js/src/jit/PerfSpewer.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef jit_PerfSpewer_h
michael@0 8 #define jit_PerfSpewer_h
michael@0 9
michael@0 10 #ifdef JS_ION_PERF
michael@0 11 # include <stdio.h>
michael@0 12 # include "jit/IonMacroAssembler.h"
michael@0 13 #endif
michael@0 14
michael@0 15 namespace js {
michael@0 16 namespace jit {
michael@0 17
michael@0 18 class MBasicBlock;
michael@0 19 class MacroAssembler;
michael@0 20
michael@0 21 #ifdef JS_ION_PERF
michael@0 22 void CheckPerf();
michael@0 23 bool PerfBlockEnabled();
michael@0 24 bool PerfFuncEnabled();
michael@0 25 static inline bool PerfEnabled() {
michael@0 26 return PerfBlockEnabled() || PerfFuncEnabled();
michael@0 27 }
michael@0 28 #else
michael@0 29 static inline void CheckPerf() {}
michael@0 30 static inline bool PerfBlockEnabled() { return false; }
michael@0 31 static inline bool PerfFuncEnabled() { return false; }
michael@0 32 static inline bool PerfEnabled() { return false; }
michael@0 33 #endif
michael@0 34
michael@0 35 #ifdef JS_ION_PERF
michael@0 36
michael@0 37 struct Record {
michael@0 38 const char *filename;
michael@0 39 unsigned lineNumber;
michael@0 40 unsigned columnNumber;
michael@0 41 uint32_t id;
michael@0 42 Label start, end;
michael@0 43 size_t startOffset, endOffset;
michael@0 44
michael@0 45 Record(const char *filename,
michael@0 46 unsigned lineNumber,
michael@0 47 unsigned columnNumber,
michael@0 48 uint32_t id)
michael@0 49 : filename(filename), lineNumber(lineNumber),
michael@0 50 columnNumber(columnNumber), id(id),
michael@0 51 startOffset(0u), endOffset(0u)
michael@0 52 {}
michael@0 53 };
michael@0 54
michael@0 55 typedef Vector<Record, 1, SystemAllocPolicy> BasicBlocksVector;
michael@0 56
michael@0 57 class PerfSpewer
michael@0 58 {
michael@0 59 protected:
michael@0 60 static uint32_t nextFunctionIndex;
michael@0 61
michael@0 62 public:
michael@0 63 Label endInlineCode;
michael@0 64
michael@0 65 protected:
michael@0 66 BasicBlocksVector basicBlocks_;
michael@0 67
michael@0 68 public:
michael@0 69 virtual bool startBasicBlock(MBasicBlock *blk, MacroAssembler &masm);
michael@0 70 bool endBasicBlock(MacroAssembler &masm);
michael@0 71 bool noteEndInlineCode(MacroAssembler &masm);
michael@0 72
michael@0 73 void writeProfile(JSScript *script, JitCode *code, MacroAssembler &masm);
michael@0 74 };
michael@0 75
michael@0 76 void writePerfSpewerBaselineProfile(JSScript *script, JitCode *code);
michael@0 77 void writePerfSpewerJitCodeProfile(JitCode *code, const char *msg);
michael@0 78
michael@0 79 class AsmJSPerfSpewer : public PerfSpewer
michael@0 80 {
michael@0 81 public:
michael@0 82 bool startBasicBlock(MBasicBlock *blk, MacroAssembler &masm);
michael@0 83
michael@0 84 void noteBlocksOffsets();
michael@0 85 BasicBlocksVector &basicBlocks() { return basicBlocks_; }
michael@0 86 };
michael@0 87
michael@0 88 void writePerfSpewerAsmJSFunctionMap(uintptr_t base, uintptr_t size, const char *filename,
michael@0 89 unsigned lineno, unsigned colIndex, const char *funcName);
michael@0 90
michael@0 91 void writePerfSpewerAsmJSBlocksMap(uintptr_t baseAddress, size_t funcStartOffset,
michael@0 92 size_t funcStartOOLOffset, size_t funcSize,
michael@0 93 const char *filename, const char *funcName,
michael@0 94 const BasicBlocksVector &basicBlocks);
michael@0 95
michael@0 96 void writePerfSpewerAsmJSEntriesAndExits(uintptr_t base, size_t size);
michael@0 97
michael@0 98 #endif // JS_ION_PERF
michael@0 99
michael@0 100 } // namespace jit
michael@0 101 } // namespace js
michael@0 102
michael@0 103 #endif /* jit_PerfSpewer_h */

mercurial