Last change
on this file since 31404 was 31404, checked in by [email protected], 17 years ago |
Reviewed by Sam Weinig.
Fix a dtoa thread safety issue.
WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
compiled in for dtoa.
This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
his recent improvement.
- kjs/dtoa.cpp:
(Bigint::Balloc):
(Bigint::Bfree):
Changed to use fastMalloc/fastDelete - they are much faster than the dtoa custom version was
in the presence of locking (but somewhat slower in single-threaded case).
(Bigint::pow5mult): Got rid of the dreaded double-checked locking anti-pattern (had to
restructure the code to avoid significant performance implications).
(Bigint::lshift): Rewrote to avoid an allocation, if possible.
(Bigint::rv_alloc):
(Bigint::kjs_freedtoa):
(Bigint::kjs_dtoa):
Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.
- kjs/InitializeThreading.cpp: Added.
(KJS::initializeThreading):
- kjs/InitializeThreading.h: Added.
Initialize threading at KJS level, if enabled.
- kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
- kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
- wtf/Threading.h: Removed a using directive for WTF::initializeThreading - it is only
to be called from KJS::initializeThreading, and having it in the global namespace is useless.
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | /*
|
---|
2 | * Copyright (C) 2003 Apple Computer, Inc.
|
---|
3 | *
|
---|
4 | * This library is free software; you can redistribute it and/or
|
---|
5 | * modify it under the terms of the GNU Library General Public
|
---|
6 | * License as published by the Free Software Foundation; either
|
---|
7 | * version 2 of the License, or (at your option) any later version.
|
---|
8 | *
|
---|
9 | * This library is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | * Library General Public License for more details.
|
---|
13 | *
|
---|
14 | * You should have received a copy of the GNU Library General Public License
|
---|
15 | * along with this library; see the file COPYING.LIB. If not, write to
|
---|
16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
---|
17 | * Boston, MA 02110-1301, USA.
|
---|
18 | *
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef KJS_dtoa_h
|
---|
22 | #define KJS_dtoa_h
|
---|
23 |
|
---|
24 | namespace WTF {
|
---|
25 | class Mutex;
|
---|
26 | }
|
---|
27 |
|
---|
28 | namespace KJS {
|
---|
29 | extern WTF::Mutex* s_dtoaP5Mutex;
|
---|
30 | }
|
---|
31 |
|
---|
32 | extern "C" double kjs_strtod(const char* s00, char** se);
|
---|
33 | extern "C" char* kjs_dtoa(double d, int mode, int ndigits,
|
---|
34 | int* decpt, int* sign, char** rve);
|
---|
35 | extern "C" void kjs_freedtoa(char* s);
|
---|
36 |
|
---|
37 | #endif /* KJS_dtoa_h */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.