Changeset 70111 in webkit
- Timestamp:
- Oct 19, 2010 4:55:08 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r70090 r70111 1 2010-10-19 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoffrey Garen. 4 5 Remove support for JSVALUE32 from JSC 6 https://bugs.webkit.org/show_bug.cgi?id=47948 7 8 Remove all the code for supporting JSVALUE32 from JSC. 9 10 * jit/JIT.cpp: 11 (JSC::JIT::privateCompileMainPass): 12 (JSC::JIT::privateCompileSlowCases): 13 * jit/JIT.h: 14 * jit/JITArithmetic.cpp: 15 (JSC::JIT::emit_op_lshift): 16 (JSC::JIT::emitSlow_op_lshift): 17 (JSC::JIT::emit_op_rshift): 18 (JSC::JIT::emitSlow_op_rshift): 19 (JSC::JIT::emit_op_urshift): 20 (JSC::JIT::emitSlow_op_urshift): 21 (JSC::JIT::emit_op_jnless): 22 (JSC::JIT::emitSlow_op_jnless): 23 (JSC::JIT::emit_op_jless): 24 (JSC::JIT::emitSlow_op_jless): 25 (JSC::JIT::emit_op_jlesseq): 26 (JSC::JIT::emitSlow_op_jlesseq): 27 (JSC::JIT::emit_op_bitand): 28 (JSC::JIT::emit_op_post_inc): 29 (JSC::JIT::emit_op_post_dec): 30 (JSC::JIT::emit_op_pre_inc): 31 (JSC::JIT::emit_op_pre_dec): 32 (JSC::JIT::emit_op_mod): 33 (JSC::JIT::emitSlow_op_mod): 34 * jit/JITCall.cpp: 35 * jit/JITInlineMethods.h: 36 (JSC::JIT::emitGetFromCallFrameHeaderPtr): 37 (JSC::JIT::emitGetFromCallFrameHeader32): 38 * jit/JITOpcodes.cpp: 39 (JSC::JIT::emit_op_loop_if_lesseq): 40 (JSC::JIT::emit_op_bitnot): 41 (JSC::JIT::emit_op_next_pname): 42 * jit/JITPropertyAccess.cpp: 43 (JSC::JIT::emit_op_get_by_val): 44 (JSC::JIT::emit_op_put_by_val): 45 * jit/JITStubs.h: 46 * jit/JSInterfaceJIT.h: 47 * jit/SpecializedThunkJIT.h: 48 (JSC::SpecializedThunkJIT::returnDouble): 49 (JSC::SpecializedThunkJIT::tagReturnAsInt32): 50 * jit/ThunkGenerators.cpp: 51 (JSC::sqrtThunkGenerator): 52 (JSC::powThunkGenerator): 53 * runtime/Collector.cpp: 54 (JSC::isPossibleCell): 55 (JSC::typeName): 56 * runtime/JSCell.h: 57 * runtime/JSGlobalData.cpp: 58 (JSC::JSGlobalData::JSGlobalData): 59 * runtime/JSGlobalData.h: 60 * runtime/JSGlobalObject.h: 61 (JSC::Structure::prototypeForLookup): 62 * runtime/JSImmediate.h: 63 (JSC::reinterpretIntptrToDouble): 64 (JSC::JSImmediate::isIntegerNumber): 65 (JSC::JSImmediate::isDouble): 66 (JSC::JSImmediate::areBothImmediateIntegerNumbers): 67 (JSC::JSImmediate::makeDouble): 68 (JSC::JSImmediate::doubleValue): 69 (JSC::JSImmediate::toBoolean): 70 (JSC::JSImmediate::fromNumberOutsideIntegerRange): 71 (JSC::JSImmediate::from): 72 (JSC::JSImmediate::toDouble): 73 (JSC::JSFastMath::rightShiftImmediateNumbers): 74 * runtime/JSNumberCell.cpp: 75 * runtime/JSNumberCell.h: 76 * runtime/JSObject.h: 77 (JSC::JSObject::JSObject): 78 * runtime/JSValue.h: 79 * runtime/NumberObject.h: 80 * wtf/Platform.h: 81 1 82 2010-10-19 Csaba Osztrogonác <ossy@webkit.org> 2 83 -
trunk/JavaScriptCore/jit/JIT.cpp
r69940 r70111 187 187 #endif 188 188 189 #if !USE(JSVALUE32_64)189 #if USE(JSVALUE64) 190 190 if (m_labels[m_bytecodeOffset].isUsed()) 191 191 killLastResultRegister(); … … 196 196 switch (m_interpreter->getOpcodeID(currentInstruction->u.opcode)) { 197 197 DEFINE_BINARY_OP(op_del_by_val) 198 #if USE(JSVALUE32)199 DEFINE_BINARY_OP(op_div)200 #endif201 198 DEFINE_BINARY_OP(op_in) 202 199 DEFINE_BINARY_OP(op_less) … … 208 205 DEFINE_UNARY_OP(op_is_string) 209 206 DEFINE_UNARY_OP(op_is_undefined) 210 #if !USE(JSVALUE32_64)207 #if USE(JSVALUE64) 211 208 DEFINE_UNARY_OP(op_negate) 212 209 #endif … … 231 228 DEFINE_OP(op_debug) 232 229 DEFINE_OP(op_del_by_id) 233 #if !USE(JSVALUE32)234 230 DEFINE_OP(op_div) 235 #endif236 231 DEFINE_OP(op_end) 237 232 DEFINE_OP(op_enter) … … 378 373 379 374 for (Vector<SlowCaseEntry>::iterator iter = m_slowCases.begin(); iter != m_slowCases.end();) { 380 #if !USE(JSVALUE32_64)375 #if USE(JSVALUE64) 381 376 killLastResultRegister(); 382 377 #endif … … 400 395 DEFINE_SLOWCASE_OP(op_convert_this) 401 396 DEFINE_SLOWCASE_OP(op_convert_this_strict) 402 #if !USE(JSVALUE32)403 397 DEFINE_SLOWCASE_OP(op_div) 404 #endif405 398 DEFINE_SLOWCASE_OP(op_eq) 406 399 DEFINE_SLOWCASE_OP(op_get_by_id) … … 600 593 } 601 594 602 #if !USE(JSVALUE32_64)595 #if USE(JSVALUE64) 603 596 void JIT::emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst) 604 597 { -
trunk/JavaScriptCore/jit/JIT.h
r69940 r70111 517 517 void emitJumpSlowCaseIfNotJSCell(RegisterID); 518 518 void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg); 519 #if USE(JSVALUE64) 520 #else 519 #if USE(JSVALUE32_64) 521 520 JIT::Jump emitJumpIfImmediateNumber(RegisterID reg) 522 521 { … … 536 535 void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID); 537 536 538 #if !USE(JSVALUE64)537 #if USE(JSVALUE32_64) 539 538 void emitFastArithDeTagImmediate(RegisterID); 540 539 Jump emitFastArithDeTagImmediateJumpIfZero(RegisterID); -
trunk/JavaScriptCore/jit/JITArithmetic.cpp
r66524 r70111 27 27 28 28 #if ENABLE(JIT) 29 #if !USE(JSVALUE32_64)29 #if USE(JSVALUE64) 30 30 #include "JIT.h" 31 31 … … 61 61 emitFastArithImmToInt(regT2); 62 62 lshift32(regT2, regT0); 63 #if USE(JSVALUE32)64 addSlowCase(branchAdd32(Overflow, regT0, regT0));65 signExtend32ToPtr(regT0, regT0);66 #endif67 63 emitFastArithReTagImmediate(regT0, regT0); 68 64 emitPutVirtualRegister(result); … … 75 71 unsigned op2 = currentInstruction[3].u.operand; 76 72 77 #if USE(JSVALUE64)78 73 UNUSED_PARAM(op1); 79 74 UNUSED_PARAM(op2); 80 75 linkSlowCase(iter); 81 76 linkSlowCase(iter); 82 #else83 // If we are limited to 32-bit immediates there is a third slow case, which required the operands to have been reloaded.84 Jump notImm1 = getSlowCase(iter);85 Jump notImm2 = getSlowCase(iter);86 linkSlowCase(iter);87 emitGetVirtualRegisters(op1, regT0, op2, regT2);88 notImm1.link(this);89 notImm2.link(this);90 #endif91 77 JITStubCall stubCall(this, cti_op_lshift); 92 78 stubCall.addArgument(regT0); … … 111 97 if (supportsFloatingPointTruncate()) { 112 98 Jump lhsIsInt = emitJumpIfImmediateInteger(regT0); 113 #if USE(JSVALUE64)114 99 // supportsFloatingPoint() && USE(JSVALUE64) => 3 SlowCases 115 100 addSlowCase(emitJumpIfNotImmediateNumber(regT0)); … … 117 102 movePtrToDouble(regT0, fpRegT0); 118 103 addSlowCase(branchTruncateDoubleToInt32(fpRegT0, regT0)); 119 #else120 // supportsFloatingPoint() && !USE(JSVALUE64) => 5 SlowCases (of which 1 IfNotJSCell)121 emitJumpSlowCaseIfNotJSCell(regT0, op1);122 addSlowCase(checkStructure(regT0, m_globalData->numberStructure.get()));123 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);124 addSlowCase(branchTruncateDoubleToInt32(fpRegT0, regT0));125 addSlowCase(branchAdd32(Overflow, regT0, regT0));126 #endif127 104 lhsIsInt.link(this); 128 105 emitJumpSlowCaseIfNotImmediateInteger(regT2); … … 134 111 emitFastArithImmToInt(regT2); 135 112 rshift32(regT2, regT0); 136 #if USE(JSVALUE32) 137 signExtend32ToPtr(regT0, regT0); 138 #endif 139 } 140 #if USE(JSVALUE64) 113 } 141 114 emitFastArithIntToImmNoCheck(regT0, regT0); 142 #else143 orPtr(Imm32(JSImmediate::TagTypeNumber), regT0);144 #endif145 115 emitPutVirtualRegister(result); 146 116 } … … 160 130 } else { 161 131 if (supportsFloatingPointTruncate()) { 162 #if USE(JSVALUE64)163 132 linkSlowCase(iter); 164 133 linkSlowCase(iter); 165 134 linkSlowCase(iter); 166 #else167 linkSlowCaseIfNotJSCell(iter, op1);168 linkSlowCase(iter);169 linkSlowCase(iter);170 linkSlowCase(iter);171 linkSlowCase(iter);172 #endif173 135 // We're reloading op1 to regT0 as we can no longer guarantee that 174 136 // we have not munged the operand. It may have already been shifted … … 207 169 if (shift < 0 || !(shift & 31)) 208 170 addSlowCase(branch32(LessThan, regT0, Imm32(0))); 209 #if USE(JSVALUE32)210 addSlowCase(branchAdd32(Overflow, regT0, regT0));211 signExtend32ToPtr(regT0, regT0);212 #endif213 171 emitFastArithReTagImmediate(regT0, regT0); 214 172 emitPutVirtualRegister(dst, regT0); … … 223 181 urshift32(regT1, regT0); 224 182 addSlowCase(branch32(LessThan, regT0, Imm32(0))); 225 #if USE(JSVALUE32)226 addSlowCase(branchAdd32(Overflow, regT0, regT0));227 signExtend32ToPtr(regT0, regT0);228 #endif229 183 emitFastArithReTagImmediate(regT0, regT0); 230 184 emitPutVirtualRegister(dst, regT0); … … 240 194 // op1 = regT0 241 195 linkSlowCase(iter); // int32 check 242 #if USE(JSVALUE64)243 196 if (supportsFloatingPointTruncate()) { 244 197 JumpList failures; … … 256 209 failures.link(this); 257 210 } 258 #endif // JSVALUE64259 211 if (shift < 0 || !(shift & 31)) 260 212 linkSlowCase(iter); // failed to box in hot path 261 #if USE(JSVALUE32)262 linkSlowCase(iter); // Couldn't box result263 #endif264 213 } else { 265 214 // op1 = regT0 … … 267 216 if (!isOperandConstantImmediateInt(op1)) { 268 217 linkSlowCase(iter); // int32 check -- op1 is not an int 269 #if USE(JSVALUE64)270 218 if (supportsFloatingPointTruncate()) { 271 219 JumpList failures; … … 283 231 failures.link(this); 284 232 } 285 #endif286 233 } 287 234 288 235 linkSlowCase(iter); // int32 check - op2 is not an int 289 236 linkSlowCase(iter); // Can't represent unsigned result as an immediate 290 #if USE(JSVALUE32)291 linkSlowCase(iter); // Couldn't box result292 #endif293 237 } 294 238 … … 331 275 emitGetVirtualRegister(op1, regT0); 332 276 emitJumpSlowCaseIfNotImmediateInteger(regT0); 333 #if USE(JSVALUE64)334 277 int32_t op2imm = getConstantOperandImmediateInt(op2); 335 #else336 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));337 #endif338 278 addJump(branch32(GreaterThanOrEqual, regT0, Imm32(op2imm)), target); 339 279 } else if (isOperandConstantImmediateInt(op1)) { 340 280 emitGetVirtualRegister(op2, regT1); 341 281 emitJumpSlowCaseIfNotImmediateInteger(regT1); 342 #if USE(JSVALUE64)343 282 int32_t op1imm = getConstantOperandImmediateInt(op1); 344 #else345 int32_t op1imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)));346 #endif347 283 addJump(branch32(LessThanOrEqual, regT1, Imm32(op1imm)), target); 348 284 } else { … … 382 318 383 319 if (supportsFloatingPoint()) { 384 #if USE(JSVALUE64)385 320 Jump fail1 = emitJumpIfNotImmediateNumber(regT0); 386 321 addPtr(tagTypeNumberRegister, regT0); 387 322 movePtrToDouble(regT0, fpRegT0); 388 #else389 Jump fail1;390 if (!m_codeBlock->isKnownNotImmediate(op1))391 fail1 = emitJumpIfNotJSCell(regT0);392 393 Jump fail2 = checkStructure(regT0, m_globalData->numberStructure.get());394 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);395 #endif396 323 397 324 int32_t op2imm = getConstantOperand(op2).asInt32();; … … 404 331 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless)); 405 332 406 #if USE(JSVALUE64)407 333 fail1.link(this); 408 #else409 if (!m_codeBlock->isKnownNotImmediate(op1))410 fail1.link(this);411 fail2.link(this);412 #endif413 334 } 414 335 … … 423 344 424 345 if (supportsFloatingPoint()) { 425 #if USE(JSVALUE64)426 346 Jump fail1 = emitJumpIfNotImmediateNumber(regT1); 427 347 addPtr(tagTypeNumberRegister, regT1); 428 348 movePtrToDouble(regT1, fpRegT1); 429 #else430 Jump fail1;431 if (!m_codeBlock->isKnownNotImmediate(op2))432 fail1 = emitJumpIfNotJSCell(regT1);433 434 Jump fail2 = checkStructure(regT1, m_globalData->numberStructure.get());435 loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);436 #endif437 349 438 350 int32_t op1imm = getConstantOperand(op1).asInt32();; … … 445 357 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless)); 446 358 447 #if USE(JSVALUE64)448 359 fail1.link(this); 449 #else450 if (!m_codeBlock->isKnownNotImmediate(op2))451 fail1.link(this);452 fail2.link(this);453 #endif454 360 } 455 361 … … 464 370 465 371 if (supportsFloatingPoint()) { 466 #if USE(JSVALUE64)467 372 Jump fail1 = emitJumpIfNotImmediateNumber(regT0); 468 373 Jump fail2 = emitJumpIfNotImmediateNumber(regT1); … … 472 377 movePtrToDouble(regT0, fpRegT0); 473 378 movePtrToDouble(regT1, fpRegT1); 474 #else475 Jump fail1;476 if (!m_codeBlock->isKnownNotImmediate(op1))477 fail1 = emitJumpIfNotJSCell(regT0);478 479 Jump fail2;480 if (!m_codeBlock->isKnownNotImmediate(op2))481 fail2 = emitJumpIfNotJSCell(regT1);482 483 Jump fail3 = checkStructure(regT0, m_globalData->numberStructure.get());484 Jump fail4 = checkStructure(regT1, m_globalData->numberStructure.get());485 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);486 loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);487 #endif488 379 489 380 emitJumpSlowToHot(branchDouble(DoubleLessThanOrEqualOrUnordered, fpRegT1, fpRegT0), target); … … 491 382 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless)); 492 383 493 #if USE(JSVALUE64)494 384 fail1.link(this); 495 385 fail2.link(this); 496 386 fail3.link(this); 497 #else498 if (!m_codeBlock->isKnownNotImmediate(op1))499 fail1.link(this);500 if (!m_codeBlock->isKnownNotImmediate(op2))501 fail2.link(this);502 fail3.link(this);503 fail4.link(this);504 #endif505 387 } 506 388 … … 546 428 emitGetVirtualRegister(op1, regT0); 547 429 emitJumpSlowCaseIfNotImmediateInteger(regT0); 548 #if USE(JSVALUE64)549 430 int32_t op2imm = getConstantOperandImmediateInt(op2); 550 #else551 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));552 #endif553 431 addJump(branch32(LessThan, regT0, Imm32(op2imm)), target); 554 432 } else if (isOperandConstantImmediateInt(op1)) { 555 433 emitGetVirtualRegister(op2, regT1); 556 434 emitJumpSlowCaseIfNotImmediateInteger(regT1); 557 #if USE(JSVALUE64)558 435 int32_t op1imm = getConstantOperandImmediateInt(op1); 559 #else560 int32_t op1imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)));561 #endif562 436 addJump(branch32(GreaterThan, regT1, Imm32(op1imm)), target); 563 437 } else { … … 597 471 598 472 if (supportsFloatingPoint()) { 599 #if USE(JSVALUE64)600 473 Jump fail1 = emitJumpIfNotImmediateNumber(regT0); 601 474 addPtr(tagTypeNumberRegister, regT0); 602 475 movePtrToDouble(regT0, fpRegT0); 603 #else604 Jump fail1;605 if (!m_codeBlock->isKnownNotImmediate(op1))606 fail1 = emitJumpIfNotJSCell(regT0);607 608 Jump fail2 = checkStructure(regT0, m_globalData->numberStructure.get());609 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);610 #endif611 476 612 477 int32_t op2imm = getConstantOperand(op2).asInt32(); … … 619 484 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless)); 620 485 621 #if USE(JSVALUE64)622 486 fail1.link(this); 623 #else624 if (!m_codeBlock->isKnownNotImmediate(op1))625 fail1.link(this);626 fail2.link(this);627 #endif628 487 } 629 488 … … 638 497 639 498 if (supportsFloatingPoint()) { 640 #if USE(JSVALUE64)641 499 Jump fail1 = emitJumpIfNotImmediateNumber(regT1); 642 500 addPtr(tagTypeNumberRegister, regT1); 643 501 movePtrToDouble(regT1, fpRegT1); 644 #else645 Jump fail1;646 if (!m_codeBlock->isKnownNotImmediate(op2))647 fail1 = emitJumpIfNotJSCell(regT1);648 649 Jump fail2 = checkStructure(regT1, m_globalData->numberStructure.get());650 loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);651 #endif652 502 653 503 int32_t op1imm = getConstantOperand(op1).asInt32(); … … 660 510 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless)); 661 511 662 #if USE(JSVALUE64)663 512 fail1.link(this); 664 #else665 if (!m_codeBlock->isKnownNotImmediate(op2))666 fail1.link(this);667 fail2.link(this);668 #endif669 513 } 670 514 … … 679 523 680 524 if (supportsFloatingPoint()) { 681 #if USE(JSVALUE64)682 525 Jump fail1 = emitJumpIfNotImmediateNumber(regT0); 683 526 Jump fail2 = emitJumpIfNotImmediateNumber(regT1); … … 687 530 movePtrToDouble(regT0, fpRegT0); 688 531 movePtrToDouble(regT1, fpRegT1); 689 #else690 Jump fail1;691 if (!m_codeBlock->isKnownNotImmediate(op1))692 fail1 = emitJumpIfNotJSCell(regT0);693 694 Jump fail2;695 if (!m_codeBlock->isKnownNotImmediate(op2))696 fail2 = emitJumpIfNotJSCell(regT1);697 698 Jump fail3 = checkStructure(regT0, m_globalData->numberStructure.get());699 Jump fail4 = checkStructure(regT1, m_globalData->numberStructure.get());700 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);701 loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);702 #endif703 532 704 533 emitJumpSlowToHot(branchDouble(DoubleLessThan, fpRegT0, fpRegT1), target); … … 706 535 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless)); 707 536 708 #if USE(JSVALUE64)709 537 fail1.link(this); 710 538 fail2.link(this); 711 539 fail3.link(this); 712 #else713 if (!m_codeBlock->isKnownNotImmediate(op1))714 fail1.link(this);715 if (!m_codeBlock->isKnownNotImmediate(op2))716 fail2.link(this);717 fail3.link(this);718 fail4.link(this);719 #endif720 540 } 721 541 … … 761 581 emitGetVirtualRegister(op1, regT0); 762 582 emitJumpSlowCaseIfNotImmediateInteger(regT0); 763 #if USE(JSVALUE64)764 583 int32_t op2imm = getConstantOperandImmediateInt(op2); 765 #else766 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));767 #endif768 584 addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(op2imm)), target); 769 585 } else if (isOperandConstantImmediateInt(op1)) { 770 586 emitGetVirtualRegister(op2, regT1); 771 587 emitJumpSlowCaseIfNotImmediateInteger(regT1); 772 #if USE(JSVALUE64)773 588 int32_t op1imm = getConstantOperandImmediateInt(op1); 774 #else775 int32_t op1imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)));776 #endif777 589 addJump(branch32(invert ? LessThan : GreaterThanOrEqual, regT1, Imm32(op1imm)), target); 778 590 } else { … … 813 625 814 626 if (supportsFloatingPoint()) { 815 #if USE(JSVALUE64)816 627 Jump fail1 = emitJumpIfNotImmediateNumber(regT0); 817 628 addPtr(tagTypeNumberRegister, regT0); 818 629 movePtrToDouble(regT0, fpRegT0); 819 #else820 Jump fail1;821 if (!m_codeBlock->isKnownNotImmediate(op1))822 fail1 = emitJumpIfNotJSCell(regT0);823 824 Jump fail2 = checkStructure(regT0, m_globalData->numberStructure.get());825 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);826 #endif827 630 828 631 int32_t op2imm = getConstantOperand(op2).asInt32();; … … 835 638 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq)); 836 639 837 #if USE(JSVALUE64)838 640 fail1.link(this); 839 #else840 if (!m_codeBlock->isKnownNotImmediate(op1))841 fail1.link(this);842 fail2.link(this);843 #endif844 641 } 845 642 … … 854 651 855 652 if (supportsFloatingPoint()) { 856 #if USE(JSVALUE64)857 653 Jump fail1 = emitJumpIfNotImmediateNumber(regT1); 858 654 addPtr(tagTypeNumberRegister, regT1); 859 655 movePtrToDouble(regT1, fpRegT1); 860 #else861 Jump fail1;862 if (!m_codeBlock->isKnownNotImmediate(op2))863 fail1 = emitJumpIfNotJSCell(regT1);864 865 Jump fail2 = checkStructure(regT1, m_globalData->numberStructure.get());866 loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);867 #endif868 656 869 657 int32_t op1imm = getConstantOperand(op1).asInt32();; … … 876 664 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq)); 877 665 878 #if USE(JSVALUE64)879 666 fail1.link(this); 880 #else881 if (!m_codeBlock->isKnownNotImmediate(op2))882 fail1.link(this);883 fail2.link(this);884 #endif885 667 } 886 668 … … 895 677 896 678 if (supportsFloatingPoint()) { 897 #if USE(JSVALUE64)898 679 Jump fail1 = emitJumpIfNotImmediateNumber(regT0); 899 680 Jump fail2 = emitJumpIfNotImmediateNumber(regT1); … … 903 684 movePtrToDouble(regT0, fpRegT0); 904 685 movePtrToDouble(regT1, fpRegT1); 905 #else906 Jump fail1;907 if (!m_codeBlock->isKnownNotImmediate(op1))908 fail1 = emitJumpIfNotJSCell(regT0);909 910 Jump fail2;911 if (!m_codeBlock->isKnownNotImmediate(op2))912 fail2 = emitJumpIfNotJSCell(regT1);913 914 Jump fail3 = checkStructure(regT0, m_globalData->numberStructure.get());915 Jump fail4 = checkStructure(regT1, m_globalData->numberStructure.get());916 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0);917 loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1);918 #endif919 686 920 687 emitJumpSlowToHot(branchDouble(invert ? DoubleLessThanOrUnordered : DoubleGreaterThanOrEqual, fpRegT1, fpRegT0), target); … … 922 689 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq)); 923 690 924 #if USE(JSVALUE64)925 691 fail1.link(this); 926 692 fail2.link(this); 927 693 fail3.link(this); 928 #else929 if (!m_codeBlock->isKnownNotImmediate(op1))930 fail1.link(this);931 if (!m_codeBlock->isKnownNotImmediate(op2))932 fail2.link(this);933 fail3.link(this);934 fail4.link(this);935 #endif936 694 } 937 695 … … 964 722 emitGetVirtualRegister(op2, regT0); 965 723 emitJumpSlowCaseIfNotImmediateInteger(regT0); 966 #if USE(JSVALUE64)967 724 int32_t imm = getConstantOperandImmediateInt(op1); 968 725 andPtr(Imm32(imm), regT0); 969 726 if (imm >= 0) 970 727 emitFastArithIntToImmNoCheck(regT0, regT0); 971 #else972 andPtr(Imm32(static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1)))), regT0);973 #endif974 728 } else if (isOperandConstantImmediateInt(op2)) { 975 729 emitGetVirtualRegister(op1, regT0); 976 730 emitJumpSlowCaseIfNotImmediateInteger(regT0); 977 #if USE(JSVALUE64)978 731 int32_t imm = getConstantOperandImmediateInt(op2); 979 732 andPtr(Imm32(imm), regT0); 980 733 if (imm >= 0) 981 734 emitFastArithIntToImmNoCheck(regT0, regT0); 982 #else983 andPtr(Imm32(static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)))), regT0);984 #endif985 735 } else { 986 736 emitGetVirtualRegisters(op1, regT0, op2, regT1); … … 1024 774 move(regT0, regT1); 1025 775 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1026 #if USE(JSVALUE64)1027 776 addSlowCase(branchAdd32(Overflow, Imm32(1), regT1)); 1028 777 emitFastArithIntToImmNoCheck(regT1, regT1); 1029 #else1030 addSlowCase(branchAdd32(Overflow, Imm32(1 << JSImmediate::IntegerPayloadShift), regT1));1031 signExtend32ToPtr(regT1, regT1);1032 #endif1033 778 emitPutVirtualRegister(srcDst, regT1); 1034 779 emitPutVirtualRegister(result); … … 1056 801 move(regT0, regT1); 1057 802 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1058 #if USE(JSVALUE64)1059 803 addSlowCase(branchSub32(Zero, Imm32(1), regT1)); 1060 804 emitFastArithIntToImmNoCheck(regT1, regT1); 1061 #else1062 addSlowCase(branchSub32(Zero, Imm32(1 << JSImmediate::IntegerPayloadShift), regT1));1063 signExtend32ToPtr(regT1, regT1);1064 #endif1065 805 emitPutVirtualRegister(srcDst, regT1); 1066 806 emitPutVirtualRegister(result); … … 1086 826 emitGetVirtualRegister(srcDst, regT0); 1087 827 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1088 #if USE(JSVALUE64)1089 828 addSlowCase(branchAdd32(Overflow, Imm32(1), regT0)); 1090 829 emitFastArithIntToImmNoCheck(regT0, regT0); 1091 #else1092 addSlowCase(branchAdd32(Overflow, Imm32(1 << JSImmediate::IntegerPayloadShift), regT0));1093 signExtend32ToPtr(regT0, regT0);1094 #endif1095 830 emitPutVirtualRegister(srcDst); 1096 831 } … … 1115 850 emitGetVirtualRegister(srcDst, regT0); 1116 851 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1117 #if USE(JSVALUE64)1118 852 addSlowCase(branchSub32(Zero, Imm32(1), regT0)); 1119 853 emitFastArithIntToImmNoCheck(regT0, regT0); 1120 #else1121 addSlowCase(branchSub32(Zero, Imm32(1 << JSImmediate::IntegerPayloadShift), regT0));1122 signExtend32ToPtr(regT0, regT0);1123 #endif1124 854 emitPutVirtualRegister(srcDst); 1125 855 } … … 1159 889 emitJumpSlowCaseIfNotImmediateInteger(regT2); 1160 890 1161 #if USE(JSVALUE64)1162 891 addSlowCase(branchPtr(Equal, regT2, ImmPtr(JSValue::encode(jsNumber(m_globalData, 0))))); 1163 892 m_assembler.cdq(); 1164 893 m_assembler.idivl_r(regT2); 1165 #else1166 emitFastArithDeTagImmediate(regT0);1167 addSlowCase(emitFastArithDeTagImmediateJumpIfZero(regT2));1168 #if CPU(X86) || CPU(X86_64)1169 m_assembler.cdq();1170 m_assembler.idivl_r(regT2);1171 signExtend32ToPtr(regT1, regT1);1172 #elif CPU(MIPS)1173 m_assembler.div(regT0, regT2);1174 m_assembler.mfhi(regT1);1175 #endif1176 #endif1177 894 emitFastArithReTagImmediate(regT1, regT0); 1178 895 emitPutVirtualRegister(result); … … 1183 900 unsigned result = currentInstruction[1].u.operand; 1184 901 1185 #if USE(JSVALUE64) 1186 linkSlowCase(iter); 1187 linkSlowCase(iter); 1188 linkSlowCase(iter); 1189 #else 1190 Jump notImm1 = getSlowCase(iter); 1191 Jump notImm2 = getSlowCase(iter); 1192 linkSlowCase(iter); 1193 emitFastArithReTagImmediate(regT0, regT0); 1194 emitFastArithReTagImmediate(regT2, regT2); 1195 notImm1.link(this); 1196 notImm2.link(this); 1197 #endif 902 linkSlowCase(iter); 903 linkSlowCase(iter); 904 linkSlowCase(iter); 1198 905 JITStubCall stubCall(this, cti_op_mod); 1199 906 stubCall.addArgument(regT0); … … 1249 956 1250 957 /* ------------------------------ END: OP_MOD ------------------------------ */ 1251 1252 #if USE(JSVALUE64)1253 958 1254 959 /* ------------------------------ BEGIN: USE(JSVALUE64) (OP_ADD, OP_SUB, OP_MUL) ------------------------------ */ … … 1544 1249 } 1545 1250 1546 #else // USE(JSVALUE64) 1547 1548 /* ------------------------------ BEGIN: !USE(JSVALUE64) (OP_ADD, OP_SUB, OP_MUL) ------------------------------ */ 1549 1550 void JIT::compileBinaryArithOp(OpcodeID opcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes types) 1551 { 1552 Structure* numberStructure = m_globalData->numberStructure.get(); 1553 Jump wasJSNumberCell1; 1554 Jump wasJSNumberCell2; 1555 1556 emitGetVirtualRegisters(src1, regT0, src2, regT1); 1557 1558 if (types.second().isReusable() && supportsFloatingPoint()) { 1559 ASSERT(types.second().mightBeNumber()); 1560 1561 // Check op2 is a number 1562 Jump op2imm = emitJumpIfImmediateInteger(regT1); 1563 if (!types.second().definitelyIsNumber()) { 1564 emitJumpSlowCaseIfNotJSCell(regT1, src2); 1565 addSlowCase(checkStructure(regT1, numberStructure)); 1566 } 1567 1568 // (1) In this case src2 is a reusable number cell. 1569 // Slow case if src1 is not a number type. 1570 Jump op1imm = emitJumpIfImmediateInteger(regT0); 1571 if (!types.first().definitelyIsNumber()) { 1572 emitJumpSlowCaseIfNotJSCell(regT0, src1); 1573 addSlowCase(checkStructure(regT0, numberStructure)); 1574 } 1575 1576 // (1a) if we get here, src1 is also a number cell 1577 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0); 1578 Jump loadedDouble = jump(); 1579 // (1b) if we get here, src1 is an immediate 1580 op1imm.link(this); 1581 emitFastArithImmToInt(regT0); 1582 convertInt32ToDouble(regT0, fpRegT0); 1583 // (1c) 1584 loadedDouble.link(this); 1585 if (opcodeID == op_add) 1586 addDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0); 1587 else if (opcodeID == op_sub) 1588 subDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0); 1589 else { 1590 ASSERT(opcodeID == op_mul); 1591 mulDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0); 1592 } 1593 1594 // Store the result to the JSNumberCell and jump. 1595 storeDouble(fpRegT0, Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value))); 1596 move(regT1, regT0); 1597 emitPutVirtualRegister(dst); 1598 wasJSNumberCell2 = jump(); 1599 1600 // (2) This handles cases where src2 is an immediate number. 1601 // Two slow cases - either src1 isn't an immediate, or the subtract overflows. 1602 op2imm.link(this); 1603 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1604 } else if (types.first().isReusable() && supportsFloatingPoint()) { 1605 ASSERT(types.first().mightBeNumber()); 1606 1607 // Check op1 is a number 1608 Jump op1imm = emitJumpIfImmediateInteger(regT0); 1609 if (!types.first().definitelyIsNumber()) { 1610 emitJumpSlowCaseIfNotJSCell(regT0, src1); 1611 addSlowCase(checkStructure(regT0, numberStructure)); 1612 } 1613 1614 // (1) In this case src1 is a reusable number cell. 1615 // Slow case if src2 is not a number type. 1616 Jump op2imm = emitJumpIfImmediateInteger(regT1); 1617 if (!types.second().definitelyIsNumber()) { 1618 emitJumpSlowCaseIfNotJSCell(regT1, src2); 1619 addSlowCase(checkStructure(regT1, numberStructure)); 1620 } 1621 1622 // (1a) if we get here, src2 is also a number cell 1623 loadDouble(Address(regT1, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT1); 1624 Jump loadedDouble = jump(); 1625 // (1b) if we get here, src2 is an immediate 1626 op2imm.link(this); 1627 emitFastArithImmToInt(regT1); 1628 convertInt32ToDouble(regT1, fpRegT1); 1629 // (1c) 1630 loadedDouble.link(this); 1631 loadDouble(Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value)), fpRegT0); 1632 if (opcodeID == op_add) 1633 addDouble(fpRegT1, fpRegT0); 1634 else if (opcodeID == op_sub) 1635 subDouble(fpRegT1, fpRegT0); 1636 else { 1637 ASSERT(opcodeID == op_mul); 1638 mulDouble(fpRegT1, fpRegT0); 1639 } 1640 storeDouble(fpRegT0, Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value))); 1641 emitPutVirtualRegister(dst); 1642 1643 // Store the result to the JSNumberCell and jump. 1644 storeDouble(fpRegT0, Address(regT0, OBJECT_OFFSETOF(JSNumberCell, m_value))); 1645 emitPutVirtualRegister(dst); 1646 wasJSNumberCell1 = jump(); 1647 1648 // (2) This handles cases where src1 is an immediate number. 1649 // Two slow cases - either src2 isn't an immediate, or the subtract overflows. 1650 op1imm.link(this); 1651 emitJumpSlowCaseIfNotImmediateInteger(regT1); 1652 } else 1653 emitJumpSlowCaseIfNotImmediateIntegers(regT0, regT1, regT2); 1654 1655 if (opcodeID == op_add) { 1656 emitFastArithDeTagImmediate(regT0); 1657 addSlowCase(branchAdd32(Overflow, regT1, regT0)); 1658 } else if (opcodeID == op_sub) { 1659 addSlowCase(branchSub32(Overflow, regT1, regT0)); 1660 signExtend32ToPtr(regT0, regT0); 1661 emitFastArithReTagImmediate(regT0, regT0); 1662 } else { 1663 ASSERT(opcodeID == op_mul); 1664 // convert eax & edx from JSImmediates to ints, and check if either are zero 1665 emitFastArithImmToInt(regT1); 1666 Jump op1Zero = emitFastArithDeTagImmediateJumpIfZero(regT0); 1667 Jump op2NonZero = branchTest32(NonZero, regT1); 1668 op1Zero.link(this); 1669 // if either input is zero, add the two together, and check if the result is < 0. 1670 // If it is, we have a problem (N < 0), (N * 0) == -0, not representatble as a JSImmediate. 1671 move(regT0, regT2); 1672 addSlowCase(branchAdd32(Signed, regT1, regT2)); 1673 // Skip the above check if neither input is zero 1674 op2NonZero.link(this); 1675 addSlowCase(branchMul32(Overflow, regT1, regT0)); 1676 signExtend32ToPtr(regT0, regT0); 1677 emitFastArithReTagImmediate(regT0, regT0); 1678 } 1679 emitPutVirtualRegister(dst); 1680 1681 if (types.second().isReusable() && supportsFloatingPoint()) 1682 wasJSNumberCell2.link(this); 1683 else if (types.first().isReusable() && supportsFloatingPoint()) 1684 wasJSNumberCell1.link(this); 1685 } 1686 1687 void JIT::compileBinaryArithOpSlowCase(OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned dst, unsigned src1, unsigned src2, OperandTypes types) 1688 { 1689 linkSlowCase(iter); 1690 if (types.second().isReusable() && supportsFloatingPoint()) { 1691 if (!types.first().definitelyIsNumber()) { 1692 linkSlowCaseIfNotJSCell(iter, src1); 1693 linkSlowCase(iter); 1694 } 1695 if (!types.second().definitelyIsNumber()) { 1696 linkSlowCaseIfNotJSCell(iter, src2); 1697 linkSlowCase(iter); 1698 } 1699 } else if (types.first().isReusable() && supportsFloatingPoint()) { 1700 if (!types.first().definitelyIsNumber()) { 1701 linkSlowCaseIfNotJSCell(iter, src1); 1702 linkSlowCase(iter); 1703 } 1704 if (!types.second().definitelyIsNumber()) { 1705 linkSlowCaseIfNotJSCell(iter, src2); 1706 linkSlowCase(iter); 1707 } 1708 } 1709 linkSlowCase(iter); 1710 1711 // additional entry point to handle -0 cases. 1712 if (opcodeID == op_mul) 1713 linkSlowCase(iter); 1714 1715 JITStubCall stubCall(this, opcodeID == op_add ? cti_op_add : opcodeID == op_sub ? cti_op_sub : cti_op_mul); 1716 stubCall.addArgument(src1, regT2); 1717 stubCall.addArgument(src2, regT2); 1718 stubCall.call(dst); 1719 } 1720 1721 void JIT::emit_op_add(Instruction* currentInstruction) 1722 { 1723 unsigned result = currentInstruction[1].u.operand; 1724 unsigned op1 = currentInstruction[2].u.operand; 1725 unsigned op2 = currentInstruction[3].u.operand; 1726 OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); 1727 1728 if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) { 1729 JITStubCall stubCall(this, cti_op_add); 1730 stubCall.addArgument(op1, regT2); 1731 stubCall.addArgument(op2, regT2); 1732 stubCall.call(result); 1733 return; 1734 } 1735 1736 if (isOperandConstantImmediateInt(op1)) { 1737 emitGetVirtualRegister(op2, regT0); 1738 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1739 addSlowCase(branchAdd32(Overflow, Imm32(getConstantOperandImmediateInt(op1) << JSImmediate::IntegerPayloadShift), regT0)); 1740 signExtend32ToPtr(regT0, regT0); 1741 emitPutVirtualRegister(result); 1742 } else if (isOperandConstantImmediateInt(op2)) { 1743 emitGetVirtualRegister(op1, regT0); 1744 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1745 addSlowCase(branchAdd32(Overflow, Imm32(getConstantOperandImmediateInt(op2) << JSImmediate::IntegerPayloadShift), regT0)); 1746 signExtend32ToPtr(regT0, regT0); 1747 emitPutVirtualRegister(result); 1748 } else { 1749 compileBinaryArithOp(op_add, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand)); 1750 } 1751 } 1752 1753 void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 1754 { 1755 unsigned result = currentInstruction[1].u.operand; 1756 unsigned op1 = currentInstruction[2].u.operand; 1757 unsigned op2 = currentInstruction[3].u.operand; 1758 1759 OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); 1760 if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) 1761 return; 1762 1763 if (isOperandConstantImmediateInt(op1)) { 1764 Jump notImm = getSlowCase(iter); 1765 linkSlowCase(iter); 1766 sub32(Imm32(getConstantOperandImmediateInt(op1) << JSImmediate::IntegerPayloadShift), regT0); 1767 notImm.link(this); 1768 JITStubCall stubCall(this, cti_op_add); 1769 stubCall.addArgument(op1, regT2); 1770 stubCall.addArgument(regT0); 1771 stubCall.call(result); 1772 } else if (isOperandConstantImmediateInt(op2)) { 1773 Jump notImm = getSlowCase(iter); 1774 linkSlowCase(iter); 1775 sub32(Imm32(getConstantOperandImmediateInt(op2) << JSImmediate::IntegerPayloadShift), regT0); 1776 notImm.link(this); 1777 JITStubCall stubCall(this, cti_op_add); 1778 stubCall.addArgument(regT0); 1779 stubCall.addArgument(op2, regT2); 1780 stubCall.call(result); 1781 } else { 1782 OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); 1783 ASSERT(types.first().mightBeNumber() && types.second().mightBeNumber()); 1784 compileBinaryArithOpSlowCase(op_add, iter, result, op1, op2, types); 1785 } 1786 } 1787 1788 void JIT::emit_op_mul(Instruction* currentInstruction) 1789 { 1790 unsigned result = currentInstruction[1].u.operand; 1791 unsigned op1 = currentInstruction[2].u.operand; 1792 unsigned op2 = currentInstruction[3].u.operand; 1793 1794 // For now, only plant a fast int case if the constant operand is greater than zero. 1795 int32_t value; 1796 if (isOperandConstantImmediateInt(op1) && ((value = getConstantOperandImmediateInt(op1)) > 0)) { 1797 emitGetVirtualRegister(op2, regT0); 1798 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1799 emitFastArithDeTagImmediate(regT0); 1800 addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT0)); 1801 signExtend32ToPtr(regT0, regT0); 1802 emitFastArithReTagImmediate(regT0, regT0); 1803 emitPutVirtualRegister(result); 1804 } else if (isOperandConstantImmediateInt(op2) && ((value = getConstantOperandImmediateInt(op2)) > 0)) { 1805 emitGetVirtualRegister(op1, regT0); 1806 emitJumpSlowCaseIfNotImmediateInteger(regT0); 1807 emitFastArithDeTagImmediate(regT0); 1808 addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT0)); 1809 signExtend32ToPtr(regT0, regT0); 1810 emitFastArithReTagImmediate(regT0, regT0); 1811 emitPutVirtualRegister(result); 1812 } else 1813 compileBinaryArithOp(op_mul, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand)); 1814 } 1815 1816 void JIT::emitSlow_op_mul(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 1817 { 1818 unsigned result = currentInstruction[1].u.operand; 1819 unsigned op1 = currentInstruction[2].u.operand; 1820 unsigned op2 = currentInstruction[3].u.operand; 1821 1822 if ((isOperandConstantImmediateInt(op1) && (getConstantOperandImmediateInt(op1) > 0)) 1823 || (isOperandConstantImmediateInt(op2) && (getConstantOperandImmediateInt(op2) > 0))) { 1824 linkSlowCase(iter); 1825 linkSlowCase(iter); 1826 // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0. 1827 JITStubCall stubCall(this, cti_op_mul); 1828 stubCall.addArgument(op1, regT2); 1829 stubCall.addArgument(op2, regT2); 1830 stubCall.call(result); 1831 } else 1832 compileBinaryArithOpSlowCase(op_mul, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand)); 1833 } 1834 1835 void JIT::emit_op_sub(Instruction* currentInstruction) 1836 { 1837 compileBinaryArithOp(op_sub, currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, OperandTypes::fromInt(currentInstruction[4].u.operand)); 1838 } 1839 1840 void JIT::emitSlow_op_sub(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 1841 { 1842 compileBinaryArithOpSlowCase(op_sub, iter, currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, OperandTypes::fromInt(currentInstruction[4].u.operand)); 1843 } 1251 /* ------------------------------ END: OP_ADD, OP_SUB, OP_MUL ------------------------------ */ 1252 1253 } // namespace JSC 1844 1254 1845 1255 #endif // USE(JSVALUE64) 1846 1847 /* ------------------------------ END: OP_ADD, OP_SUB, OP_MUL ------------------------------ */1848 1849 } // namespace JSC1850 1851 #endif // !USE(JSVALUE32_64)1852 1256 #endif // ENABLE(JIT) -
trunk/JavaScriptCore/jit/JITCall.cpp
r63404 r70111 27 27 28 28 #if ENABLE(JIT) 29 #if !USE(JSVALUE32_64)29 #if USE(JSVALUE64) 30 30 #include "JIT.h" 31 31 … … 258 258 } // namespace JSC 259 259 260 #endif // !USE(JSVALUE32_64)260 #endif // USE(JSVALUE64) 261 261 #endif // ENABLE(JIT) -
trunk/JavaScriptCore/jit/JITInlineMethods.h
r65044 r70111 64 64 { 65 65 loadPtr(Address(from, entry * sizeof(Register)), to); 66 #if !USE(JSVALUE32_64)66 #if USE(JSVALUE64) 67 67 killLastResultRegister(); 68 68 #endif … … 82 82 { 83 83 load32(Address(from, entry * sizeof(Register)), to); 84 #if !USE(JSVALUE32_64)84 #if USE(JSVALUE64) 85 85 killLastResultRegister(); 86 86 #endif … … 751 751 } 752 752 753 #if !USE(JSVALUE64)753 #if USE(JSVALUE32_64) 754 754 ALWAYS_INLINE void JIT::emitFastArithDeTagImmediate(RegisterID reg) 755 755 { -
trunk/JavaScriptCore/jit/JITOpcodes.cpp
r69940 r70111 40 40 namespace JSC { 41 41 42 #if !USE(JSVALUE32_64)42 #if USE(JSVALUE64) 43 43 44 44 #define RECORD_JUMP_TARGET(targetOffset) \ … … 362 362 emitGetVirtualRegister(op1, regT0); 363 363 emitJumpSlowCaseIfNotImmediateInteger(regT0); 364 #if USE(JSVALUE64)365 364 int32_t op2imm = getConstantOperandImmediateInt(op2); 366 #else367 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2)));368 #endif369 365 addJump(branch32(LessThanOrEqual, regT0, Imm32(op2imm)), target); 370 366 } else { … … 811 807 emitGetVirtualRegister(currentInstruction[2].u.operand, regT0); 812 808 emitJumpSlowCaseIfNotImmediateInteger(regT0); 813 #if USE(JSVALUE64)814 809 not32(regT0); 815 810 emitFastArithIntToImmNoCheck(regT0, regT0); 816 #else817 xorPtr(Imm32(~JSImmediate::TagTypeNumber), regT0);818 #endif819 811 emitPutVirtualRegister(currentInstruction[1].u.operand); 820 812 } … … 952 944 loadPtr(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStrings)), regT2); 953 945 954 #if USE(JSVALUE64)955 946 loadPtr(BaseIndex(regT2, regT0, TimesEight), regT2); 956 #else957 loadPtr(BaseIndex(regT2, regT0, TimesFour), regT2);958 #endif959 947 960 948 emitPutVirtualRegister(dst, regT2); … … 1614 1602 } 1615 1603 1616 #endif // !USE(JSVALUE32_64)1604 #endif // USE(JSVALUE64) 1617 1605 1618 1606 void JIT::emit_op_resolve_global_dynamic(Instruction* currentInstruction) -
trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
r66150 r70111 27 27 28 28 #if ENABLE(JIT) 29 #if !USE(JSVALUE32_64)29 #if USE(JSVALUE64) 30 30 #include "JIT.h" 31 31 … … 90 90 emitGetVirtualRegisters(base, regT0, property, regT1); 91 91 emitJumpSlowCaseIfNotImmediateInteger(regT1); 92 #if USE(JSVALUE64) 92 93 93 // This is technically incorrect - we're zero-extending an int32. On the hot path this doesn't matter. 94 94 // We check the value as if it was a uint32 against the m_vectorLength - which will always fail if … … 98 98 // extending since it makes it easier to re-tag the value in the slow case. 99 99 zeroExtend32ToPtr(regT1, regT1); 100 #else 101 emitFastArithImmToInt(regT1); 102 #endif 100 103 101 emitJumpSlowCaseIfNotJSCell(regT0, base); 104 102 addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); … … 205 203 emitGetVirtualRegisters(base, regT0, property, regT1); 206 204 emitJumpSlowCaseIfNotImmediateInteger(regT1); 207 #if USE(JSVALUE64)208 205 // See comment in op_get_by_val. 209 206 zeroExtend32ToPtr(regT1, regT1); 210 #else211 emitFastArithImmToInt(regT1);212 #endif213 207 emitJumpSlowCaseIfNotJSCell(regT0, base); 214 208 addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); … … 1104 1098 } // namespace JSC 1105 1099 1106 #endif // !USE(JSVALUE32_64)1100 #endif // USE(JSVALUE64) 1107 1101 #endif // ENABLE(JIT) -
trunk/JavaScriptCore/jit/JITStubs.h
r69940 r70111 148 148 JITStubArg reserved; // Unused 149 149 JITStubArg args[6]; 150 #if !USE(JSVALUE32_64)150 #if USE(JSVALUE64) 151 151 void* padding; // Maintain 16-byte stack alignment. 152 152 #endif -
trunk/JavaScriptCore/jit/JSInterfaceJIT.h
r65021 r70111 167 167 #endif 168 168 169 #if USE(JSVALUE 32) || USE(JSVALUE64)169 #if USE(JSVALUE64) 170 170 Jump emitJumpIfImmediateNumber(RegisterID reg); 171 171 Jump emitJumpIfNotImmediateNumber(RegisterID reg); … … 274 274 #endif 275 275 276 #if USE(JSVALUE32) 277 inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID dst) 278 { 279 loadPtr(addressFor(virtualRegisterIndex), dst); 280 return branchTest32(NonZero, dst, Imm32(JSImmediate::TagMask)); 281 } 282 283 inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst) 284 { 285 loadPtr(addressFor(virtualRegisterIndex), dst); 286 Jump result = branchTest32(Zero, dst, Imm32(JSImmediate::TagTypeNumber)); 287 rshift32(Imm32(JSImmediate::IntegerPayloadShift), dst); 288 return result; 289 } 290 291 inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadDouble(unsigned, FPRegisterID, RegisterID) 292 { 293 ASSERT_NOT_REACHED(); 294 return jump(); 295 } 296 297 ALWAYS_INLINE void JSInterfaceJIT::emitFastArithImmToInt(RegisterID reg) 298 { 299 rshift32(Imm32(JSImmediate::IntegerPayloadShift), reg); 300 } 301 302 #endif 303 304 #if !USE(JSVALUE32_64) 276 #if USE(JSVALUE64) 305 277 inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned virtualRegisterIndex, RegisterID base) 306 278 { -
trunk/JavaScriptCore/jit/SpecializedThunkJIT.h
r66150 r70111 97 97 moveDoubleToPtr(src, regT0); 98 98 subPtr(tagTypeNumberRegister, regT0); 99 #el if USE(JSVALUE32_64)99 #else 100 100 storeDouble(src, Address(stackPointerRegister, -(int)sizeof(double))); 101 101 loadPtr(Address(stackPointerRegister, OBJECT_OFFSETOF(JSValue, u.asBits.tag) - sizeof(double)), regT1); 102 102 loadPtr(Address(stackPointerRegister, OBJECT_OFFSETOF(JSValue, u.asBits.payload) - sizeof(double)), regT0); 103 #else104 UNUSED_PARAM(src);105 ASSERT_NOT_REACHED();106 m_failures.append(jump());107 103 #endif 108 104 loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister); … … 145 141 #if USE(JSVALUE64) 146 142 orPtr(tagTypeNumberRegister, regT0); 147 #el if USE(JSVALUE32_64)143 #else 148 144 move(Imm32(JSValue::Int32Tag), regT1); 149 #else150 signExtend32ToPtr(regT0, regT0);151 // If we can't tag the result, give up and jump to the slow case152 m_failures.append(branchAddPtr(Overflow, regT0, regT0));153 addPtr(Imm32(JSImmediate::TagTypeNumber), regT0);154 145 #endif 155 146 } -
trunk/JavaScriptCore/jit/ThunkGenerators.cpp
r65653 r70111 93 93 MacroAssemblerCodePtr sqrtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool) 94 94 { 95 #if USE(JSVALUE64) || USE(JSVALUE32_64)96 95 SpecializedThunkJIT jit(1, globalData, pool); 97 96 if (!jit.supportsFloatingPointSqrt()) … … 102 101 jit.returnDouble(SpecializedThunkJIT::fpRegT0); 103 102 return jit.finalize(globalData->jitStubs->ctiNativeCall()); 104 #else105 UNUSED_PARAM(pool);106 return globalData->jitStubs->ctiNativeCall();107 #endif108 103 } 109 104 … … 113 108 MacroAssemblerCodePtr powThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool) 114 109 { 115 #if USE(JSVALUE64) || USE(JSVALUE32_64)116 110 SpecializedThunkJIT jit(2, globalData, pool); 117 111 if (!jit.supportsFloatingPoint()) … … 162 156 163 157 return jit.finalize(globalData->jitStubs->ctiNativeCall()); 164 #else165 UNUSED_PARAM(pool);166 return globalData->jitStubs->ctiNativeCall();167 #endif168 158 } 169 159 -
trunk/JavaScriptCore/runtime/Collector.cpp
r67683 r70111 643 643 COMPILE_ASSERT(sizeof(CollectorCell) % 2 == 0, Collector_cell_size_is_power_of_two); 644 644 645 #if USE(JSVALUE32) 646 static bool isHalfCellAligned(void *p) 647 { 648 return (((intptr_t)(p) & (CELL_MASK >> 1)) == 0); 645 static inline bool isCellAligned(void *p) 646 { 647 return (((intptr_t)(p) & CELL_MASK) == 0); 649 648 } 650 649 651 650 static inline bool isPossibleCell(void* p) 652 651 { 653 return isHalfCellAligned(p) && p;654 }655 656 #else657 658 static inline bool isCellAligned(void *p)659 {660 return (((intptr_t)(p) & CELL_MASK) == 0);661 }662 663 static inline bool isPossibleCell(void* p)664 {665 652 return isCellAligned(p) && p; 666 653 } 667 #endif // USE(JSVALUE32)668 654 669 655 void Heap::markConservatively(MarkStack& markStack, void* start, void* end) … … 1146 1132 if (cell->isString()) 1147 1133 return "string"; 1148 #if USE(JSVALUE32)1149 if (cell->isNumber())1150 return "number";1151 #endif1152 1134 if (cell->isGetterSetter()) 1153 1135 return "Getter-Setter"; -
trunk/JavaScriptCore/runtime/JSCell.h
r68426 r70111 76 76 77 77 // Querying the type. 78 #if USE(JSVALUE32)79 bool isNumber() const;80 #endif81 78 bool isString() const; 82 79 bool isObject() const; … … 157 154 } 158 155 159 #if USE(JSVALUE32)160 inline bool JSCell::isNumber() const161 {162 return m_structure->typeInfo().type() == NumberType;163 }164 #endif165 166 156 inline bool JSCell::isObject() const 167 157 { … … 254 244 } 255 245 256 #if !USE(JSVALUE32_64)246 #if USE(JSVALUE64) 257 247 ALWAYS_INLINE JSCell* JSValue::asCell() const 258 248 { … … 260 250 return m_ptr; 261 251 } 262 #endif // !USE(JSVALUE32_64)252 #endif // USE(JSVALUE64) 263 253 264 254 inline JSValue JSValue::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r69516 r70111 134 134 , apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull())) 135 135 , dummyMarkableCellStructure(JSCell::createDummyStructure()) 136 #if USE(JSVALUE32)137 , numberStructure(JSNumberCell::createStructure(jsNull()))138 #endif139 136 , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) 140 137 , propertyNames(new CommonIdentifiers(this)) -
trunk/JavaScriptCore/runtime/JSGlobalData.h
r69516 r70111 155 155 RefPtr<Structure> dummyMarkableCellStructure; 156 156 157 #if USE(JSVALUE32)158 RefPtr<Structure> numberStructure;159 #endif160 161 157 static void storeVPtrs(); 162 158 static JS_EXPORTDATA void* jsArrayVPtr; -
trunk/JavaScriptCore/runtime/JSGlobalObject.h
r69516 r70111 387 387 return m_prototype; 388 388 389 #if USE(JSVALUE32)390 if (typeInfo().type() == StringType)391 return exec->lexicalGlobalObject()->stringPrototype();392 393 ASSERT(typeInfo().type() == NumberType);394 return exec->lexicalGlobalObject()->numberPrototype();395 #else396 389 ASSERT(typeInfo().type() == StringType); 397 390 return exec->lexicalGlobalObject()->stringPrototype(); 398 #endif399 391 } 400 392 -
trunk/JavaScriptCore/runtime/JSImmediate.h
r62419 r70111 23 23 #define JSImmediate_h 24 24 25 #if !USE(JSVALUE32_64)25 #if USE(JSVALUE64) 26 26 27 27 #include <wtf/Assertions.h> … … 45 45 class UString; 46 46 47 #if USE(JSVALUE64)48 47 inline intptr_t reinterpretDoubleToIntptr(double value) 49 48 { … … 55 54 return WTF::bitwise_cast<double>(value); 56 55 } 57 #endif58 56 59 57 /* … … 160 158 friend JSValue jsNumber(JSGlobalData* globalData, unsigned long long i); 161 159 162 #if USE(JSVALUE64)163 160 // If all bits in the mask are set, this indicates an integer number, 164 161 // if any but not all are set this value is a double precision number. … … 167 164 // with a 16-bit pattern within the range 0x0001..0xFFFE. 168 165 static const intptr_t DoubleEncodeOffset = 0x1000000000000ll; 169 #elif USE(JSVALUE32)170 static const intptr_t TagTypeNumber = 0x1; // bottom bit set indicates integer, this dominates the following bit171 #endif172 166 static const intptr_t TagBitTypeOther = 0x2; // second bit set indicates immediate other than an integer 173 167 static const intptr_t TagMask = TagTypeNumber | TagBitTypeOther; … … 182 176 static const intptr_t FullTagTypeNull = TagBitTypeOther; 183 177 184 #if USE(JSVALUE64)185 178 static const int32_t IntegerPayloadShift = 0; 186 #else187 static const int32_t IntegerPayloadShift = 1;188 #endif189 179 static const int32_t ExtendedPayloadShift = 4; 190 180 … … 205 195 static ALWAYS_INLINE bool isIntegerNumber(JSValue v) 206 196 { 207 #if USE(JSVALUE64)208 197 return (rawValue(v) & TagTypeNumber) == TagTypeNumber; 209 #else 210 return isNumber(v); 211 #endif 212 } 213 214 #if USE(JSVALUE64) 198 } 199 215 200 static ALWAYS_INLINE bool isDouble(JSValue v) 216 201 { 217 202 return isNumber(v) && !isIntegerNumber(v); 218 203 } 219 #endif220 204 221 205 static ALWAYS_INLINE bool isPositiveIntegerNumber(JSValue v) … … 261 245 static ALWAYS_INLINE bool areBothImmediateIntegerNumbers(JSValue v1, JSValue v2) 262 246 { 263 #if USE(JSVALUE64)264 247 return (rawValue(v1) & rawValue(v2) & TagTypeNumber) == TagTypeNumber; 265 #else266 return rawValue(v1) & rawValue(v2) & TagTypeNumber;267 #endif268 248 } 269 249 … … 286 266 287 267 private: 288 #if USE(JSVALUE64)289 268 static const int minImmediateInt = ((-INT_MAX) - 1); 290 269 static const int maxImmediateInt = INT_MAX; 291 #else292 static const int minImmediateInt = ((-INT_MAX) - 1) >> IntegerPayloadShift;293 static const int maxImmediateInt = INT_MAX >> IntegerPayloadShift;294 #endif295 270 static const unsigned maxImmediateUInt = maxImmediateInt; 296 271 … … 303 278 // integer doesn't interfere with the tag bits in the upper word. In the default encoding, 304 279 // if intptr_t id larger then int32_t we sign extend the value through the upper word. 305 #if USE(JSVALUE64)306 280 static ALWAYS_INLINE JSValue makeInt(uint32_t value) 307 #else308 static ALWAYS_INLINE JSValue makeInt(int32_t value)309 #endif310 281 { 311 282 return makeValue((static_cast<intptr_t>(value) << IntegerPayloadShift) | TagTypeNumber); 312 283 } 313 284 314 #if USE(JSVALUE64)315 285 static ALWAYS_INLINE JSValue makeDouble(double value) 316 286 { 317 287 return makeValue(reinterpretDoubleToIntptr(value) + DoubleEncodeOffset); 318 288 } 319 #endif320 289 321 290 static ALWAYS_INLINE JSValue makeBool(bool b) … … 337 306 static JSValue fromNumberOutsideIntegerRange(T); 338 307 339 #if USE(JSVALUE64)340 308 static ALWAYS_INLINE double doubleValue(JSValue v) 341 309 { 342 310 return reinterpretIntptrToDouble(rawValue(v) - DoubleEncodeOffset); 343 311 } 344 #endif345 312 346 313 static ALWAYS_INLINE int32_t intValue(JSValue v) … … 372 339 ALWAYS_INLINE JSValue JSImmediate::oneImmediate() { return makeInt(1); } 373 340 374 #if USE(JSVALUE64)375 341 inline bool doubleToBoolean(double value) 376 342 { … … 384 350 : doubleToBoolean(doubleValue(v)) : v == trueImmediate(); 385 351 } 386 #else387 ALWAYS_INLINE bool JSImmediate::toBoolean(JSValue v)388 {389 ASSERT(isImmediate(v));390 return isIntegerNumber(v) ? v != zeroImmediate() : v == trueImmediate();391 }392 #endif393 352 394 353 ALWAYS_INLINE uint32_t JSImmediate::getTruncatedUInt32(JSValue v) … … 399 358 } 400 359 401 #if USE(JSVALUE64)402 360 template<typename T> 403 361 inline JSValue JSImmediate::fromNumberOutsideIntegerRange(T value) … … 405 363 return makeDouble(static_cast<double>(value)); 406 364 } 407 #else408 template<typename T>409 inline JSValue JSImmediate::fromNumberOutsideIntegerRange(T)410 {411 return JSValue();412 }413 #endif414 365 415 366 ALWAYS_INLINE JSValue JSImmediate::from(char i) … … 440 391 ALWAYS_INLINE JSValue JSImmediate::from(int i) 441 392 { 442 #if !USE(JSVALUE64)443 if ((i < minImmediateInt) | (i > maxImmediateInt))444 return fromNumberOutsideIntegerRange(i);445 #endif446 393 return makeInt(i); 447 394 } … … 506 453 return intValue(v); 507 454 508 #if USE(JSVALUE64)509 455 if (isNumber(v)) { 510 456 ASSERT(isDouble(v)); 511 457 return doubleValue(v); 512 458 } 513 #else514 ASSERT(!isNumber(v));515 #endif516 459 517 460 if (rawValue(v) == FullTagTypeUndefined) … … 671 614 { 672 615 ASSERT(canDoFastRshift(val, shift) || canDoFastUrshift(val, shift)); 673 #if USE(JSVALUE64)674 616 return JSImmediate::makeValue(static_cast<intptr_t>(static_cast<uint32_t>(static_cast<int32_t>(JSImmediate::rawValue(val)) >> ((JSImmediate::rawValue(shift) >> JSImmediate::IntegerPayloadShift) & 0x1f))) | JSImmediate::TagTypeNumber); 675 #else676 return JSImmediate::makeValue((JSImmediate::rawValue(val) >> ((JSImmediate::rawValue(shift) >> JSImmediate::IntegerPayloadShift) & 0x1f)) | JSImmediate::TagTypeNumber);677 #endif678 617 } 679 618 … … 719 658 } // namespace JSC 720 659 721 #endif // !USE(JSVALUE32_64)660 #endif // USE(JSVALUE64) 722 661 723 662 #endif // JSImmediate_h -
trunk/JavaScriptCore/runtime/JSNumberCell.cpp
r65177 r70111 24 24 #include "JSNumberCell.h" 25 25 26 #if USE(JSVALUE32)27 28 #include "NumberObject.h"29 #include "UString.h"30 31 namespace JSC {32 33 JSValue JSNumberCell::toPrimitive(ExecState*, PreferredPrimitiveType) const34 {35 return const_cast<JSNumberCell*>(this);36 }37 38 bool JSNumberCell::getPrimitiveNumber(ExecState*, double& number, JSValue& value)39 {40 number = m_value;41 value = this;42 return true;43 }44 45 bool JSNumberCell::toBoolean(ExecState*) const46 {47 return m_value < 0.0 || m_value > 0.0; // false for NaN48 }49 50 double JSNumberCell::toNumber(ExecState*) const51 {52 return m_value;53 }54 55 UString JSNumberCell::toString(ExecState*) const56 {57 return UString::number(m_value);58 }59 60 JSObject* JSNumberCell::toObject(ExecState* exec) const61 {62 return constructNumber(exec, const_cast<JSNumberCell*>(this));63 }64 65 JSObject* JSNumberCell::toThisObject(ExecState* exec) const66 {67 return constructNumber(exec, const_cast<JSNumberCell*>(this));68 }69 70 bool JSNumberCell::getUInt32(uint32_t& uint32) const71 {72 uint32 = static_cast<uint32_t>(m_value);73 return uint32 == m_value;74 }75 76 JSValue JSNumberCell::getJSNumber()77 {78 return this;79 }80 81 JSValue jsNumberCell(ExecState* exec, double d)82 {83 return new (exec) JSNumberCell(exec, d);84 }85 86 JSValue jsNumberCell(JSGlobalData* globalData, double d)87 {88 return new (globalData) JSNumberCell(globalData, d);89 }90 91 } // namespace JSC92 93 #else // USE(JSVALUE32)94 95 26 // Keep our exported symbols lists happy. 96 27 namespace JSC { … … 106 37 } // namespace JSC 107 38 108 #endif // USE(JSVALUE32) -
trunk/JavaScriptCore/runtime/JSNumberCell.h
r57019 r70111 35 35 extern const double NaN; 36 36 extern const double Inf; 37 38 #if USE(JSVALUE32)39 JSValue jsNumberCell(ExecState*, double);40 41 class Identifier;42 class JSCell;43 class JSObject;44 class JSString;45 class PropertySlot;46 47 struct ClassInfo;48 struct Instruction;49 50 class JSNumberCell : public JSCell {51 friend class JIT;52 friend JSValue jsNumberCell(JSGlobalData*, double);53 friend JSValue jsNumberCell(ExecState*, double);54 55 public:56 double value() const { return m_value; }57 58 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;59 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);60 virtual bool toBoolean(ExecState*) const;61 virtual double toNumber(ExecState*) const;62 virtual UString toString(ExecState*) const;63 virtual JSObject* toObject(ExecState*) const;64 65 virtual JSObject* toThisObject(ExecState*) const;66 virtual JSValue getJSNumber();67 68 void* operator new(size_t size, ExecState* exec)69 {70 return exec->heap()->allocateNumber(size);71 }72 73 void* operator new(size_t size, JSGlobalData* globalData)74 {75 return globalData->heap.allocateNumber(size);76 }77 78 static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount); }79 80 private:81 JSNumberCell(JSGlobalData* globalData, double value)82 : JSCell(globalData->numberStructure.get())83 , m_value(value)84 {85 }86 87 JSNumberCell(ExecState* exec, double value)88 : JSCell(exec->globalData().numberStructure.get())89 , m_value(value)90 {91 }92 93 virtual bool getUInt32(uint32_t&) const;94 95 double m_value;96 };97 98 JSValue jsNumberCell(JSGlobalData*, double);99 100 inline bool isNumberCell(JSValue v)101 {102 return v.isCell() && v.asCell()->isNumber();103 }104 105 inline JSNumberCell* asNumberCell(JSValue v)106 {107 ASSERT(isNumberCell(v));108 return static_cast<JSNumberCell*>(v.asCell());109 }110 111 ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState* exec, double d)112 {113 *this = jsNumberCell(exec, d);114 }115 116 inline JSValue::JSValue(ExecState* exec, double d)117 {118 JSValue v = JSImmediate::from(d);119 *this = v ? v : jsNumberCell(exec, d);120 }121 122 inline JSValue::JSValue(ExecState* exec, int i)123 {124 JSValue v = JSImmediate::from(i);125 *this = v ? v : jsNumberCell(exec, i);126 }127 128 inline JSValue::JSValue(ExecState* exec, unsigned i)129 {130 JSValue v = JSImmediate::from(i);131 *this = v ? v : jsNumberCell(exec, i);132 }133 134 inline JSValue::JSValue(ExecState* exec, long i)135 {136 JSValue v = JSImmediate::from(i);137 *this = v ? v : jsNumberCell(exec, i);138 }139 140 inline JSValue::JSValue(ExecState* exec, unsigned long i)141 {142 JSValue v = JSImmediate::from(i);143 *this = v ? v : jsNumberCell(exec, i);144 }145 146 inline JSValue::JSValue(ExecState* exec, long long i)147 {148 JSValue v = JSImmediate::from(i);149 *this = v ? v : jsNumberCell(exec, static_cast<double>(i));150 }151 152 inline JSValue::JSValue(ExecState* exec, unsigned long long i)153 {154 JSValue v = JSImmediate::from(i);155 *this = v ? v : jsNumberCell(exec, static_cast<double>(i));156 }157 158 inline JSValue::JSValue(JSGlobalData* globalData, double d)159 {160 JSValue v = JSImmediate::from(d);161 *this = v ? v : jsNumberCell(globalData, d);162 }163 164 inline JSValue::JSValue(JSGlobalData* globalData, int i)165 {166 JSValue v = JSImmediate::from(i);167 *this = v ? v : jsNumberCell(globalData, i);168 }169 170 inline JSValue::JSValue(JSGlobalData* globalData, unsigned i)171 {172 JSValue v = JSImmediate::from(i);173 *this = v ? v : jsNumberCell(globalData, i);174 }175 176 inline bool JSValue::isDouble() const177 {178 return isNumberCell(asValue());179 }180 181 inline double JSValue::asDouble() const182 {183 return asNumberCell(asValue())->value();184 }185 186 inline bool JSValue::isNumber() const187 {188 return JSImmediate::isNumber(asValue()) || isDouble();189 }190 191 inline double JSValue::uncheckedGetNumber() const192 {193 ASSERT(isNumber());194 return JSImmediate::isImmediate(asValue()) ? JSImmediate::toDouble(asValue()) : asDouble();195 }196 197 #endif // USE(JSVALUE32)198 37 199 38 #if USE(JSVALUE64) … … 296 135 #endif // USE(JSVALUE64) 297 136 298 #if USE(JSVALUE 32) || USE(JSVALUE64)137 #if USE(JSVALUE64) 299 138 300 139 inline JSValue::JSValue(ExecState*, char i) … … 352 191 } 353 192 354 #endif // USE(JSVALUE 32) || USE(JSVALUE64)193 #endif // USE(JSVALUE64) 355 194 356 195 } // namespace JSC -
trunk/JavaScriptCore/runtime/JSObject.h
r69516 r70111 254 254 void isObject(); 255 255 void isString(); 256 #if USE(JSVALUE32)257 void isNumber();258 #endif259 256 260 257 ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); } … … 305 302 ASSERT(m_structure->isEmpty()); 306 303 ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype())); 307 #if USE(JSVALUE64) || USE(JSVALUE32_64)308 304 ASSERT(OBJECT_OFFSETOF(JSObject, m_inlineStorage) % sizeof(double) == 0); 309 #endif310 305 } 311 306 -
trunk/JavaScriptCore/runtime/JSValue.h
r69516 r70111 81 81 static EncodedJSValue encode(JSValue value); 82 82 static JSValue decode(EncodedJSValue ptr); 83 #if !USE(JSVALUE32_64)83 #if USE(JSVALUE64) 84 84 private: 85 85 static JSValue makeImmediate(intptr_t value); -
trunk/JavaScriptCore/runtime/NumberObject.h
r54022 r70111 38 38 39 39 protected: 40 #if USE(JSVALUE32)41 static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;42 #else43 40 static const unsigned StructureFlags = JSWrapperObject::StructureFlags; 44 #endif45 41 46 42 private: -
trunk/JavaScriptCore/wtf/Platform.h
r69753 r70111 925 925 #endif 926 926 927 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32 ) && !defined(WTF_USE_JSVALUE32_64)927 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) 928 928 #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \ 929 929 || (CPU(IA64) && !CPU(IA64_32)) \ … … 932 932 || CPU(PPC64) 933 933 #define WTF_USE_JSVALUE64 1 934 #elif CPU(ARM_TRADITIONAL) && COMPILER(MSVC)935 #define WTF_USE_JSVALUE32 1936 934 #else 937 935 #define WTF_USE_JSVALUE32_64 1 938 936 #endif 939 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32 ) && !defined(WTF_USE_JSVALUE32_64) */937 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */ 940 938 941 939 #if !defined(ENABLE_REPAINT_THROTTLING) … … 975 973 #define ENABLE_JIT_USE_SOFT_MODULO 1 976 974 #endif 977 #endif978 979 #if !defined(ENABLE_JIT_OPTIMIZE_NATIVE_CALL) && CPU(X86) && USE(JSVALUE32)980 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0981 975 #endif 982 976
Note: See TracChangeset
for help on using the changeset viewer.