提交 c3243311 编写于 作者: E Eric Seidel

Remove almost all of Oilpan

The only things left are all the baseclasses
and macros in heap/Handle.h which are referenced
throughout all of core.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/686783002
上级 42ea48b3
......@@ -32,6 +32,7 @@
#define DOMWrapperWorld_h
#include "bindings/core/v8/ScriptState.h"
#include "wtf/HashSet.h"
#include "wtf/MainThread.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
......@@ -141,7 +142,7 @@ private:
{
}
Persistent<T> m_object;
OwnPtr<T> m_object;
};
public:
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "config.h"
#include "bindings/core/v8/ScriptFunction.h"
#include "bindings/core/v8/V8Binding.h"
namespace blink {
v8::Handle<v8::Function> ScriptFunction::bindToV8Function()
{
v8::Isolate* isolate = m_scriptState->isolate();
v8::Handle<v8::External> wrapper = v8::External::New(isolate, this);
m_scriptState->world().registerDOMObjectHolder(isolate, this, wrapper);
return createClosure(&ScriptFunction::callCallback, wrapper, isolate);
}
void ScriptFunction::callCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
ASSERT(args.Data()->IsExternal());
ScriptFunction* scriptFunction = static_cast<ScriptFunction*>(v8::Handle<v8::External>::Cast(args.Data())->Value());
ScriptValue result = scriptFunction->call(ScriptValue(scriptFunction->scriptState(), args[0]));
v8SetReturnValue(args, result.v8Value());
}
} // namespace blink
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ScriptFunction_h
#define ScriptFunction_h
#include "bindings/core/v8/ScriptValue.h"
#include "platform/heap/Handle.h"
#include <v8.h>
namespace blink {
// A common way of using ScriptFunction is as follows:
//
// class DerivedFunction : public ScriptFunction {
// // This returns a V8 function which the DerivedFunction is bound to.
// // The DerivedFunction is destructed when the V8 function is
// // garbage-collected.
// static v8::Handle<v8::Function> createFunction(ScriptState* scriptState)
// {
// DerivedFunction* self = new DerivedFunction(scriptState);
// return self->bindToV8Function();
// }
// };
class ScriptFunction {
public:
virtual ~ScriptFunction() { }
ScriptState* scriptState() const { return m_scriptState.get(); }
protected:
explicit ScriptFunction(ScriptState* scriptState)
: m_scriptState(scriptState)
{
}
v8::Handle<v8::Function> bindToV8Function();
private:
virtual ScriptValue call(ScriptValue) = 0;
static void callCallback(const v8::FunctionCallbackInfo<v8::Value>&);
RefPtr<ScriptState> m_scriptState;
};
} // namespace blink
#endif
......@@ -31,7 +31,6 @@
#ifndef ScriptPromise_h
#define ScriptPromise_h
#include "bindings/core/v8/ScriptFunction.h"
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/V8ThrowException.h"
#include "core/dom/ExceptionCode.h"
......
......@@ -49,8 +49,6 @@
'ScriptCallStackFactory.h',
'ScriptController.cpp',
'ScriptController.h',
'ScriptFunction.cpp',
'ScriptFunction.h',
'ScriptFunctionCall.cpp',
'ScriptFunctionCall.h',
'ScriptGCEvent.cpp',
......
......@@ -45,14 +45,7 @@ CSSImageGeneratorValue::~CSSImageGeneratorValue()
void CSSImageGeneratorValue::addClient(RenderObject* renderer, const IntSize& size)
{
ASSERT(renderer);
#if !ENABLE(OILPAN)
ref();
#else
if (m_clients.isEmpty()) {
ASSERT(!m_keepAlive);
m_keepAlive = adoptPtr(new Persistent<CSSImageGeneratorValue>(this));
}
#endif
if (!size.isEmpty())
m_sizes.add(size);
......
......@@ -241,12 +241,6 @@ inline bool compareCSSValuePtr(const RawPtr<CSSValueType>& first, const RawPtr<C
return first ? second && first->equals(*second) : !second;
}
template<typename CSSValueType>
inline bool compareCSSValuePtr(const Member<CSSValueType>& first, const Member<CSSValueType>& second)
{
return first ? second && first->equals(*second) : !second;
}
#define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \
DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, value.predicate)
......
......@@ -354,7 +354,7 @@ void FontFace::setError(PassRefPtr<DOMException> error)
ScriptPromise FontFace::fontStatusPromise(ScriptState* scriptState)
{
if (!m_loadedProperty) {
m_loadedProperty = new LoadedProperty(scriptState->executionContext(), this, LoadedProperty::Loaded);
m_loadedProperty = adoptPtr(new LoadedProperty(scriptState->executionContext(), this, LoadedProperty::Loaded));
if (m_status == Loaded)
m_loadedProperty->resolve(this);
else if (m_status == Error)
......
......@@ -130,7 +130,7 @@ private:
LoadStatus m_status;
RefPtr<DOMException> m_error;
Persistent<LoadedProperty> m_loadedProperty;
OwnPtr<LoadedProperty> m_loadedProperty;
OwnPtr<CSSFontFace> m_cssFontFace;
Vector<RefPtr<LoadFontCallback> > m_callbacks;
};
......
......@@ -248,16 +248,6 @@ inline MutableStylePropertySet* toMutableStylePropertySet(const RefPtr<StyleProp
return toMutableStylePropertySet(set.get());
}
inline MutableStylePropertySet* toMutableStylePropertySet(const Persistent<StylePropertySet>& set)
{
return toMutableStylePropertySet(set.get());
}
inline MutableStylePropertySet* toMutableStylePropertySet(const Member<StylePropertySet>& set)
{
return toMutableStylePropertySet(set.get());
}
inline const StylePropertyMetadata& StylePropertySet::PropertyReference::propertyMetadata() const
{
if (m_propertySet.isMutable())
......
......@@ -12,6 +12,7 @@ namespace blink {
class DescendantInvalidationSet;
class Document;
class Element;
class Node;
class StyleInvalidator {
DISALLOW_ALLOCATION();
......
......@@ -33,11 +33,7 @@ class MediaQueryResult : public RefCounted<MediaQueryResult> {
WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
MediaQueryResult(const MediaQueryExp& expr, bool result)
#if ENABLE(OILPAN)
: m_expression(&expr)
#else
: m_expression(expr)
#endif
, m_result(result)
{
}
......@@ -46,21 +42,13 @@ public:
const MediaQueryExp* expression() const
{
#if ENABLE(OILPAN)
return m_expression;
#else
return &m_expression;
#endif
}
bool result() const { return m_result; }
private:
#if ENABLE(OILPAN)
Member<const MediaQueryExp> m_expression;
#else
MediaQueryExp m_expression;
#endif
bool m_result;
};
......
......@@ -3141,10 +3141,6 @@ bool Document::hasFocus() const
return focusedFrame && focusedFrame == frame();
}
void Document::clearWeakMembers(Visitor* visitor)
{
}
v8::Handle<v8::Object> Document::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate));
......
......@@ -694,8 +694,6 @@ private:
void detachParser();
void clearWeakMembers(Visitor*);
virtual bool isDocument() const override final { return true; }
virtual void childrenChanged(const ChildrenChange&) override;
......
......@@ -195,31 +195,6 @@ void EventHandlerRegistry::notifyDidAddOrRemoveEventHandlerTarget(EventHandlerCl
scrollingCoordinator->touchEventTargetRectsDidChange();
}
void EventHandlerRegistry::trace(Visitor* visitor)
{
visitor->registerWeakMembers<EventHandlerRegistry, &EventHandlerRegistry::clearWeakMembers>(this);
}
void EventHandlerRegistry::clearWeakMembers(Visitor* visitor)
{
Vector<EventTarget*> deadTargets;
for (size_t i = 0; i < EventHandlerClassCount; ++i) {
EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i);
const EventTargetSet* targets = &m_targets[handlerClass];
for (EventTargetSet::const_iterator it = targets->begin(); it != targets->end(); ++it) {
Node* node = it->key->toNode();
LocalDOMWindow* window = it->key->toDOMWindow();
if (node && !visitor->isAlive(node)) {
deadTargets.append(node);
} else if (window && !visitor->isAlive(window)) {
deadTargets.append(window);
}
}
}
for (size_t i = 0; i < deadTargets.size(); ++i)
didRemoveAllEventHandlers(*deadTargets[i]);
}
void EventHandlerRegistry::documentDetached(Document& document)
{
// Remove all event targets under the detached document.
......
......@@ -59,9 +59,6 @@ public:
// references to handlers that are no longer related to it.
void documentDetached(Document&);
void trace(Visitor*);
void clearWeakMembers(Visitor*);
private:
enum ChangeOperation {
Add, // Add a new event handler.
......
......@@ -35,6 +35,7 @@
#include "platform/graphics/Color.h"
#include "platform/scroll/ScrollableArea.h"
#include "wtf/Forward.h"
#include "wtf/HashSet.h"
#include "wtf/OwnPtr.h"
#include "wtf/text/WTFString.h"
......
......@@ -7,6 +7,7 @@
#include "core/inspector/ConsoleMessage.h"
#include "platform/heap/Handle.h"
#include "wtf/Deque.h"
#include "wtf/Forward.h"
namespace blink {
......
......@@ -26,18 +26,6 @@ bool dataEquivalent(const RefPtr<T>& a, const RefPtr<T>& b)
return dataEquivalent(a.get(), b.get());
}
template <typename T>
bool dataEquivalent(const Persistent<T>& a, const Persistent<T>& b)
{
return dataEquivalent(a.get(), b.get());
}
template <typename T>
bool dataEquivalent(const Member<T>& a, const Member<T>& b)
{
return dataEquivalent(a.get(), b.get());
}
template <typename T>
bool dataEquivalent(const OwnPtr<T>& a, const OwnPtr<T>& b)
{
......
......@@ -26,6 +26,7 @@
#ifndef MediaPlayer_h
#define MediaPlayer_h
#include "platform/PlatformExport.h"
#include "public/platform/WebMediaPlayer.h"
#include "wtf/Forward.h"
#include "wtf/Noncopyable.h"
......
/*
* Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AddressSanitizer_h
#define AddressSanitizer_h
// FIXME: Add SyZyASan support?
#if defined(ADDRESS_SANITIZER)
#include <sanitizer/asan_interface.h>
#else
#define ASAN_POISON_MEMORY_REGION(addr, size) \
((void)(addr), (void)(size))
#define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
((void)(addr), (void)(size))
#endif
#if defined(LEAK_SANITIZER)
#include <sanitizer/lsan_interface.h>
#else
#define __lsan_register_root_region(addr, size) ((void)(addr), (void)(size))
#define __lsan_unregister_root_region(addr, size) ((void)(addr), (void)(size))
#endif
// FIXME: Have to handle (ADDRESS_SANITIZER && _WIN32) differently as it uses
// both Clang (which supports the __attribute__ syntax) and CL (which doesn't)
// as long as we use "clang-cl /fallback". This shouldn't be needed when Clang
// handles all the code without falling back to CL.
#if defined(ADDRESS_SANITIZER) && (!OS(WIN) || COMPILER(CLANG))
#define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
#define NO_SANITIZE_ADDRESS
#endif
const size_t asanMagic = 0xabefeed0;
const size_t asanDeferMemoryReuseCount = 2;
const size_t asanDeferMemoryReuseMask = 0x3;
#endif
......@@ -6,15 +6,10 @@ visibility = ["//sky/engine/*"]
source_set("heap") {
sources = [
"AddressSanitizer.h",
"Handle.h",
"ThreadState.h",
"Visitor.h",
]
configs += [ "//sky/engine:config" ]
deps = [
"//third_party/icu",
]
}
#
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
{
'conditions': [
['OS=="android"', {
'variables': {
'isolate_dependency_tracked': [
],
'isolate_dependency_untracked': [
],
},
}],
],
}
include_rules = [
"+heap",
]
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* typedef void (*PushAllRegistersCallback)(SafePointBarrier*, ThreadState*, intptr_t*);
* extern "C" void pushAllRegisters(SafePointBarrier*, ThreadState*, PushAllRegistersCallback)
*/
.type pushAllRegisters, %function
.global pushAllRegisters
.hidden pushAllRegisters
#ifdef __thumb__
/* In THUMB Mode jump to ARM stub via bx to ensure CPU mode switch.
* FIXME: This trampoline is provided to workaround bugs in
* the THUMB/ARM interworking that appear in the component build.
* When these issues are resolved this stub can be removed.
*/
.align 2
.code 16
.thumb_func
pushAllRegisters:
adr r3, pushAllRegistersARM
bx r3
.type pushAllRegistersARM, %function
.hidden pushAllRegistersARM
.align 4
.code 32
pushAllRegistersARM:
#else
/* ARM Mode */
.align 4
.code 32
pushAllRegisters:
#endif
/* Push all callee-saved registers and save return address. */
push {r4-r11, lr}
/* Pass the two first arguments unchanged (r0, r1)
* and pass the stack pointer after pushing callee-saved
* registers to the callback function.
*/
mov r3, r2
mov r2, sp
blx r3
/* Discard all the registers, and pop lr into pc which returns
* and switches mode if needed.
*/
add sp, sp, #32
pop {pc}
/*
* Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* typedef void (*PushAllRegistersCallback)(SafePointBarrier*, ThreadState*, intptr_t*);
* extern "C" void pushAllRegisters(SafePointBarrier*, ThreadState*, PushAllRegistersCallback)
*/
.type pushAllRegisters, %function
.global pushAllRegisters
.hidden pushAllRegisters
pushAllRegisters:
/* Save return address. */
sub sp, sp, #96
stp x19, x20, [sp, #80]
stp x21, x22, [sp, #64]
stp x23, x24, [sp, #48]
stp x25, x26, [sp, #32]
stp x27, x28, [sp, #16]
stp x30, x29, [sp, #0] // x30 is lr.
/* Pass the two first arguments unchanged (x0, x1)
* and pass the stack pointer as third argument to the
* callback function.
*/
mov x3, x2
mov x2, sp
blr x3
/* We don't restore all registers since they are callee saved (so
* the callback didn't clobber them) and we didn't modify them either.
*/
ldr x30, [sp], #96
ret
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* typedef void (*PushAllRegistersCallback)(SafePointBarrier*, ThreadState*, intptr_t*);
* extern "C" void pushAllRegisters(SafePointBarrier*, ThreadState*, PushAllRegistersCallback)
*/
.type pushAllRegisters, %function
.global pushAllRegisters
.hidden pushAllRegisters
pushAllRegisters:
// Reserve space for callee-saved registers, return address,
// as well as for the callee arguments.
addiu $sp,$sp,-56
// Save the callee-saved registers and the return address.
sw $s0,16($sp)
sw $s1,20($sp)
sw $s2,24($sp)
sw $s3,28($sp)
sw $s4,32($sp)
sw $s5,36($sp)
sw $s6,40($sp)
sw $s7,44($sp)
sw $ra,48($sp)
// Pass the two first arguments untouched in a0 and a1 and the
// stack pointer to the callback.
move $t9,$a2
move $a2,$sp
jal $t9
// Restore return address, adjust stack and return. No
// callee-saved register was changed so we do not have to
// restore callee-saved registers.
lw $ra,48($sp)
addiu $sp,$sp,56
jr $ra
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/*
* typedef void (*PushAllRegistersCallback)(SafePointBarrier*, ThreadState*, intptr_t*);
* extern "C" void pushAllRegisters(SafePointBarrier*, ThreadState*, PushAllRegistersCallback)
*/
.type pushAllRegisters, %function
.global pushAllRegisters
.hidden pushAllRegisters
pushAllRegisters:
// Push all callee-saves registers to get them
// on the stack for conservative stack scanning.
// Reserve space for callee-saved registers and return address.
daddiu $sp,$sp,-80
// Save the callee-saved registers and the return address.
sd $s0,0($sp)
sd $s1,8($sp)
sd $s2,16($sp)
sd $s3,24($sp)
sd $s4,32($sp)
sd $s5,40($sp)
sd $s6,48($sp)
sd $s7,56($sp)
sd $ra,64($sp)
// Note: the callee-saved floating point registers do not need to be
// copied to the stack, because fp registers never hold heap pointers
// and so do not need to be kept visible to the garbage collector.
// Pass the two first arguments untouched in a0 and a1 and the
// stack pointer to the callback.
move $t9,$a2
move $a2,$sp
jal $t9
// Restore return address, adjust stack and return.
// Note: the copied registers do not need to be reloaded here,
// because they were preserved by the called routine.
ld $ra,64($sp)
daddiu $sp,$sp,80
jr $ra
;; Copyright (C) 2013 Google Inc. All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are
;; met:
;;
;; * Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above
;; copyright notice, this list of conditions and the following disclaimer
;; in the documentation and/or other materials provided with the
;; distribution.
;; * Neither the name of Google Inc. nor the names of its
;; contributors may be used to endorse or promote products derived from
;; this software without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%ifndef X64POSIX
%define X64POSIX 0
%endif
%ifndef X64WIN
%define X64WIN 0
%endif
%ifndef IA32
%define IA32 0
%endif
%ifndef ARM
%define ARM 0
%endif
;; Prefix symbols by '_' if PREFIX is defined.
%ifdef PREFIX
%define mangle(x) _ %+ x
%else
%define mangle(x) x
%endif
; PRIVATE makes a symbol private.
%ifidn __OUTPUT_FORMAT__,elf32
%define PRIVATE :hidden
%elifidn __OUTPUT_FORMAT__,elf64
%define PRIVATE :hidden
%elifidn __OUTPUT_FORMAT__,elfx32
%define PRIVATE :hidden
%elif X64WIN
%define PRIVATE
%else
%define PRIVATE :private_extern
%endif
;; typedef void (*PushAllRegistersCallback)(SafePointBarrier*, ThreadState*, intptr_t*);
;; extern "C" void pushAllRegisters(SafePointBarrier*, ThreadState*, PushAllRegistersCallback)
global mangle(pushAllRegisters) PRIVATE
%if X64POSIX
mangle(pushAllRegisters):
;; Push all callee-saves registers to get them
;; on the stack for conservative stack scanning.
;; We maintain 16-byte alignment at calls (required on Mac).
;; There is an 8-byte return address on the stack and we push
;; 56 bytes which maintains 16-byte stack alignment
;; at the call.
push 0
push rbx
push rbp
push r12
push r13
push r14
push r15
;; Pass the two first arguments unchanged (rdi, rsi)
;; and the stack pointer after pushing callee-saved
;; registers to the callback.
mov r8, rdx
mov rdx, rsp
call r8
;; Pop the callee-saved registers. None of them were
;; modified so no restoring is needed.
add rsp, 56
ret
%elif X64WIN
mangle(pushAllRegisters):
;; Push all callee-saves registers to get them
;; on the stack for conservative stack scanning.
push rsi
push rdi
push rbx
push rbp
push r12
push r13
push r14
push r15
;; Pass the two first arguments unchanged (rcx, rdx)
;; and the stack pointer after pushing callee-saved
;; registers to the callback.
mov r9, r8
mov r8, rsp
call r9
;; Pop the callee-saved registers. None of them were
;; modified so no restoring is needed.
add rsp, 64
ret
%elif IA32
mangle(pushAllRegisters):
;; Push all callee-saves registers to get them
;; on the stack for conservative stack scanning.
;; We maintain 16-byte alignment at calls (required on
;; Mac). There is a 4-byte return address on the stack
;; and we push 28 bytes which maintains 16-byte alignment
;; at the call.
push ebx
push ebp
push esi
push edi
;; Pass the two first arguments unchanged and the
;; stack pointer after pushing callee-save registers
;; to the callback.
mov ecx, [esp + 28]
push esp
push dword [esp + 28]
push dword [esp + 28]
call ecx
;; Pop arguments and the callee-saved registers.
;; None of the callee-saved registers were modified
;; so we do not need to restore them.
add esp, 28
ret
%elif ARM
%error "Yasm does not support arm. Use SaveRegisters_arm.S on arm."
%else
%error "Unsupported platform."
%endif
include_rules = [
"+heap",
"+public/platform",
]
/*
* Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PendingGCRunner_h
#define PendingGCRunner_h
#include "platform/heap/ThreadState.h"
#include "public/platform/WebThread.h"
namespace blink {
class PendingGCRunner : public blink::WebThread::TaskObserver {
public:
PendingGCRunner() : m_nesting(0) { }
~PendingGCRunner()
{
// m_nesting can be 1 if this was unregistered in a task and
// didProcessTask was not called.
ASSERT(!m_nesting || m_nesting == 1);
}
virtual void willProcessTask()
{
m_nesting++;
}
virtual void didProcessTask()
{
// In the production code WebKit::initialize is called from inside the
// message loop so we can get didProcessTask() without corresponding
// willProcessTask once. This is benign.
if (m_nesting)
m_nesting--;
blink::ThreadState* state = blink::ThreadState::current();
state->safePoint(m_nesting ? blink::ThreadState::HeapPointersOnStack : blink::ThreadState::NoHeapPointersOnStack);
}
private:
int m_nesting;
};
}
#endif
......@@ -14,6 +14,7 @@
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/GraphicsLayer.h"
#include "platform/graphics/gpu/Extensions3DUtil.h"
#include "platform/graphics/media/MediaPlayer.h"
#include "platform/graphics/skia/GaneshUtils.h"
#include "public/platform/Platform.h"
#include "public/platform/WebCString.h"
......
......@@ -97,8 +97,6 @@ namespace WTF {
class HashTableConstIterator;
template<typename Value, typename HashFunctions, typename HashTraits, typename Allocator>
class LinkedHashSet;
template<WeakHandlingFlag x, typename T, typename U, typename V, typename W, typename X, typename Y, typename Z>
struct WeakProcessingHashTableHelper;
typedef enum { HashItemKnownGood } HashItemKnownGoodTag;
......@@ -563,7 +561,6 @@ namespace WTF {
mutable OwnPtr<Stats> m_stats;
#endif
template<WeakHandlingFlag x, typename T, typename U, typename V, typename W, typename X, typename Y, typename Z> friend struct WeakProcessingHashTableHelper;
template<typename T, typename U, typename V, typename W> friend class LinkedHashSet;
};
......@@ -1151,136 +1148,6 @@ namespace WTF {
return *this;
}
template<WeakHandlingFlag weakHandlingFlag, typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
struct WeakProcessingHashTableHelper;
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
struct WeakProcessingHashTableHelper<NoWeakHandlingInCollections, Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator> {
static void process(typename Allocator::Visitor* visitor, void* closure) { }
static void ephemeronIteration(typename Allocator::Visitor* visitor, void* closure) { }
static void ephemeronIterationDone(typename Allocator::Visitor* visitor, void* closure) { }
};
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
struct WeakProcessingHashTableHelper<WeakHandlingInCollections, Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator> {
// Used for purely weak and for weak-and-strong tables (ephemerons).
static void process(typename Allocator::Visitor* visitor, void* closure)
{
typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator> HashTableType;
HashTableType* table = reinterpret_cast<HashTableType*>(closure);
if (table->m_table) {
// This is run as part of weak processing after full
// marking. The backing store is therefore marked if
// we get here.
ASSERT(visitor->isAlive(table->m_table));
// Now perform weak processing (this is a no-op if the backing
// was accessible through an iterator and was already marked
// strongly).
typedef typename HashTableType::ValueType ValueType;
for (ValueType* element = table->m_table + table->m_tableSize - 1; element >= table->m_table; element--) {
if (!HashTableType::isEmptyOrDeletedBucket(*element)) {
// At this stage calling trace can make no difference
// (everything is already traced), but we use the
// return value to remove things from the collection.
if (TraceInCollectionTrait<WeakHandlingInCollections, WeakPointersActWeak, ValueType, Traits>::trace(visitor, *element)) {
table->registerModification();
HashTableType::deleteBucket(*element); // Also calls the destructor.
table->m_deletedCount++;
table->m_keyCount--;
// We don't rehash the backing until the next add
// or delete, because that would cause allocation
// during GC.
}
}
}
}
}
// Called repeatedly for tables that have both weak and strong pointers.
static void ephemeronIteration(typename Allocator::Visitor* visitor, void* closure)
{
typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator> HashTableType;
HashTableType* table = reinterpret_cast<HashTableType*>(closure);
if (table->m_table) {
// Check the hash table for elements that we now know will not
// be removed by weak processing. Those elements need to have
// their strong pointers traced.
typedef typename HashTableType::ValueType ValueType;
for (ValueType* element = table->m_table + table->m_tableSize - 1; element >= table->m_table; element--) {
if (!HashTableType::isEmptyOrDeletedBucket(*element))
TraceInCollectionTrait<WeakHandlingInCollections, WeakPointersActWeak, ValueType, Traits>::trace(visitor, *element);
}
}
}
// Called when the ephemeron iteration is done and before running the per thread
// weak processing. It is guaranteed to be called before any thread is resumed.
static void ephemeronIterationDone(typename Allocator::Visitor* visitor, void* closure)
{
typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator> HashTableType;
HashTableType* table = reinterpret_cast<HashTableType*>(closure);
ASSERT(Allocator::weakTableRegistered(visitor, table));
table->clearEnqueued();
}
};
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::trace(typename Allocator::Visitor* visitor)
{
// If someone else already marked the backing and queued up the trace
// and/or weak callback then we are done. This optimization does not
// happen for ListHashSet since its iterator does not point at the
// backing.
if (!m_table || visitor->isAlive(m_table))
return;
// Normally, we mark the backing store without performing trace. This
// means it is marked live, but the pointers inside it are not marked.
// Instead we will mark the pointers below. However, for backing
// stores that contain weak pointers the handling is rather different.
// We don't mark the backing store here, so the marking GC will leave
// the backing unmarked. If the backing is found in any other way than
// through its HashTable (ie from an iterator) then the mark bit will
// be set and the pointers will be marked strongly, avoiding problems
// with iterating over things that disappear due to weak processing
// while we are iterating over them. We register the backing store
// pointer for delayed marking which will take place after we know if
// the backing is reachable from elsewhere. We also register a
// weakProcessing callback which will perform weak processing if needed.
if (Traits::weakHandlingFlag == NoWeakHandlingInCollections) {
Allocator::markNoTracing(visitor, m_table);
} else {
Allocator::registerDelayedMarkNoTracing(visitor, m_table);
Allocator::registerWeakMembers(visitor, this, m_table, WeakProcessingHashTableHelper<Traits::weakHandlingFlag, Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::process);
}
if (ShouldBeTraced<Traits>::value) {
if (Traits::weakHandlingFlag == WeakHandlingInCollections) {
// If we have both strong and weak pointers in the collection
// then we queue up the collection for fixed point iteration a
// la Ephemerons:
// http://dl.acm.org/citation.cfm?doid=263698.263733 - see also
// http://www.jucs.org/jucs_14_21/eliminating_cycles_in_weak
ASSERT(!enqueued() || Allocator::weakTableRegistered(visitor, this));
if (!enqueued()) {
Allocator::registerWeakTable(visitor, this,
WeakProcessingHashTableHelper<Traits::weakHandlingFlag, Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::ephemeronIteration,
WeakProcessingHashTableHelper<Traits::weakHandlingFlag, Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::ephemeronIterationDone);
setEnqueued();
}
// We don't need to trace the elements here, since registering
// as a weak table above will cause them to be traced (perhaps
// several times). It's better to wait until everything else is
// traced before tracing the elements for the first time; this
// may reduce (by one) the number of iterations needed to get
// to a fixed point.
return;
}
for (ValueType* element = m_table + m_tableSize - 1; element >= m_table; element--) {
if (!isEmptyOrDeletedBucket(*element))
Allocator::template trace<ValueType, Traits>(visitor, *element);
}
}
}
// iterator adapters
template<typename HashTableType, typename Traits> struct HashTableConstIteratorAdapter {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册