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_Safepoints_h
8 #define jit_Safepoints_h
10 #include "jit/CompactBuffer.h"
11 #include "jit/shared/Assembler-shared.h"
13 namespace js {
14 namespace jit {
16 class BitSet;
17 struct SafepointNunboxEntry;
18 class LAllocation;
19 class LSafepoint;
21 static const uint32_t INVALID_SAFEPOINT_OFFSET = uint32_t(-1);
23 class SafepointWriter
24 {
25 CompactBufferWriter stream_;
26 BitSet *frameSlots_;
28 public:
29 bool init(TempAllocator &alloc, uint32_t slotCount);
31 private:
32 // A safepoint entry is written in the order these functions appear.
33 uint32_t startEntry();
35 void writeOsiCallPointOffset(uint32_t osiPointOffset);
36 void writeGcRegs(LSafepoint *safepoint);
37 void writeGcSlots(LSafepoint *safepoint);
38 void writeValueSlots(LSafepoint *safepoint);
40 void writeSlotsOrElementsSlots(LSafepoint *safepoint);
42 #ifdef JS_NUNBOX32
43 void writeNunboxParts(LSafepoint *safepoint);
44 #endif
46 void endEntry();
48 public:
49 void encode(LSafepoint *safepoint);
51 size_t size() const {
52 return stream_.length();
53 }
54 const uint8_t *buffer() const {
55 return stream_.buffer();
56 }
57 };
59 class SafepointReader
60 {
61 CompactBufferReader stream_;
62 uint32_t frameSlots_;
63 uint32_t currentSlotChunk_;
64 uint32_t nextSlotChunkNumber_;
65 uint32_t osiCallPointOffset_;
66 GeneralRegisterSet gcSpills_;
67 GeneralRegisterSet valueSpills_;
68 GeneralRegisterSet slotsOrElementsSpills_;
69 GeneralRegisterSet allGprSpills_;
70 FloatRegisterSet allFloatSpills_;
71 uint32_t nunboxSlotsRemaining_;
72 uint32_t slotsOrElementsSlotsRemaining_;
74 private:
75 void advanceFromGcRegs();
76 void advanceFromGcSlots();
77 void advanceFromValueSlots();
78 void advanceFromNunboxSlots();
79 bool getSlotFromBitmap(uint32_t *slot);
81 public:
82 SafepointReader(IonScript *script, const SafepointIndex *si);
84 static CodeLocationLabel InvalidationPatchPoint(IonScript *script, const SafepointIndex *si);
86 uint32_t osiCallPointOffset() const {
87 return osiCallPointOffset_;
88 }
89 GeneralRegisterSet gcSpills() const {
90 return gcSpills_;
91 }
92 GeneralRegisterSet slotsOrElementsSpills() const {
93 return slotsOrElementsSpills_;
94 }
95 GeneralRegisterSet valueSpills() const {
96 return valueSpills_;
97 }
98 GeneralRegisterSet allGprSpills() const {
99 return allGprSpills_;
100 }
101 FloatRegisterSet allFloatSpills() const {
102 return allFloatSpills_;
103 }
104 uint32_t osiReturnPointOffset() const;
106 // Returns true if a slot was read, false if there are no more slots.
107 bool getGcSlot(uint32_t *slot);
109 // Returns true if a slot was read, false if there are no more value slots.
110 bool getValueSlot(uint32_t *slot);
112 // Returns true if a nunbox slot was read, false if there are no more
113 // nunbox slots.
114 bool getNunboxSlot(LAllocation *type, LAllocation *payload);
116 // Returns true if a slot was read, false if there are no more slots.
117 bool getSlotsOrElementsSlot(uint32_t *slot);
118 };
120 } // namespace jit
121 } // namespace js
123 #endif /* jit_Safepoints_h */