| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 | 62 |
| 63 #define __ masm()-> | 63 #define __ masm()-> |
| 64 | 64 |
| 65 bool LCodeGen::GenerateCode() { | 65 bool LCodeGen::GenerateCode() { |
| 66 LPhase phase("Z_Code generation", chunk()); | 66 LPhase phase("Z_Code generation", chunk()); |
| 67 ASSERT(is_unused()); | 67 ASSERT(is_unused()); |
| 68 status_ = GENERATING; | 68 status_ = GENERATING; |
| 69 | 69 |
| 70 chunk()->add_safepoints_registers(r10.bit() | fp.bit()); |
| 71 // Add some double registers to save to be able to save all registers with |
| 72 // only two vstm instructions. |
| 73 int first = -1; |
| 74 int last = -1; |
| 75 for (int i = 0; i < LowDwVfpRegister::kMaxNumLowRegisters; i++) { |
| 76 if ((chunk()->safepoints_double_registers() & (1 << i)) != 0) { |
| 77 if (first == -1) first = i; |
| 78 last = i; |
| 79 } |
| 80 } |
| 81 if (first != -1) { |
| 82 chunk()->add_safepoints_double_registers( |
| 83 ((1 << last) - 1) & ~((1 << first) - 1)); |
| 84 } |
| 85 first = -1; |
| 86 last = -1; |
| 87 for (int i = LowDwVfpRegister::kMaxNumLowRegisters; |
| 88 i < DoubleRegister::NumRegisters(); |
| 89 i++) { |
| 90 if ((chunk()->safepoints_double_registers() & (1 << i)) != 0) { |
| 91 if (first == -1) first = i; |
| 92 last = i; |
| 93 } |
| 94 } |
| 95 if (first != -1) { |
| 96 chunk()->add_safepoints_double_registers( |
| 97 ((1 << last) - 1) & ~((1 << first) - 1)); |
| 98 } |
| 99 masm_->set_registers_masks(chunk()->safepoints_registers(), |
| 100 chunk()->safepoints_double_registers()); |
| 101 |
| 70 // Open a frame scope to indicate that there is a frame on the stack. The | 102 // Open a frame scope to indicate that there is a frame on the stack. The |
| 71 // NONE indicates that the scope shouldn't actually generate code to set up | 103 // NONE indicates that the scope shouldn't actually generate code to set up |
| 72 // the frame (that is done in GeneratePrologue). | 104 // the frame (that is done in GeneratePrologue). |
| 73 FrameScope frame_scope(masm_, StackFrame::NONE); | 105 FrameScope frame_scope(masm_, StackFrame::NONE); |
| 74 | 106 |
| 75 return GeneratePrologue() && | 107 return GeneratePrologue() && |
| 76 GenerateBody() && | 108 GenerateBody() && |
| 77 GenerateDeferredCode() && | 109 GenerateDeferredCode() && |
| 78 GenerateDeoptJumpTable() && | 110 GenerateDeoptJumpTable() && |
| 79 GenerateSafepointTable(); | 111 GenerateSafepointTable(); |
| (...skipping 4990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5070 | 5102 |
| 5071 | 5103 |
| 5072 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { | 5104 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { |
| 5073 { | 5105 { |
| 5074 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 5106 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
| 5075 __ push(object); | 5107 __ push(object); |
| 5076 __ mov(cp, Operand::Zero()); | 5108 __ mov(cp, Operand::Zero()); |
| 5077 __ CallRuntimeSaveDoubles(Runtime::kTryMigrateInstance); | 5109 __ CallRuntimeSaveDoubles(Runtime::kTryMigrateInstance); |
| 5078 RecordSafepointWithRegisters( | 5110 RecordSafepointWithRegisters( |
| 5079 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 5111 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
| 5080 __ StoreToSafepointRegisterSlot(r0, scratch0()); | 5112 ASSERT((chunk()->safepoints_registers() & scratch0().bit()) == 0); |
| 5113 __ mov(scratch0(), r0); |
| 5081 } | 5114 } |
| 5082 __ tst(scratch0(), Operand(kSmiTagMask)); | 5115 __ tst(scratch0(), Operand(kSmiTagMask)); |
| 5083 DeoptimizeIf(eq, instr->environment()); | 5116 DeoptimizeIf(eq, instr->environment()); |
| 5084 } | 5117 } |
| 5085 | 5118 |
| 5086 | 5119 |
| 5087 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5120 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 5088 class DeferredCheckMaps V8_FINAL : public LDeferredCode { | 5121 class DeferredCheckMaps V8_FINAL : public LDeferredCode { |
| 5089 public: | 5122 public: |
| 5090 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5123 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5733 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5766 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5734 __ ldr(result, FieldMemOperand(scratch, | 5767 __ ldr(result, FieldMemOperand(scratch, |
| 5735 FixedArray::kHeaderSize - kPointerSize)); | 5768 FixedArray::kHeaderSize - kPointerSize)); |
| 5736 __ bind(&done); | 5769 __ bind(&done); |
| 5737 } | 5770 } |
| 5738 | 5771 |
| 5739 | 5772 |
| 5740 #undef __ | 5773 #undef __ |
| 5741 | 5774 |
| 5742 } } // namespace v8::internal | 5775 } } // namespace v8::internal |
| OLD | NEW |