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