source: webkit/trunk/JavaScriptCore/runtime/Operations.cpp@ 51197

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

2009-11-19 Laszlo Gombos <Laszlo Gombos>

Reviewed by Darin Adler.

Remove HAVE(FLOAT_H) guard
https://bugs.webkit.org/show_bug.cgi?id=31661

JavaScriptCore has a dependency on float.h, there is
no need to guard float.h.

  • runtime/DatePrototype.cpp: Remove include directive for float.h as it is included in MathExtras.h already.
  • runtime/Operations.cpp: Ditto.
  • runtime/UString.cpp: Ditto.
  • wtf/dtoa.cpp: Ditto.
  • wtf/MathExtras.h: Remove HAVE(FLOAT_H) guard.
  • wtf/Platform.h: Ditto.

2009-11-19 Laszlo Gombos <Laszlo Gombos>

Reviewed by Darin Adler.

Remove HAVE(FLOAT_H) guard
https://bugs.webkit.org/show_bug.cgi?id=31661

WebCore has a dependency on float.h, there is
no need to guard float.h.

No new tests as there is no functional change.

  • html/HTMLInputElement.cpp: Remove include directive for float.h as it is included in MathExtras.h already.
  • Property svn:eol-style set to native
File size: 3.6 KB
Line 
1/*
2 * Copyright (C) 1999-2000 Harri Porten ([email protected])
3 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 */
21
22#include "config.h"
23#include "Operations.h"
24
25#include "Error.h"
26#include "JSObject.h"
27#include "JSString.h"
28#include <math.h>
29#include <stdio.h>
30#include <wtf/MathExtras.h>
31
32namespace JSC {
33
34bool JSValue::equalSlowCase(ExecState* exec, JSValue v1, JSValue v2)
35{
36 return equalSlowCaseInline(exec, v1, v2);
37}
38
39bool JSValue::strictEqualSlowCase(JSValue v1, JSValue v2)
40{
41 return strictEqualSlowCaseInline(v1, v2);
42}
43
44NEVER_INLINE JSValue throwOutOfMemoryError(ExecState* exec)
45{
46 JSObject* error = Error::create(exec, GeneralError, "Out of memory");
47 exec->setException(error);
48 return error;
49}
50
51NEVER_INLINE JSValue jsAddSlowCase(CallFrame* callFrame, JSValue v1, JSValue v2)
52{
53 // exception for the Date exception in defaultValue()
54 JSValue p1 = v1.toPrimitive(callFrame);
55 JSValue p2 = v2.toPrimitive(callFrame);
56
57 if (p1.isString() || p2.isString()) {
58 RefPtr<UString::Rep> value = concatenate(p1.toString(callFrame).rep(), p2.toString(callFrame).rep());
59 if (!value)
60 return throwOutOfMemoryError(callFrame);
61 return jsString(callFrame, value.release());
62 }
63
64 return jsNumber(callFrame, p1.toNumber(callFrame) + p2.toNumber(callFrame));
65}
66
67JSValue jsTypeStringForValue(CallFrame* callFrame, JSValue v)
68{
69 if (v.isUndefined())
70 return jsNontrivialString(callFrame, "undefined");
71 if (v.isBoolean())
72 return jsNontrivialString(callFrame, "boolean");
73 if (v.isNumber())
74 return jsNontrivialString(callFrame, "number");
75 if (v.isString())
76 return jsNontrivialString(callFrame, "string");
77 if (v.isObject()) {
78 // Return "undefined" for objects that should be treated
79 // as null when doing comparisons.
80 if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined())
81 return jsNontrivialString(callFrame, "undefined");
82 CallData callData;
83 if (asObject(v)->getCallData(callData) != CallTypeNone)
84 return jsNontrivialString(callFrame, "function");
85 }
86 return jsNontrivialString(callFrame, "object");
87}
88
89bool jsIsObjectType(JSValue v)
90{
91 if (!v.isCell())
92 return v.isNull();
93
94 JSType type = asCell(v)->structure()->typeInfo().type();
95 if (type == NumberType || type == StringType)
96 return false;
97 if (type == ObjectType) {
98 if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined())
99 return false;
100 CallData callData;
101 if (asObject(v)->getCallData(callData) != CallTypeNone)
102 return false;
103 }
104 return true;
105}
106
107bool jsIsFunctionType(JSValue v)
108{
109 if (v.isObject()) {
110 CallData callData;
111 if (asObject(v)->getCallData(callData) != CallTypeNone)
112 return true;
113 }
114 return false;
115}
116
117} // namespace JSC
Note: See TracBrowser for help on using the repository browser.