source: webkit/trunk/Source/JavaScriptCore/Android.v8.wtf.mk@ 77098

Last change on this file since 77098 was 74360, checked in by [email protected], 14 years ago

Bug 26276 - Need a mechanism to determine stack extent

Reviewed by Oliver Hunt.

JavaScriptCore:

This patch adds a class 'StackBounds', to hold information about the machine stack.
The implementation of this class broadly adheres to the current implmentation of
stack limit checking, and as such does not solve the problem of determining stack
extent, but gives us a common place to do so.

Currently two mechanism are provided to determine the stack origin (the point the
stack is growing away from). currentThreadStackBase() in Collector provides a
more accurate determination of the stack origin, so use this to calculate
StackBounds::m_origin; WTFThreadData::approximatedStackStart is less accurate, and
as such can be removed. Cache the StackBounds on WTFThreadData such that they
need only be determined once per thread, and for non-API contexts cache this
information in JSGlobalData, to save a thread-specific access.

For the time being retain the estimate of stack size used by JSC's parser
(128 * sizeof(void*) * 1024), with a view to replacing this with something more
accurate in the near future.

  • parser/JSParser.cpp:

(JSC::JSParser::canRecurse):
(JSC::JSParser::JSParser):

Change to use StackBounds.

  • runtime/Collector.cpp:

(JSC::Heap::registerThread):
(JSC::Heap::markCurrentThreadConservativelyInternal):

Change to use StackBounds, cached on JSGlobalData.

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):

  • runtime/JSGlobalData.h:

(JSC::JSGlobalData::stack):

Add a cached copy of StackBounds.

  • wtf/StackBounds.cpp: Copied from JavaScriptCore/runtime/Collector.cpp.

(WTF::estimateStackBound):
(WTF::StackBounds::initialize):
(WTF::getStackMax):

Copy code from Collector.cpp to determine stack origin.

  • wtf/StackBounds.h: Added.

(WTF::StackBounds::StackBounds):

No argument constructor; returns a null StackBounds.

(WTF::StackBounds::currentThreadStackBounds):

Returns a StackBounds object representing the stack limits
of the current thread.

(WTF::StackBounds::origin):

Returns to stack origin (the point the stack is growing away
from; the highest extent of the stack on machines where the
stack grows downwards.

(WTF::StackBounds::recursionLimit):

Returns a limit value that is 'a comfortable distance from
the end of the stack'. Our concept of this is currently 1 page
away from the end, however the default value may be tuned in
the future, and clients may override passing a larger delta;
should only be called on StackBounds object representing the
stack of the thread this method is called on (checked by
checkConsistency).

(WTF::StackBounds::recursionCheck):

Checks whether we are currently 'a comfortable distance from
the end of the stack'. Our concept of this is currently 1 page
away from the end, however the default value may be tuned in
the future, and clients may override passing a larger delta
to apply when checking, if they wish to do so. This method
should only be called on StackBounds object representing the
stack of the thread this method is called on (checked by
checkConsistency).

(WTF::StackBounds::current):

Approximate current stack position. On machines where the stack
is growing downwards this is the lowest address that might need
conservative collection.

(WTF::StackBounds::isGrowingDownward):

True for all platforms other than WINCE, which has to check.

(WTF::StackBounds::checkConsistency):

This is called in methods that shoulds only be operating on a
valid set of bounds; as such we expect m_origin != m_bounds
(i.e. stack size != zero) - we're really testing that this
object is not null (the constructor initializes both fields
to zero). Also checks that current() is within the stack's
bounds.

  • wtf/WTFThreadData.cpp:

(WTF::WTFThreadData::WTFThreadData):

  • wtf/WTFThreadData.h:

(WTF::WTFThreadData::stack):

Add the StackBounds member variable.

JavaScriptGlue:

Add forwarding header for StackBounds.h.

  • ForwardingHeaders/wtf/StackBounds.h: Added.

WebCore:

Add forwarding header for StackBounds.h.

  • ForwardingHeaders/wtf/StackBounds.h: Added.
File size: 2.6 KB
Line 
1##
2## Copyright 2009, The Android Open Source Project
3##
4## Redistribution and use in source and binary forms, with or without
5## modification, are permitted provided that the following conditions
6## are met:
7## * Redistributions of source code must retain the above copyright
8## notice, this list of conditions and the following disclaimer.
9## * Redistributions in binary form must reproduce the above copyright
10## notice, this list of conditions and the following disclaimer in the
11## documentation and/or other materials provided with the distribution.
12##
13## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24##
25
26# wtf source files
27
28LOCAL_SRC_FILES := \
29 pcre/pcre_compile.cpp \
30 pcre/pcre_exec.cpp \
31 pcre/pcre_tables.cpp \
32 pcre/pcre_ucp_searchfuncs.cpp \
33 pcre/pcre_xclass.cpp \
34 \
35 wtf/Assertions.cpp \
36 wtf/ByteArray.cpp \
37 wtf/CurrentTime.cpp \
38 wtf/DateMath.cpp \
39 wtf/DecimalNumber.cpp \
40 wtf/FastMalloc.cpp \
41 wtf/HashTable.cpp \
42 wtf/MainThread.cpp \
43 wtf/RandomNumber.cpp \
44 wtf/RefCountedLeakCounter.cpp \
45 wtf/StackBounds.cpp \
46 wtf/TCSystemAlloc.cpp \
47 wtf/ThreadIdentifierDataPthreads.cpp \
48 wtf/Threading.cpp \
49 wtf/ThreadingPthreads.cpp \
50 wtf/WTFThreadData.cpp \
51 \
52 wtf/TypeTraits.cpp \
53 wtf/dtoa.cpp \
54 \
55 wtf/android/MainThreadAndroid.cpp \
56 \
57 wtf/text/AtomicString.cpp \
58 wtf/text/CString.cpp \
59 wtf/text/StringBuidler.cpp \
60 wtf/text/StringImpl.cpp \
61 wtf/text/WTFString.cpp \
62 \
63 wtf/unicode/CollatorDefault.cpp \
64 wtf/unicode/UTF8.cpp \
65 \
66 wtf/unicode/icu/CollatorICU.cpp
67
68CHARTABLES := $(intermediates)/chartables.c
69$(CHARTABLES): PRIVATE_PATH := $(LOCAL_PATH)
70$(CHARTABLES): PRIVATE_CUSTOM_TOOL = perl $(PRIVATE_PATH)/pcre/dftables $@
71$(CHARTABLES): $(LOCAL_PATH)/pcre/dftables
72$(CHARTABLES): $(LOCAL_PATH)/pcre/pcre_internal.h
73 $(transform-generated-source)
74
75$(intermediates)/pcre/pcre_tables.o : $(CHARTABLES)
76
77# We do not add $(CHARTABLES) to LOCAL_GENERATED_SOURCES because the chartables.c file
78# is explicitly #included in pcre_tables.cpp.
Note: See TracBrowser for help on using the repository browser.