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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return ToRegister(op->index()); | 391 return ToRegister(op->index()); |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) { | 395 Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) { |
396 if (op->IsRegister()) { | 396 if (op->IsRegister()) { |
397 return ToRegister(op->index()); | 397 return ToRegister(op->index()); |
398 } else if (op->IsConstantOperand()) { | 398 } else if (op->IsConstantOperand()) { |
399 LConstantOperand* const_op = LConstantOperand::cast(op); | 399 LConstantOperand* const_op = LConstantOperand::cast(op); |
400 HConstant* constant = chunk_->LookupConstant(const_op); | 400 HConstant* constant = chunk_->LookupConstant(const_op); |
401 Handle<Object> literal = constant->handle(); | 401 Handle<Object> literal = constant->handle(isolate()); |
402 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 402 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
403 if (r.IsInteger32()) { | 403 if (r.IsInteger32()) { |
404 ASSERT(literal->IsNumber()); | 404 ASSERT(literal->IsNumber()); |
405 __ li(scratch, Operand(static_cast<int32_t>(literal->Number()))); | 405 __ li(scratch, Operand(static_cast<int32_t>(literal->Number()))); |
406 } else if (r.IsSmi()) { | 406 } else if (r.IsSmi()) { |
407 ASSERT(constant->HasSmiValue()); | 407 ASSERT(constant->HasSmiValue()); |
408 __ li(scratch, Operand(Smi::FromInt(constant->Integer32Value()))); | 408 __ li(scratch, Operand(Smi::FromInt(constant->Integer32Value()))); |
409 } else if (r.IsDouble()) { | 409 } else if (r.IsDouble()) { |
410 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); | 410 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); |
411 } else { | 411 } else { |
(...skipping 17 matching lines...) Expand all Loading... |
429 | 429 |
430 | 430 |
431 DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, | 431 DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, |
432 FloatRegister flt_scratch, | 432 FloatRegister flt_scratch, |
433 DoubleRegister dbl_scratch) { | 433 DoubleRegister dbl_scratch) { |
434 if (op->IsDoubleRegister()) { | 434 if (op->IsDoubleRegister()) { |
435 return ToDoubleRegister(op->index()); | 435 return ToDoubleRegister(op->index()); |
436 } else if (op->IsConstantOperand()) { | 436 } else if (op->IsConstantOperand()) { |
437 LConstantOperand* const_op = LConstantOperand::cast(op); | 437 LConstantOperand* const_op = LConstantOperand::cast(op); |
438 HConstant* constant = chunk_->LookupConstant(const_op); | 438 HConstant* constant = chunk_->LookupConstant(const_op); |
439 Handle<Object> literal = constant->handle(); | 439 Handle<Object> literal = constant->handle(isolate()); |
440 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 440 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
441 if (r.IsInteger32()) { | 441 if (r.IsInteger32()) { |
442 ASSERT(literal->IsNumber()); | 442 ASSERT(literal->IsNumber()); |
443 __ li(at, Operand(static_cast<int32_t>(literal->Number()))); | 443 __ li(at, Operand(static_cast<int32_t>(literal->Number()))); |
444 __ mtc1(at, flt_scratch); | 444 __ mtc1(at, flt_scratch); |
445 __ cvt_d_w(dbl_scratch, flt_scratch); | 445 __ cvt_d_w(dbl_scratch, flt_scratch); |
446 return dbl_scratch; | 446 return dbl_scratch; |
447 } else if (r.IsDouble()) { | 447 } else if (r.IsDouble()) { |
448 Abort(kUnsupportedDoubleImmediate); | 448 Abort(kUnsupportedDoubleImmediate); |
449 } else if (r.IsTagged()) { | 449 } else if (r.IsTagged()) { |
450 Abort(kUnsupportedTaggedImmediate); | 450 Abort(kUnsupportedTaggedImmediate); |
451 } | 451 } |
452 } else if (op->IsStackSlot() || op->IsArgument()) { | 452 } else if (op->IsStackSlot() || op->IsArgument()) { |
453 MemOperand mem_op = ToMemOperand(op); | 453 MemOperand mem_op = ToMemOperand(op); |
454 __ ldc1(dbl_scratch, mem_op); | 454 __ ldc1(dbl_scratch, mem_op); |
455 return dbl_scratch; | 455 return dbl_scratch; |
456 } | 456 } |
457 UNREACHABLE(); | 457 UNREACHABLE(); |
458 return dbl_scratch; | 458 return dbl_scratch; |
459 } | 459 } |
460 | 460 |
461 | 461 |
462 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 462 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
463 HConstant* constant = chunk_->LookupConstant(op); | 463 HConstant* constant = chunk_->LookupConstant(op); |
464 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); | 464 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); |
465 return constant->handle(); | 465 return constant->handle(isolate()); |
466 } | 466 } |
467 | 467 |
468 | 468 |
469 bool LCodeGen::IsInteger32(LConstantOperand* op) const { | 469 bool LCodeGen::IsInteger32(LConstantOperand* op) const { |
470 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); | 470 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); |
471 } | 471 } |
472 | 472 |
473 | 473 |
474 bool LCodeGen::IsSmi(LConstantOperand* op) const { | 474 bool LCodeGen::IsSmi(LConstantOperand* op) const { |
475 return chunk_->LookupLiteralRepresentation(op).IsSmi(); | 475 return chunk_->LookupLiteralRepresentation(op).IsSmi(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 if (r.IsSmi()) { | 512 if (r.IsSmi()) { |
513 ASSERT(constant->HasSmiValue()); | 513 ASSERT(constant->HasSmiValue()); |
514 return Operand(Smi::FromInt(constant->Integer32Value())); | 514 return Operand(Smi::FromInt(constant->Integer32Value())); |
515 } else if (r.IsInteger32()) { | 515 } else if (r.IsInteger32()) { |
516 ASSERT(constant->HasInteger32Value()); | 516 ASSERT(constant->HasInteger32Value()); |
517 return Operand(constant->Integer32Value()); | 517 return Operand(constant->Integer32Value()); |
518 } else if (r.IsDouble()) { | 518 } else if (r.IsDouble()) { |
519 Abort(kToOperandUnsupportedDoubleImmediate); | 519 Abort(kToOperandUnsupportedDoubleImmediate); |
520 } | 520 } |
521 ASSERT(r.IsTagged()); | 521 ASSERT(r.IsTagged()); |
522 return Operand(constant->handle()); | 522 return Operand(constant->handle(isolate())); |
523 } else if (op->IsRegister()) { | 523 } else if (op->IsRegister()) { |
524 return Operand(ToRegister(op)); | 524 return Operand(ToRegister(op)); |
525 } else if (op->IsDoubleRegister()) { | 525 } else if (op->IsDoubleRegister()) { |
526 Abort(kToOperandIsDoubleRegisterUnimplemented); | 526 Abort(kToOperandIsDoubleRegisterUnimplemented); |
527 return Operand(0); | 527 return Operand(0); |
528 } | 528 } |
529 // Stack slots not implemented, use ToMemOperand instead. | 529 // Stack slots not implemented, use ToMemOperand instead. |
530 UNREACHABLE(); | 530 UNREACHABLE(); |
531 return Operand(0); | 531 return Operand(0); |
532 } | 532 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 } else if (is_uint32) { | 659 } else if (is_uint32) { |
660 translation->StoreUint32Register(reg); | 660 translation->StoreUint32Register(reg); |
661 } else { | 661 } else { |
662 translation->StoreInt32Register(reg); | 662 translation->StoreInt32Register(reg); |
663 } | 663 } |
664 } else if (op->IsDoubleRegister()) { | 664 } else if (op->IsDoubleRegister()) { |
665 DoubleRegister reg = ToDoubleRegister(op); | 665 DoubleRegister reg = ToDoubleRegister(op); |
666 translation->StoreDoubleRegister(reg); | 666 translation->StoreDoubleRegister(reg); |
667 } else if (op->IsConstantOperand()) { | 667 } else if (op->IsConstantOperand()) { |
668 HConstant* constant = chunk()->LookupConstant(LConstantOperand::cast(op)); | 668 HConstant* constant = chunk()->LookupConstant(LConstantOperand::cast(op)); |
669 int src_index = DefineDeoptimizationLiteral(constant->handle()); | 669 int src_index = DefineDeoptimizationLiteral(constant->handle(isolate())); |
670 translation->StoreLiteral(src_index); | 670 translation->StoreLiteral(src_index); |
671 } else { | 671 } else { |
672 UNREACHABLE(); | 672 UNREACHABLE(); |
673 } | 673 } |
674 } | 674 } |
675 | 675 |
676 | 676 |
677 void LCodeGen::CallCode(Handle<Code> code, | 677 void LCodeGen::CallCode(Handle<Code> code, |
678 RelocInfo::Mode mode, | 678 RelocInfo::Mode mode, |
679 LInstruction* instr) { | 679 LInstruction* instr) { |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 __ Move(result, v); | 1679 __ Move(result, v); |
1680 } | 1680 } |
1681 | 1681 |
1682 | 1682 |
1683 void LCodeGen::DoConstantE(LConstantE* instr) { | 1683 void LCodeGen::DoConstantE(LConstantE* instr) { |
1684 __ li(ToRegister(instr->result()), Operand(instr->value())); | 1684 __ li(ToRegister(instr->result()), Operand(instr->value())); |
1685 } | 1685 } |
1686 | 1686 |
1687 | 1687 |
1688 void LCodeGen::DoConstantT(LConstantT* instr) { | 1688 void LCodeGen::DoConstantT(LConstantT* instr) { |
1689 Handle<Object> value = instr->value(); | 1689 Handle<Object> value = instr->value(isolate()); |
1690 AllowDeferredHandleDereference smi_check; | 1690 AllowDeferredHandleDereference smi_check; |
1691 __ LoadObject(ToRegister(instr->result()), value); | 1691 __ LoadObject(ToRegister(instr->result()), value); |
1692 } | 1692 } |
1693 | 1693 |
1694 | 1694 |
1695 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1695 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
1696 Register result = ToRegister(instr->result()); | 1696 Register result = ToRegister(instr->result()); |
1697 Register map = ToRegister(instr->value()); | 1697 Register map = ToRegister(instr->value()); |
1698 __ EnumLength(result, map); | 1698 __ EnumLength(result, map); |
1699 } | 1699 } |
(...skipping 4075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5775 __ Subu(scratch, result, scratch); | 5775 __ Subu(scratch, result, scratch); |
5776 __ lw(result, FieldMemOperand(scratch, | 5776 __ lw(result, FieldMemOperand(scratch, |
5777 FixedArray::kHeaderSize - kPointerSize)); | 5777 FixedArray::kHeaderSize - kPointerSize)); |
5778 __ bind(&done); | 5778 __ bind(&done); |
5779 } | 5779 } |
5780 | 5780 |
5781 | 5781 |
5782 #undef __ | 5782 #undef __ |
5783 | 5783 |
5784 } } // namespace v8::internal | 5784 } } // namespace v8::internal |
OLD | NEW |