| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 return ToRegister(op->index()); | 416 return ToRegister(op->index()); |
| 417 } | 417 } |
| 418 | 418 |
| 419 | 419 |
| 420 Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) { | 420 Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) { |
| 421 if (op->IsRegister()) { | 421 if (op->IsRegister()) { |
| 422 return ToRegister(op->index()); | 422 return ToRegister(op->index()); |
| 423 } else if (op->IsConstantOperand()) { | 423 } else if (op->IsConstantOperand()) { |
| 424 LConstantOperand* const_op = LConstantOperand::cast(op); | 424 LConstantOperand* const_op = LConstantOperand::cast(op); |
| 425 HConstant* constant = chunk_->LookupConstant(const_op); | 425 HConstant* constant = chunk_->LookupConstant(const_op); |
| 426 Handle<Object> literal = constant->handle(); | 426 Handle<Object> literal = constant->handle(isolate()); |
| 427 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 427 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
| 428 if (r.IsInteger32()) { | 428 if (r.IsInteger32()) { |
| 429 ASSERT(literal->IsNumber()); | 429 ASSERT(literal->IsNumber()); |
| 430 __ mov(scratch, Operand(static_cast<int32_t>(literal->Number()))); | 430 __ mov(scratch, Operand(static_cast<int32_t>(literal->Number()))); |
| 431 } else if (r.IsDouble()) { | 431 } else if (r.IsDouble()) { |
| 432 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); | 432 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); |
| 433 } else { | 433 } else { |
| 434 ASSERT(r.IsSmiOrTagged()); | 434 ASSERT(r.IsSmiOrTagged()); |
| 435 __ LoadObject(scratch, literal); | 435 __ LoadObject(scratch, literal); |
| 436 } | 436 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 451 | 451 |
| 452 | 452 |
| 453 DwVfpRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, | 453 DwVfpRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, |
| 454 SwVfpRegister flt_scratch, | 454 SwVfpRegister flt_scratch, |
| 455 DwVfpRegister dbl_scratch) { | 455 DwVfpRegister dbl_scratch) { |
| 456 if (op->IsDoubleRegister()) { | 456 if (op->IsDoubleRegister()) { |
| 457 return ToDoubleRegister(op->index()); | 457 return ToDoubleRegister(op->index()); |
| 458 } else if (op->IsConstantOperand()) { | 458 } else if (op->IsConstantOperand()) { |
| 459 LConstantOperand* const_op = LConstantOperand::cast(op); | 459 LConstantOperand* const_op = LConstantOperand::cast(op); |
| 460 HConstant* constant = chunk_->LookupConstant(const_op); | 460 HConstant* constant = chunk_->LookupConstant(const_op); |
| 461 Handle<Object> literal = constant->handle(); | 461 Handle<Object> literal = constant->handle(isolate()); |
| 462 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 462 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
| 463 if (r.IsInteger32()) { | 463 if (r.IsInteger32()) { |
| 464 ASSERT(literal->IsNumber()); | 464 ASSERT(literal->IsNumber()); |
| 465 __ mov(ip, Operand(static_cast<int32_t>(literal->Number()))); | 465 __ mov(ip, Operand(static_cast<int32_t>(literal->Number()))); |
| 466 __ vmov(flt_scratch, ip); | 466 __ vmov(flt_scratch, ip); |
| 467 __ vcvt_f64_s32(dbl_scratch, flt_scratch); | 467 __ vcvt_f64_s32(dbl_scratch, flt_scratch); |
| 468 return dbl_scratch; | 468 return dbl_scratch; |
| 469 } else if (r.IsDouble()) { | 469 } else if (r.IsDouble()) { |
| 470 Abort(kUnsupportedDoubleImmediate); | 470 Abort(kUnsupportedDoubleImmediate); |
| 471 } else if (r.IsTagged()) { | 471 } else if (r.IsTagged()) { |
| 472 Abort(kUnsupportedTaggedImmediate); | 472 Abort(kUnsupportedTaggedImmediate); |
| 473 } | 473 } |
| 474 } else if (op->IsStackSlot() || op->IsArgument()) { | 474 } else if (op->IsStackSlot() || op->IsArgument()) { |
| 475 // TODO(regis): Why is vldr not taking a MemOperand? | 475 // TODO(regis): Why is vldr not taking a MemOperand? |
| 476 // __ vldr(dbl_scratch, ToMemOperand(op)); | 476 // __ vldr(dbl_scratch, ToMemOperand(op)); |
| 477 MemOperand mem_op = ToMemOperand(op); | 477 MemOperand mem_op = ToMemOperand(op); |
| 478 __ vldr(dbl_scratch, mem_op.rn(), mem_op.offset()); | 478 __ vldr(dbl_scratch, mem_op.rn(), mem_op.offset()); |
| 479 return dbl_scratch; | 479 return dbl_scratch; |
| 480 } | 480 } |
| 481 UNREACHABLE(); | 481 UNREACHABLE(); |
| 482 return dbl_scratch; | 482 return dbl_scratch; |
| 483 } | 483 } |
| 484 | 484 |
| 485 | 485 |
| 486 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 486 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
| 487 HConstant* constant = chunk_->LookupConstant(op); | 487 HConstant* constant = chunk_->LookupConstant(op); |
| 488 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); | 488 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); |
| 489 return constant->handle(); | 489 return constant->handle(isolate()); |
| 490 } | 490 } |
| 491 | 491 |
| 492 | 492 |
| 493 bool LCodeGen::IsInteger32(LConstantOperand* op) const { | 493 bool LCodeGen::IsInteger32(LConstantOperand* op) const { |
| 494 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); | 494 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 | 497 |
| 498 bool LCodeGen::IsSmi(LConstantOperand* op) const { | 498 bool LCodeGen::IsSmi(LConstantOperand* op) const { |
| 499 return chunk_->LookupLiteralRepresentation(op).IsSmi(); | 499 return chunk_->LookupLiteralRepresentation(op).IsSmi(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 if (r.IsSmi()) { | 536 if (r.IsSmi()) { |
| 537 ASSERT(constant->HasSmiValue()); | 537 ASSERT(constant->HasSmiValue()); |
| 538 return Operand(Smi::FromInt(constant->Integer32Value())); | 538 return Operand(Smi::FromInt(constant->Integer32Value())); |
| 539 } else if (r.IsInteger32()) { | 539 } else if (r.IsInteger32()) { |
| 540 ASSERT(constant->HasInteger32Value()); | 540 ASSERT(constant->HasInteger32Value()); |
| 541 return Operand(constant->Integer32Value()); | 541 return Operand(constant->Integer32Value()); |
| 542 } else if (r.IsDouble()) { | 542 } else if (r.IsDouble()) { |
| 543 Abort(kToOperandUnsupportedDoubleImmediate); | 543 Abort(kToOperandUnsupportedDoubleImmediate); |
| 544 } | 544 } |
| 545 ASSERT(r.IsTagged()); | 545 ASSERT(r.IsTagged()); |
| 546 return Operand(constant->handle()); | 546 return Operand(constant->handle(isolate())); |
| 547 } else if (op->IsRegister()) { | 547 } else if (op->IsRegister()) { |
| 548 return Operand(ToRegister(op)); | 548 return Operand(ToRegister(op)); |
| 549 } else if (op->IsDoubleRegister()) { | 549 } else if (op->IsDoubleRegister()) { |
| 550 Abort(kToOperandIsDoubleRegisterUnimplemented); | 550 Abort(kToOperandIsDoubleRegisterUnimplemented); |
| 551 return Operand::Zero(); | 551 return Operand::Zero(); |
| 552 } | 552 } |
| 553 // Stack slots not implemented, use ToMemOperand instead. | 553 // Stack slots not implemented, use ToMemOperand instead. |
| 554 UNREACHABLE(); | 554 UNREACHABLE(); |
| 555 return Operand::Zero(); | 555 return Operand::Zero(); |
| 556 } | 556 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } else if (is_uint32) { | 683 } else if (is_uint32) { |
| 684 translation->StoreUint32Register(reg); | 684 translation->StoreUint32Register(reg); |
| 685 } else { | 685 } else { |
| 686 translation->StoreInt32Register(reg); | 686 translation->StoreInt32Register(reg); |
| 687 } | 687 } |
| 688 } else if (op->IsDoubleRegister()) { | 688 } else if (op->IsDoubleRegister()) { |
| 689 DoubleRegister reg = ToDoubleRegister(op); | 689 DoubleRegister reg = ToDoubleRegister(op); |
| 690 translation->StoreDoubleRegister(reg); | 690 translation->StoreDoubleRegister(reg); |
| 691 } else if (op->IsConstantOperand()) { | 691 } else if (op->IsConstantOperand()) { |
| 692 HConstant* constant = chunk()->LookupConstant(LConstantOperand::cast(op)); | 692 HConstant* constant = chunk()->LookupConstant(LConstantOperand::cast(op)); |
| 693 int src_index = DefineDeoptimizationLiteral(constant->handle()); | 693 int src_index = DefineDeoptimizationLiteral(constant->handle(isolate())); |
| 694 translation->StoreLiteral(src_index); | 694 translation->StoreLiteral(src_index); |
| 695 } else { | 695 } else { |
| 696 UNREACHABLE(); | 696 UNREACHABLE(); |
| 697 } | 697 } |
| 698 } | 698 } |
| 699 | 699 |
| 700 | 700 |
| 701 void LCodeGen::CallCode(Handle<Code> code, | 701 void LCodeGen::CallCode(Handle<Code> code, |
| 702 RelocInfo::Mode mode, | 702 RelocInfo::Mode mode, |
| 703 LInstruction* instr, | 703 LInstruction* instr, |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 __ Vmov(result, v, scratch0()); | 1861 __ Vmov(result, v, scratch0()); |
| 1862 } | 1862 } |
| 1863 | 1863 |
| 1864 | 1864 |
| 1865 void LCodeGen::DoConstantE(LConstantE* instr) { | 1865 void LCodeGen::DoConstantE(LConstantE* instr) { |
| 1866 __ mov(ToRegister(instr->result()), Operand(instr->value())); | 1866 __ mov(ToRegister(instr->result()), Operand(instr->value())); |
| 1867 } | 1867 } |
| 1868 | 1868 |
| 1869 | 1869 |
| 1870 void LCodeGen::DoConstantT(LConstantT* instr) { | 1870 void LCodeGen::DoConstantT(LConstantT* instr) { |
| 1871 Handle<Object> value = instr->value(); | 1871 Handle<Object> value = instr->value(isolate()); |
| 1872 AllowDeferredHandleDereference smi_check; | 1872 AllowDeferredHandleDereference smi_check; |
| 1873 __ LoadObject(ToRegister(instr->result()), value); | 1873 __ LoadObject(ToRegister(instr->result()), value); |
| 1874 } | 1874 } |
| 1875 | 1875 |
| 1876 | 1876 |
| 1877 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1877 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
| 1878 Register result = ToRegister(instr->result()); | 1878 Register result = ToRegister(instr->result()); |
| 1879 Register map = ToRegister(instr->value()); | 1879 Register map = ToRegister(instr->value()); |
| 1880 __ EnumLength(result, map); | 1880 __ EnumLength(result, map); |
| 1881 } | 1881 } |
| (...skipping 3897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5779 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5779 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5780 __ ldr(result, FieldMemOperand(scratch, | 5780 __ ldr(result, FieldMemOperand(scratch, |
| 5781 FixedArray::kHeaderSize - kPointerSize)); | 5781 FixedArray::kHeaderSize - kPointerSize)); |
| 5782 __ bind(&done); | 5782 __ bind(&done); |
| 5783 } | 5783 } |
| 5784 | 5784 |
| 5785 | 5785 |
| 5786 #undef __ | 5786 #undef __ |
| 5787 | 5787 |
| 5788 } } // namespace v8::internal | 5788 } } // namespace v8::internal |
| OLD | NEW |