Ignore:
Timestamp:
Sep 3, 2005, 6:18:13 PM (20 years ago)
Author:
darin
Message:

Reviewed, tweaked and landed by Darin.

  • some Windows compilation fixes, hoping to fix the problems reported in these bugs: 4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
  • kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside KJS_MULTIPLE_THREADS #if directives. (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
  • kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
  • kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and copysign for Win32. (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe that on Win32 there's some other call before that setting errno.
  • kjs/date_object.h: Remove unneeded include of <sys/time.h>.
  • kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
  • kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32. (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++. (KJS::sbrk): Change parameter type to match the declaration.
  • kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
  • kjs/function.h: Remove unneeded friend class Function for FunctionImp.
  • kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the non-AVOID_STATIC_CONSTRUCTORS code path.
  • kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>! Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
  • kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this specific to Mac OS X if we like.
  • kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
  • kjs/list.cpp: (KJS::ListImp::markValues): Use std::min instead of MIN. (KJS::List::copy): Ditto. (KJS::List::copyTail): Ditto.
  • kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
  • kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint. Put the use of always_inline inside GNUC.
  • kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10" inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen when passing an int rather than a double or float.
  • kjs/operations.cpp: (KJS::isInf): Add Win32 implementation. (KJS::isPosInf): Add Win32 implementation. (KJS::isNegInf): Add Win32 implementation.
  • kjs/regexp.cpp: Use unsigned instead of uint.
  • kjs/regexp.h: Ditto.
  • kjs/regexp_object.cpp: Ditto.
  • kjs/regexp_object.h: Ditto.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/operations.cpp

    r10412 r10456  
    2121 */
    2222
    23 #ifdef HAVE_CONFIG_H
     23#include "operations.h"
     24
    2425#include "config.h"
    25 #endif
    2626
    2727#include <stdio.h>
     
    4040#endif
    4141
    42 #include "operations.h"
    4342#include "object.h"
    4443
    45 using namespace KJS;
     44namespace KJS {
    4645
    4746#if !APPLE_CHANGES
    4847
    49 bool KJS::isNaN(double d)
     48bool isNaN(double d)
    5049{
    5150#ifdef HAVE_FUNC_ISNAN
     
    5857}
    5958
    60 bool KJS::isInf(double d)
    61 {
    62 #if defined(HAVE_FUNC_ISINF)
     59bool isInf(double d)
     60{
     61#if WIN32
     62  int fpClass = _fpclass(d);
     63  return _FPCLASS_PINF == fpClass || _FPCLASS_NINF == fpClass;
     64#elif defined(HAVE_FUNC_ISINF)
    6365  return isinf(d);
    6466#elif HAVE_FUNC_FINITE
     
    7173}
    7274
    73 bool KJS::isPosInf(double d)
    74 {
    75 #if APPLE_CHANGES
    76   return isinf(d) && d > 0;
    77 #else
    78 #if defined(HAVE_FUNC_ISINF)
     75bool isPosInf(double d)
     76{
     77#if WIN32
     78  return _FPCLASS_PINF == _fpclass(d);
     79#elif defined(HAVE_FUNC_ISINF)
    7980  return (isinf(d) == 1);
    8081#elif HAVE_FUNC_FINITE
     
    8586  return false;
    8687#endif
    87 #endif
    88 }
    89 
    90 bool KJS::isNegInf(double d)
    91 {
    92 #if APPLE_CHANGES
    93   return isinf(d) && d < 0;
    94 #else
    95 #if defined(HAVE_FUNC_ISINF)
     88}
     89
     90bool isNegInf(double d)
     91{
     92#if WIN32
     93  return _FPCLASS_PINF == _fpclass(d);
     94#elif defined(HAVE_FUNC_ISINF)
    9695  return (isinf(d) == -1);
    9796#elif HAVE_FUNC_FINITE
     
    102101  return false;
    103102#endif
    104 #endif
    105103}
    106104
     
    108106
    109107// ECMA 11.9.3
    110 bool KJS::equal(ExecState *exec, ValueImp *v1, ValueImp *v2)
     108bool equal(ExecState *exec, ValueImp *v1, ValueImp *v2)
    111109{
    112110    Type t1 = v1->type();
     
    162160}
    163161
    164 bool KJS::strictEqual(ExecState *exec, ValueImp *v1, ValueImp *v2)
     162bool strictEqual(ExecState *exec, ValueImp *v1, ValueImp *v2)
    165163{
    166164  Type t1 = v1->type();
     
    194192}
    195193
    196 int KJS::relation(ExecState *exec, ValueImp *v1, ValueImp *v2)
     194int relation(ExecState *exec, ValueImp *v1, ValueImp *v2)
    197195{
    198196  ValueImp *p1 = v1->toPrimitive(exec,NumberType);
     
    211209}
    212210
    213 int KJS::maxInt(int d1, int d2)
     211int maxInt(int d1, int d2)
    214212{
    215213  return (d1 > d2) ? d1 : d2;
    216214}
    217215
    218 int KJS::minInt(int d1, int d2)
     216int minInt(int d1, int d2)
    219217{
    220218  return (d1 < d2) ? d1 : d2;
     
    222220
    223221// ECMA 11.6
    224 ValueImp *KJS::add(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
     222ValueImp *add(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
    225223{
    226224  // exception for the Date exception in defaultValue()
     
    247245
    248246// ECMA 11.5
    249 ValueImp *KJS::mult(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
     247ValueImp *mult(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
    250248{
    251249  bool n1KnownToBeInteger;
     
    270268  return jsNumber(result, resultKnownToBeInteger);
    271269}
     270
     271}
Note: See TracChangeset for help on using the changeset viewer.