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 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2009 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #include <emmintrin.h> |
michael@0 | 11 | #include "SkUtils_opts_SSE2.h" |
michael@0 | 12 | |
michael@0 | 13 | void sk_memset16_SSE2(uint16_t *dst, uint16_t value, int count) |
michael@0 | 14 | { |
michael@0 | 15 | SkASSERT(dst != NULL && count >= 0); |
michael@0 | 16 | |
michael@0 | 17 | // dst must be 2-byte aligned. |
michael@0 | 18 | SkASSERT((((size_t) dst) & 0x01) == 0); |
michael@0 | 19 | |
michael@0 | 20 | if (count >= 32) { |
michael@0 | 21 | while (((size_t)dst) & 0x0F) { |
michael@0 | 22 | *dst++ = value; |
michael@0 | 23 | --count; |
michael@0 | 24 | } |
michael@0 | 25 | __m128i *d = reinterpret_cast<__m128i*>(dst); |
michael@0 | 26 | __m128i value_wide = _mm_set1_epi16(value); |
michael@0 | 27 | while (count >= 32) { |
michael@0 | 28 | _mm_store_si128(d , value_wide); |
michael@0 | 29 | _mm_store_si128(d + 1, value_wide); |
michael@0 | 30 | _mm_store_si128(d + 2, value_wide); |
michael@0 | 31 | _mm_store_si128(d + 3, value_wide); |
michael@0 | 32 | d += 4; |
michael@0 | 33 | count -= 32; |
michael@0 | 34 | } |
michael@0 | 35 | dst = reinterpret_cast<uint16_t*>(d); |
michael@0 | 36 | } |
michael@0 | 37 | while (count > 0) { |
michael@0 | 38 | *dst++ = value; |
michael@0 | 39 | --count; |
michael@0 | 40 | } |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | void sk_memset32_SSE2(uint32_t *dst, uint32_t value, int count) |
michael@0 | 44 | { |
michael@0 | 45 | SkASSERT(dst != NULL && count >= 0); |
michael@0 | 46 | |
michael@0 | 47 | // dst must be 4-byte aligned. |
michael@0 | 48 | SkASSERT((((size_t) dst) & 0x03) == 0); |
michael@0 | 49 | |
michael@0 | 50 | if (count >= 16) { |
michael@0 | 51 | while (((size_t)dst) & 0x0F) { |
michael@0 | 52 | *dst++ = value; |
michael@0 | 53 | --count; |
michael@0 | 54 | } |
michael@0 | 55 | __m128i *d = reinterpret_cast<__m128i*>(dst); |
michael@0 | 56 | __m128i value_wide = _mm_set1_epi32(value); |
michael@0 | 57 | while (count >= 16) { |
michael@0 | 58 | _mm_store_si128(d , value_wide); |
michael@0 | 59 | _mm_store_si128(d + 1, value_wide); |
michael@0 | 60 | _mm_store_si128(d + 2, value_wide); |
michael@0 | 61 | _mm_store_si128(d + 3, value_wide); |
michael@0 | 62 | d += 4; |
michael@0 | 63 | count -= 16; |
michael@0 | 64 | } |
michael@0 | 65 | dst = reinterpret_cast<uint32_t*>(d); |
michael@0 | 66 | } |
michael@0 | 67 | while (count > 0) { |
michael@0 | 68 | *dst++ = value; |
michael@0 | 69 | --count; |
michael@0 | 70 | } |
michael@0 | 71 | } |