| Index: src/x64/lithium-codegen-x64.cc
|
| ===================================================================
|
| --- src/x64/lithium-codegen-x64.cc (revision 7083)
|
| +++ src/x64/lithium-codegen-x64.cc (working copy)
|
| @@ -48,23 +48,39 @@
|
| : codegen_(codegen),
|
| pointers_(pointers),
|
| deoptimization_index_(deoptimization_index),
|
| - ensure_reloc_space_(ensure_reloc_space) { }
|
| + ensure_reloc_space_(ensure_reloc_space),
|
| + previous_safepoint_position_(-kMinSafepointSize) { }
|
| virtual ~SafepointGenerator() { }
|
|
|
| virtual void Generate() {
|
| + // Ensure that we have enough space after the previous safepoint position
|
| + // for the generated code there.
|
| + int position = codegen_->masm()->pc_offset();
|
| + ASSERT(position > previous_safepoint_position_);
|
| + if (position < previous_safepoint_position_ + kMinSafepointSize) {
|
| + int padding_size =
|
| + previous_safepoint_position_ + kMinSafepointSize - position;
|
| + STATIC_ASSERT(kMinSafepointSize <= 9); // One multibyte nop is enough.
|
| + codegen_->masm()->nop(padding_size);
|
| + position += padding_size;
|
| + }
|
| // Ensure that we have enough space in the reloc info to patch
|
| // this with calls when doing deoptimization.
|
| if (ensure_reloc_space_) {
|
| codegen_->masm()->RecordComment(RelocInfo::kFillerCommentString, true);
|
| }
|
| codegen_->RecordSafepoint(pointers_, deoptimization_index_);
|
| + previous_safepoint_position_ = position;
|
| }
|
|
|
| private:
|
| + static const int kMinSafepointSize =
|
| + MacroAssembler::kShortCallInstructionLength;
|
| LCodeGen* codegen_;
|
| LPointerMap* pointers_;
|
| int deoptimization_index_;
|
| bool ensure_reloc_space_;
|
| + int previous_safepoint_position_;
|
| };
|
|
|
|
|
| @@ -92,8 +108,8 @@
|
|
|
| void LCodeGen::Abort(const char* format, ...) {
|
| if (FLAG_trace_bailout) {
|
| - SmartPointer<char> debug_name = graph()->debug_name()->ToCString();
|
| - PrintF("Aborting LCodeGen in @\"%s\": ", *debug_name);
|
| + SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString());
|
| + PrintF("Aborting LCodeGen in @\"%s\": ", *name);
|
| va_list arguments;
|
| va_start(arguments, format);
|
| OS::VPrint(format, arguments);
|
| @@ -1432,7 +1448,7 @@
|
| __ j(equal, &load);
|
| __ movl(result, Immediate(Heap::kFalseValueRootIndex));
|
| __ bind(&load);
|
| - __ movq(result, Operand(kRootRegister, result, times_pointer_size, 0));
|
| + __ LoadRootIndexed(result, result, 0);
|
| } else {
|
| NearLabel true_value, false_value, done;
|
| __ j(equal, &true_value);
|
| @@ -1563,8 +1579,7 @@
|
| }
|
| // result is zero if input is a smi, and one otherwise.
|
| ASSERT(Heap::kFalseValueRootIndex == Heap::kTrueValueRootIndex + 1);
|
| - __ movq(result, Operand(kRootRegister, result, times_pointer_size,
|
| - Heap::kTrueValueRootIndex * kPointerSize));
|
| + __ LoadRootIndexed(result, result, Heap::kTrueValueRootIndex);
|
| }
|
|
|
|
|
| @@ -1978,7 +1993,8 @@
|
| __ movq(ContextOperand(context, instr->slot_index()), value);
|
| if (instr->needs_write_barrier()) {
|
| int offset = Context::SlotOffset(instr->slot_index());
|
| - __ RecordWrite(context, offset, value, kScratchRegister);
|
| + Register scratch = ToRegister(instr->TempAt(0));
|
| + __ RecordWrite(context, offset, value, scratch);
|
| }
|
| }
|
|
|
| @@ -2294,7 +2310,7 @@
|
| LInstruction* instr) {
|
| // Change context if needed.
|
| bool change_context =
|
| - (graph()->info()->closure()->context() != function->context()) ||
|
| + (info()->closure()->context() != function->context()) ||
|
| scope()->contains_with() ||
|
| (scope()->num_heap_slots() > 0);
|
| if (change_context) {
|
| @@ -2311,7 +2327,7 @@
|
| RecordPosition(pointers->position());
|
|
|
| // Invoke function.
|
| - if (*function == *graph()->info()->closure()) {
|
| + if (*function == *info()->closure()) {
|
| __ CallSelf();
|
| } else {
|
| __ call(FieldOperand(rdi, JSFunction::kCodeEntryOffset));
|
|
|