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

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

2009-01-15 Gavin Barraclough <[email protected]>

Reviewed by Geoff Garen.

On x86-64 allow JSImmediate to encode 64-bit double precision values.
This patch only affects builds that set USE(ALTERNATE_JSIMMEDIATE).

Updates the implementation of JSValuePtr
and JSImmediate:: methods that operate on neumeric values to be be aware of the new representation. When this representation is in use, the class JSNumberCell is redundant and is compiled out.

The format of the new immediate representation is documented in JSImmediate.h.

  • JavaScriptCore.exp:
  • assembler/MacroAssembler.h: (JSC::MacroAssembler::subPtr):
  • assembler/X86Assembler.h: (JSC::X86Assembler::): (JSC::X86Assembler::subq_rr): (JSC::X86Assembler::movq_rr): (JSC::X86Assembler::ucomisd_rr): (JSC::X86Assembler::X86InstructionFormatter::twoByteOp64):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::cti_op_stricteq): (JSC::Interpreter::cti_op_nstricteq):
  • jit/JIT.cpp: (JSC::JIT::compileOpStrictEq): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases):
  • jit/JIT.h:
  • jit/JITArithmetic.cpp: (JSC::JIT::compileFastArith_op_lshift): (JSC::JIT::compileFastArith_op_rshift): (JSC::JIT::compileFastArith_op_bitand): (JSC::JIT::compileFastArith_op_mod): (JSC::JIT::compileFastArith_op_add): (JSC::JIT::compileFastArith_op_mul): (JSC::JIT::compileFastArith_op_post_inc): (JSC::JIT::compileFastArith_op_post_dec): (JSC::JIT::compileFastArith_op_pre_inc): (JSC::JIT::compileFastArith_op_pre_dec): (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate): (JSC::JIT::compileBinaryArithOp):
  • jit/JITInlineMethods.h: (JSC::JIT::emitJumpIfBothJSCells): (JSC::JIT::emitJumpIfEitherNumber): (JSC::JIT::emitJumpIfNotEitherNumber): (JSC::JIT::emitJumpIfImmediateIntegerNumber): (JSC::JIT::emitJumpIfNotImmediateIntegerNumber): (JSC::JIT::emitJumpIfNotImmediateIntegerNumbers): (JSC::JIT::emitJumpSlowCaseIfNotImmediateIntegerNumber): (JSC::JIT::emitJumpSlowCaseIfNotImmediateIntegerNumbers): (JSC::JIT::emitFastArithDeTagImmediate): (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero): (JSC::JIT::emitFastArithReTagImmediate): (JSC::JIT::emitFastArithIntToImmNoCheck):
  • runtime/JSCell.h:
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • runtime/JSImmediate.cpp: (JSC::JSImmediate::toThisObject): (JSC::JSImmediate::toObject): (JSC::JSImmediate::toString):
  • runtime/JSImmediate.h: (JSC::wtf_reinterpret_cast): (JSC::JSImmediate::isNumber): (JSC::JSImmediate::isIntegerNumber): (JSC::JSImmediate::isDoubleNumber): (JSC::JSImmediate::isPositiveIntegerNumber): (JSC::JSImmediate::areBothImmediateIntegerNumbers): (JSC::JSImmediate::makeInt): (JSC::JSImmediate::makeDouble): (JSC::JSImmediate::doubleValue): (JSC::doubleToBoolean): (JSC::JSImmediate::toBoolean): (JSC::JSImmediate::getTruncatedUInt32): (JSC::JSImmediate::makeOutOfIntegerRange): (JSC::JSImmediate::from): (JSC::JSImmediate::getTruncatedInt32): (JSC::JSImmediate::toDouble): (JSC::JSImmediate::getUInt32): (JSC::JSValuePtr::isInt32Fast): (JSC::JSValuePtr::isUInt32Fast): (JSC::JSValuePtr::areBothInt32Fast): (JSC::JSFastMath::canDoFastBitwiseOperations): (JSC::JSFastMath::xorImmediateNumbers): (JSC::JSFastMath::canDoFastRshift): (JSC::JSFastMath::canDoFastUrshift): (JSC::JSFastMath::rightShiftImmediateNumbers): (JSC::JSFastMath::canDoFastAdditiveOperations): (JSC::JSFastMath::addImmediateNumbers): (JSC::JSFastMath::subImmediateNumbers):
  • runtime/JSNumberCell.cpp: (JSC::jsNumberCell):
  • runtime/JSNumberCell.h: (JSC::createNumberStructure): (JSC::isNumberCell): (JSC::asNumberCell): (JSC::jsNumber): (JSC::JSValuePtr::isDoubleNumber): (JSC::JSValuePtr::getDoubleNumber): (JSC::JSValuePtr::isNumber): (JSC::JSValuePtr::uncheckedGetNumber): (JSC::jsNaN): (JSC::JSValuePtr::getNumber): (JSC::JSValuePtr::numberToInt32): (JSC::JSValuePtr::numberToUInt32):
  • runtime/JSValue.h:
  • runtime/NumberConstructor.cpp: (JSC::numberConstructorNegInfinity): (JSC::numberConstructorPosInfinity): (JSC::numberConstructorMaxValue): (JSC::numberConstructorMinValue):
  • runtime/NumberObject.cpp: (JSC::constructNumber):
  • runtime/NumberObject.h:
  • runtime/Operations.h: (JSC::JSValuePtr::equal): (JSC::JSValuePtr::equalSlowCaseInline): (JSC::JSValuePtr::strictEqual): (JSC::JSValuePtr::strictEqualSlowCaseInline):
  • wtf/Platform.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#if !USE(ALTERNATE_JSIMMEDIATE)
96 RefPtr<Structure> numberStructure;
97#endif
98
99 IdentifierTable* identifierTable;
100 CommonIdentifiers* propertyNames;
101 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.
102
103 SmallStrings smallStrings;
104
105 HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
106
107 HashSet<ParserRefCounted*>* newParserObjects;
108 HashCountedSet<ParserRefCounted*>* parserObjectExtraRefCounts;
109
110 Lexer* lexer;
111 Parser* parser;
112
113 JSGlobalObject* head;
114 JSGlobalObject* dynamicGlobalObject;
115
116 bool isSharedInstance;
117
118 struct ClientData {
119 virtual ~ClientData() = 0;
120 };
121
122 ClientData* clientData;
123
124 HashSet<JSObject*> arrayVisitedElements;
125
126 ScopeNode* scopeNodeBeingReparsed;
127
128 Heap heap;
129#if ENABLE(ASSEMBLER)
130 PassRefPtr<ExecutablePool> poolForSize(size_t n) { return m_executableAllocator.poolForSize(n); }
131#endif
132 private:
133 JSGlobalData(bool isShared = false);
134#if ENABLE(ASSEMBLER)
135 ExecutableAllocator m_executableAllocator;
136#endif
137
138 static JSGlobalData*& sharedInstanceInternal();
139 };
140
141}
142
143#endif
Note: See TracBrowser for help on using the repository browser.