source: webkit/trunk/JavaScriptCore/runtime/NumberObject.cpp@ 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: 1.5 KB
Line 
1/*
2 * Copyright (C) 1999-2000,2003 Harri Porten ([email protected])
3 * Copyright (C) 2007, 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 Lesser 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 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18 * USA
19 *
20 */
21
22#include "config.h"
23#include "NumberObject.h"
24
25#include "JSGlobalObject.h"
26#include "NumberPrototype.h"
27
28namespace JSC {
29
30ASSERT_CLASS_FITS_IN_CELL(NumberObject);
31
32const ClassInfo NumberObject::info = { "Number", 0, 0, 0 };
33
34NumberObject::NumberObject(PassRefPtr<Structure> structure)
35 : JSWrapperObject(structure)
36{
37}
38
39JSValuePtr NumberObject::getJSNumber()
40{
41 return internalValue();
42}
43
44NumberObject* constructNumber(ExecState* exec, JSValuePtr number)
45{
46 NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
47 object->setInternalValue(number);
48 return object;
49}
50
51} // namespace JSC
Note: See TracBrowser for help on using the repository browser.