source: webkit/trunk/JavaScriptCore/runtime/JSGlobalData.h@ 39951

Last change on this file since 39951 was 39951, checked in by [email protected], 16 years ago

2009-01-15 Sam Weinig <[email protected]>

Reviewed by Gavin Barraclough.

Fix crash seen running fast/canvas.

Make sure to mark the ScopeNode and CodeBlock being created
in the re-parse for exception information.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
  • parser/Nodes.h: (JSC::ScopeNode::mark):
  • runtime/Collector.cpp: (JSC::Heap::collect):
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • runtime/JSGlobalData.h:
  • Property svn:eol-style set to native
File size: 4.6 KB
Line 
1/*
2 * Copyright (C) 2008 Apple Inc. All rights reserved.
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 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef JSGlobalData_h
30#define JSGlobalData_h
31
32#include <wtf/Forward.h>
33#include <wtf/HashMap.h>
34#include <wtf/RefCounted.h>
35#include "Collector.h"
36#include "ExecutableAllocator.h"
37#include "SmallStrings.h"
38#include "JSValue.h"
39
40struct OpaqueJSClass;
41struct OpaqueJSClassContextData;
42
43namespace JSC {
44
45 class ArgList;
46 class CommonIdentifiers;
47 class Heap;
48 class IdentifierTable;
49 class Interpreter;
50 class JSGlobalObject;
51 class JSObject;
52 class Lexer;
53 class Parser;
54 class ParserRefCounted;
55 class ScopeNode;
56 class Structure;
57 class UString;
58 struct HashTable;
59
60 class JSGlobalData : public RefCounted<JSGlobalData> {
61 public:
62 static bool sharedInstanceExists();
63 static JSGlobalData& sharedInstance();
64
65 static PassRefPtr<JSGlobalData> create();
66 static PassRefPtr<JSGlobalData> createLeaked();
67 ~JSGlobalData();
68
69#if ENABLE(JSC_MULTIPLE_THREADS)
70 // Will start tracking threads that use the heap, which is resource-heavy.
71 void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); }
72#endif
73
74 Interpreter* interpreter;
75
76 JSValuePtr exception;
77#if ENABLE(JIT)
78 void* exceptionLocation;
79#endif
80
81 const HashTable* arrayTable;
82 const HashTable* dateTable;
83 const HashTable* mathTable;
84 const HashTable* numberTable;
85 const HashTable* regExpTable;
86 const HashTable* regExpConstructorTable;
87 const HashTable* stringTable;
88
89 RefPtr<Structure> activationStructure;
90 RefPtr<Structure> interruptedExecutionErrorStructure;
91 RefPtr<Structure> staticScopeStructure;
92 RefPtr<Structure> stringStructure;
93 RefPtr<Structure> notAnObjectErrorStubStructure;
94 RefPtr<Structure> notAnObjectStructure;
95 RefPtr<Structure> numberStructure;
96
97 IdentifierTable* identifierTable;
98 CommonIdentifiers* propertyNames;
99 const ArgList* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark.
100
101 SmallStrings smallStrings;
102
103 HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
104
105 HashSet<ParserRefCounted*>* newParserObjects;
106 HashCountedSet<ParserRefCounted*>* parserObjectExtraRefCounts;
107
108 Lexer* lexer;
109 Parser* parser;
110
111 JSGlobalObject* head;
112 JSGlobalObject* dynamicGlobalObject;
113
114 bool isSharedInstance;
115
116 struct ClientData {
117 virtual ~ClientData() = 0;
118 };
119
120 ClientData* clientData;
121
122 HashSet<JSObject*> arrayVisitedElements;
123
124 ScopeNode* scopeNodeBeingReparsed;
125
126 Heap heap;
127#if ENABLE(ASSEMBLER)
128 PassRefPtr<ExecutablePool> poolForSize(size_t n) { return m_executableAllocator.poolForSize(n); }
129#endif
130 private:
131 JSGlobalData(bool isShared = false);
132#if ENABLE(ASSEMBLER)
133 ExecutableAllocator m_executableAllocator;
134#endif
135
136 static JSGlobalData*& sharedInstanceInternal();
137 };
138
139}
140
141#endif
Note: See TracBrowser for help on using the repository browser.