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