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_BaselineInspector_h
8 #define jit_BaselineInspector_h
10 #ifdef JS_ION
12 #include "jit/BaselineIC.h"
13 #include "jit/BaselineJIT.h"
14 #include "jit/MIR.h"
16 namespace js {
17 namespace jit {
19 class BaselineInspector;
21 class ICInspector
22 {
23 protected:
24 BaselineInspector *inspector_;
25 jsbytecode *pc_;
26 ICEntry *icEntry_;
28 ICInspector(BaselineInspector *inspector, jsbytecode *pc, ICEntry *icEntry)
29 : inspector_(inspector), pc_(pc), icEntry_(icEntry)
30 { }
31 };
33 class SetElemICInspector : public ICInspector
34 {
35 public:
36 SetElemICInspector(BaselineInspector *inspector, jsbytecode *pc, ICEntry *icEntry)
37 : ICInspector(inspector, pc, icEntry)
38 { }
40 bool sawOOBDenseWrite() const;
41 bool sawOOBTypedArrayWrite() const;
42 bool sawDenseWrite() const;
43 bool sawTypedArrayWrite() const;
44 };
46 class BaselineInspector
47 {
48 private:
49 JSScript *script;
50 ICEntry *prevLookedUpEntry;
52 public:
53 BaselineInspector(JSScript *script)
54 : script(script), prevLookedUpEntry(nullptr)
55 {
56 JS_ASSERT(script);
57 }
59 bool hasBaselineScript() const {
60 return script->hasBaselineScript();
61 }
63 BaselineScript *baselineScript() const {
64 return script->baselineScript();
65 }
67 private:
68 #ifdef DEBUG
69 bool isValidPC(jsbytecode *pc) {
70 return script->containsPC(pc);
71 }
72 #endif
74 ICEntry &icEntryFromPC(jsbytecode *pc) {
75 JS_ASSERT(hasBaselineScript());
76 JS_ASSERT(isValidPC(pc));
77 ICEntry &ent = baselineScript()->icEntryFromPCOffset(script->pcToOffset(pc), prevLookedUpEntry);
78 JS_ASSERT(ent.isForOp());
79 prevLookedUpEntry = &ent;
80 return ent;
81 }
83 template <typename ICInspectorType>
84 ICInspectorType makeICInspector(jsbytecode *pc, ICStub::Kind expectedFallbackKind) {
85 ICEntry *ent = nullptr;
86 if (hasBaselineScript()) {
87 ent = &icEntryFromPC(pc);
88 JS_ASSERT(ent->fallbackStub()->kind() == expectedFallbackKind);
89 }
90 return ICInspectorType(this, pc, ent);
91 }
93 ICStub *monomorphicStub(jsbytecode *pc);
94 bool dimorphicStub(jsbytecode *pc, ICStub **pfirst, ICStub **psecond);
96 public:
97 typedef Vector<Shape *, 4, IonAllocPolicy> ShapeVector;
98 bool maybeShapesForPropertyOp(jsbytecode *pc, ShapeVector &shapes);
100 SetElemICInspector setElemICInspector(jsbytecode *pc) {
101 return makeICInspector<SetElemICInspector>(pc, ICStub::SetElem_Fallback);
102 }
104 MIRType expectedResultType(jsbytecode *pc);
105 MCompare::CompareType expectedCompareType(jsbytecode *pc);
106 MIRType expectedBinaryArithSpecialization(jsbytecode *pc);
108 bool hasSeenNonNativeGetElement(jsbytecode *pc);
109 bool hasSeenNegativeIndexGetElement(jsbytecode *pc);
110 bool hasSeenAccessedGetter(jsbytecode *pc);
111 bool hasSeenDoubleResult(jsbytecode *pc);
112 bool hasSeenNonStringIterNext(jsbytecode *pc);
114 JSObject *getTemplateObject(jsbytecode *pc);
115 JSObject *getTemplateObjectForNative(jsbytecode *pc, Native native);
117 DeclEnvObject *templateDeclEnvObject();
118 CallObject *templateCallObject();
120 JSObject *commonGetPropFunction(jsbytecode *pc, Shape **lastProperty, JSFunction **commonGetter);
121 JSObject *commonSetPropFunction(jsbytecode *pc, Shape **lastProperty, JSFunction **commonSetter);
122 };
124 } // namespace jit
125 } // namespace js
127 #endif // JS_ION
129 #endif /* jit_BaselineInspector_h */