Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 130743006: Merged r16772, r18000, r18298, r18319 into 3.21 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.21
Patch Set: Fix x64 Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 // Copy the string before recording it in the assembler to avoid 110 // Copy the string before recording it in the assembler to avoid
111 // issues when the stack allocated buffer goes out of scope. 111 // issues when the stack allocated buffer goes out of scope.
112 size_t length = builder.position(); 112 size_t length = builder.position();
113 Vector<char> copy = Vector<char>::New(length + 1); 113 Vector<char> copy = Vector<char>::New(length + 1);
114 OS::MemCopy(copy.start(), builder.Finalize(), copy.length()); 114 OS::MemCopy(copy.start(), builder.Finalize(), copy.length());
115 masm()->RecordComment(copy.start()); 115 masm()->RecordComment(copy.start());
116 } 116 }
117 117
118 118
119 void LCodeGen::SaveCallerDoubles() {
120 ASSERT(info()->saves_caller_doubles());
121 ASSERT(NeedsEagerFrame());
122 Comment(";;; Save clobbered callee double registers");
123 int count = 0;
124 BitVector* doubles = chunk()->allocated_double_registers();
125 BitVector::Iterator save_iterator(doubles);
126 while (!save_iterator.Done()) {
127 __ sdc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()),
128 MemOperand(sp, count * kDoubleSize));
129 save_iterator.Advance();
130 count++;
131 }
132 }
133
134
135 void LCodeGen::RestoreCallerDoubles() {
136 ASSERT(info()->saves_caller_doubles());
137 ASSERT(NeedsEagerFrame());
138 Comment(";;; Restore clobbered callee double registers");
139 BitVector* doubles = chunk()->allocated_double_registers();
140 BitVector::Iterator save_iterator(doubles);
141 int count = 0;
142 while (!save_iterator.Done()) {
143 __ ldc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()),
144 MemOperand(sp, count * kDoubleSize));
145 save_iterator.Advance();
146 count++;
147 }
148 }
149
150
119 bool LCodeGen::GeneratePrologue() { 151 bool LCodeGen::GeneratePrologue() {
120 ASSERT(is_generating()); 152 ASSERT(is_generating());
121 153
122 if (info()->IsOptimizing()) { 154 if (info()->IsOptimizing()) {
123 ProfileEntryHookStub::MaybeCallEntryHook(masm_); 155 ProfileEntryHookStub::MaybeCallEntryHook(masm_);
124 156
125 #ifdef DEBUG 157 #ifdef DEBUG
126 if (strlen(FLAG_stop_at) > 0 && 158 if (strlen(FLAG_stop_at) > 0 &&
127 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 159 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
128 __ stop("stop_at"); 160 __ stop("stop_at");
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 __ sw(a1, MemOperand(a0, 2 * kPointerSize)); 217 __ sw(a1, MemOperand(a0, 2 * kPointerSize));
186 __ Branch(&loop, ne, a0, Operand(sp)); 218 __ Branch(&loop, ne, a0, Operand(sp));
187 __ pop(a1); 219 __ pop(a1);
188 __ pop(a0); 220 __ pop(a0);
189 } else { 221 } else {
190 __ Subu(sp, sp, Operand(slots * kPointerSize)); 222 __ Subu(sp, sp, Operand(slots * kPointerSize));
191 } 223 }
192 } 224 }
193 225
194 if (info()->saves_caller_doubles()) { 226 if (info()->saves_caller_doubles()) {
195 Comment(";;; Save clobbered callee double registers"); 227 SaveCallerDoubles();
196 int count = 0;
197 BitVector* doubles = chunk()->allocated_double_registers();
198 BitVector::Iterator save_iterator(doubles);
199 while (!save_iterator.Done()) {
200 __ sdc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()),
201 MemOperand(sp, count * kDoubleSize));
202 save_iterator.Advance();
203 count++;
204 }
205 } 228 }
206 229
207 // Possibly allocate a local context. 230 // Possibly allocate a local context.
208 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 231 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
209 if (heap_slots > 0) { 232 if (heap_slots > 0) {
210 Comment(";;; Allocate local context"); 233 Comment(";;; Allocate local context");
211 // Argument to NewContext is the function, which is in a1. 234 // Argument to NewContext is the function, which is in a1.
212 __ push(a1); 235 __ push(a1);
213 if (heap_slots <= FastNewContextStub::kMaximumSlots) { 236 if (heap_slots <= FastNewContextStub::kMaximumSlots) {
214 FastNewContextStub stub(heap_slots); 237 FastNewContextStub stub(heap_slots);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 Address entry = deopt_jump_table_[i].address; 374 Address entry = deopt_jump_table_[i].address;
352 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; 375 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type;
353 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); 376 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
354 if (id == Deoptimizer::kNotDeoptimizationEntry) { 377 if (id == Deoptimizer::kNotDeoptimizationEntry) {
355 Comment(";;; jump table entry %d.", i); 378 Comment(";;; jump table entry %d.", i);
356 } else { 379 } else {
357 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); 380 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
358 } 381 }
359 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); 382 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry)));
360 if (deopt_jump_table_[i].needs_frame) { 383 if (deopt_jump_table_[i].needs_frame) {
384 ASSERT(!info()->saves_caller_doubles());
361 if (needs_frame.is_bound()) { 385 if (needs_frame.is_bound()) {
362 __ Branch(&needs_frame); 386 __ Branch(&needs_frame);
363 } else { 387 } else {
364 __ bind(&needs_frame); 388 __ bind(&needs_frame);
365 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); 389 __ MultiPush(cp.bit() | fp.bit() | ra.bit());
366 // This variant of deopt can only be used with stubs. Since we don't 390 // This variant of deopt can only be used with stubs. Since we don't
367 // have a function pointer to install in the stack frame that we're 391 // have a function pointer to install in the stack frame that we're
368 // building, install a special marker there instead. 392 // building, install a special marker there instead.
369 ASSERT(info()->IsStub()); 393 ASSERT(info()->IsStub());
370 __ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); 394 __ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB)));
371 __ push(scratch0()); 395 __ push(scratch0());
372 __ Addu(fp, sp, Operand(2 * kPointerSize)); 396 __ Addu(fp, sp, Operand(2 * kPointerSize));
373 __ Call(t9); 397 __ Call(t9);
374 } 398 }
375 } else { 399 } else {
400 if (info()->saves_caller_doubles()) {
401 ASSERT(info()->IsStub());
402 RestoreCallerDoubles();
403 }
376 __ Call(t9); 404 __ Call(t9);
377 } 405 }
378 } 406 }
379 __ RecordComment("]"); 407 __ RecordComment("]");
380 408
381 // The deoptimization jump table is the last part of the instruction 409 // The deoptimization jump table is the last part of the instruction
382 // sequence. Mark the generated code as done unless we bailed out. 410 // sequence. Mark the generated code as done unless we bailed out.
383 if (!is_aborted()) status_ = DONE; 411 if (!is_aborted()) status_ = DONE;
384 return !is_aborted(); 412 return !is_aborted();
385 } 413 }
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 if (info()->ShouldTrapOnDeopt()) { 824 if (info()->ShouldTrapOnDeopt()) {
797 Label skip; 825 Label skip;
798 if (condition != al) { 826 if (condition != al) {
799 __ Branch(&skip, NegateCondition(condition), src1, src2); 827 __ Branch(&skip, NegateCondition(condition), src1, src2);
800 } 828 }
801 __ stop("trap_on_deopt"); 829 __ stop("trap_on_deopt");
802 __ bind(&skip); 830 __ bind(&skip);
803 } 831 }
804 832
805 ASSERT(info()->IsStub() || frame_is_built_); 833 ASSERT(info()->IsStub() || frame_is_built_);
806 if (condition == al && frame_is_built_) { 834 // Go through jump table if we need to handle condition, build frame, or
835 // restore caller doubles.
836 if (condition == al && frame_is_built_ &&
837 !info()->saves_caller_doubles()) {
807 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); 838 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
808 } else { 839 } else {
809 // We often have several deopts to the same entry, reuse the last 840 // We often have several deopts to the same entry, reuse the last
810 // jump entry if this is the case. 841 // jump entry if this is the case.
811 if (deopt_jump_table_.is_empty() || 842 if (deopt_jump_table_.is_empty() ||
812 (deopt_jump_table_.last().address != entry) || 843 (deopt_jump_table_.last().address != entry) ||
813 (deopt_jump_table_.last().bailout_type != bailout_type) || 844 (deopt_jump_table_.last().bailout_type != bailout_type) ||
814 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { 845 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
815 Deoptimizer::JumpTableEntry table_entry(entry, 846 Deoptimizer::JumpTableEntry table_entry(entry,
816 bailout_type, 847 bailout_type,
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 2797
2767 2798
2768 void LCodeGen::DoReturn(LReturn* instr) { 2799 void LCodeGen::DoReturn(LReturn* instr) {
2769 if (FLAG_trace && info()->IsOptimizing()) { 2800 if (FLAG_trace && info()->IsOptimizing()) {
2770 // Push the return value on the stack as the parameter. 2801 // Push the return value on the stack as the parameter.
2771 // Runtime::TraceExit returns its parameter in v0. 2802 // Runtime::TraceExit returns its parameter in v0.
2772 __ push(v0); 2803 __ push(v0);
2773 __ CallRuntime(Runtime::kTraceExit, 1); 2804 __ CallRuntime(Runtime::kTraceExit, 1);
2774 } 2805 }
2775 if (info()->saves_caller_doubles()) { 2806 if (info()->saves_caller_doubles()) {
2776 ASSERT(NeedsEagerFrame()); 2807 RestoreCallerDoubles();
2777 BitVector* doubles = chunk()->allocated_double_registers();
2778 BitVector::Iterator save_iterator(doubles);
2779 int count = 0;
2780 while (!save_iterator.Done()) {
2781 __ ldc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()),
2782 MemOperand(sp, count * kDoubleSize));
2783 save_iterator.Advance();
2784 count++;
2785 }
2786 } 2808 }
2787 int no_frame_start = -1; 2809 int no_frame_start = -1;
2788 if (NeedsEagerFrame()) { 2810 if (NeedsEagerFrame()) {
2789 __ mov(sp, fp); 2811 __ mov(sp, fp);
2790 no_frame_start = masm_->pc_offset(); 2812 no_frame_start = masm_->pc_offset();
2791 __ Pop(ra, fp); 2813 __ Pop(ra, fp);
2792 } 2814 }
2793 if (instr->has_constant_parameter_count()) { 2815 if (instr->has_constant_parameter_count()) {
2794 int parameter_count = ToInteger32(instr->constant_parameter_count()); 2816 int parameter_count = ToInteger32(instr->constant_parameter_count());
2795 int32_t sp_delta = (parameter_count + 1) * kPointerSize; 2817 int32_t sp_delta = (parameter_count + 1) * kPointerSize;
(...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after
5784 __ Subu(scratch, result, scratch); 5806 __ Subu(scratch, result, scratch);
5785 __ lw(result, FieldMemOperand(scratch, 5807 __ lw(result, FieldMemOperand(scratch,
5786 FixedArray::kHeaderSize - kPointerSize)); 5808 FixedArray::kHeaderSize - kPointerSize));
5787 __ bind(&done); 5809 __ bind(&done);
5788 } 5810 }
5789 5811
5790 5812
5791 #undef __ 5813 #undef __
5792 5814
5793 } } // namespace v8::internal 5815 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698