OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
10 #include "src/safepoint-table.h" | 10 #include "src/safepoint-table.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 // Replace the current (input) frame with the output frames. | 266 // Replace the current (input) frame with the output frames. |
267 Label outer_push_loop, inner_push_loop, | 267 Label outer_push_loop, inner_push_loop, |
268 outer_loop_header, inner_loop_header; | 268 outer_loop_header, inner_loop_header; |
269 // Outer loop state: a4 = current "FrameDescription** output_", | 269 // Outer loop state: a4 = current "FrameDescription** output_", |
270 // a1 = one past the last FrameDescription**. | 270 // a1 = one past the last FrameDescription**. |
271 __ lw(a1, MemOperand(a0, Deoptimizer::output_count_offset())); | 271 __ lw(a1, MemOperand(a0, Deoptimizer::output_count_offset())); |
272 __ ld(a4, MemOperand(a0, Deoptimizer::output_offset())); // a4 is output_. | 272 __ ld(a4, MemOperand(a0, Deoptimizer::output_offset())); // a4 is output_. |
273 __ dsll(a1, a1, kPointerSizeLog2); // Count to offset. | 273 __ dsll(a1, a1, kPointerSizeLog2); // Count to offset. |
274 __ daddu(a1, a4, a1); // a1 = one past the last FrameDescription**. | 274 __ daddu(a1, a4, a1); // a1 = one past the last FrameDescription**. |
275 __ jmp(&outer_loop_header); | 275 __ BranchShort(&outer_loop_header); |
276 __ bind(&outer_push_loop); | 276 __ bind(&outer_push_loop); |
277 // Inner loop state: a2 = current FrameDescription*, a3 = loop index. | 277 // Inner loop state: a2 = current FrameDescription*, a3 = loop index. |
278 __ ld(a2, MemOperand(a4, 0)); // output_[ix] | 278 __ ld(a2, MemOperand(a4, 0)); // output_[ix] |
279 __ ld(a3, MemOperand(a2, FrameDescription::frame_size_offset())); | 279 __ ld(a3, MemOperand(a2, FrameDescription::frame_size_offset())); |
280 __ jmp(&inner_loop_header); | 280 __ BranchShort(&inner_loop_header); |
281 __ bind(&inner_push_loop); | 281 __ bind(&inner_push_loop); |
282 __ Dsubu(a3, a3, Operand(sizeof(uint64_t))); | 282 __ Dsubu(a3, a3, Operand(sizeof(uint64_t))); |
283 __ Daddu(a6, a2, Operand(a3)); | 283 __ Daddu(a6, a2, Operand(a3)); |
284 __ ld(a7, MemOperand(a6, FrameDescription::frame_content_offset())); | 284 __ ld(a7, MemOperand(a6, FrameDescription::frame_content_offset())); |
285 __ push(a7); | 285 __ push(a7); |
286 __ bind(&inner_loop_header); | 286 __ bind(&inner_loop_header); |
287 __ BranchShort(&inner_push_loop, ne, a3, Operand(zero_reg)); | 287 __ BranchShort(&inner_push_loop, ne, a3, Operand(zero_reg)); |
288 | 288 |
289 __ Daddu(a4, a4, Operand(kPointerSize)); | 289 __ Daddu(a4, a4, Operand(kPointerSize)); |
290 __ bind(&outer_loop_header); | 290 __ bind(&outer_loop_header); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 __ bind(&table_start); | 340 __ bind(&table_start); |
341 int kMaxEntriesBranchReach = | 341 int kMaxEntriesBranchReach = |
342 (1 << (kImm16Bits - 2)) / (table_entry_size_ / Assembler::kInstrSize); | 342 (1 << (kImm16Bits - 2)) / (table_entry_size_ / Assembler::kInstrSize); |
343 | 343 |
344 if (count() <= kMaxEntriesBranchReach) { | 344 if (count() <= kMaxEntriesBranchReach) { |
345 // Common case. | 345 // Common case. |
346 for (int i = 0; i < count(); i++) { | 346 for (int i = 0; i < count(); i++) { |
347 Label start; | 347 Label start; |
348 __ bind(&start); | 348 __ bind(&start); |
349 DCHECK(is_int16(i)); | 349 DCHECK(is_int16(i)); |
350 __ Branch(USE_DELAY_SLOT, &done); // Expose delay slot. | 350 __ BranchShort(USE_DELAY_SLOT, &done); // Expose delay slot. |
351 __ li(at, i); // In the delay slot. | 351 __ li(at, i); // In the delay slot. |
352 | 352 |
353 DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); | 353 DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); |
354 } | 354 } |
355 | 355 |
356 DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), | 356 DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), |
357 count() * table_entry_size_); | 357 count() * table_entry_size_); |
358 __ bind(&done); | 358 __ bind(&done); |
359 __ Push(at); | 359 __ Push(at); |
360 } else { | 360 } else { |
361 // Uncommon case, the branch cannot reach. | 361 // Uncommon case, the branch cannot reach. |
362 // Create mini trampoline and adjust id constants to get proper value at | 362 // Create mini trampoline and adjust id constants to get proper value at |
363 // the end of table. | 363 // the end of table. |
364 for (int i = kMaxEntriesBranchReach; i > 1; i--) { | 364 for (int i = kMaxEntriesBranchReach; i > 1; i--) { |
365 Label start; | 365 Label start; |
366 __ bind(&start); | 366 __ bind(&start); |
367 DCHECK(is_int16(i)); | 367 DCHECK(is_int16(i)); |
368 __ Branch(USE_DELAY_SLOT, &trampoline_jump); // Expose delay slot. | 368 __ BranchShort(USE_DELAY_SLOT, &trampoline_jump); // Expose delay slot. |
369 __ li(at, -i); // In the delay slot. | 369 __ li(at, -i); // In the delay slot. |
370 DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); | 370 DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); |
371 } | 371 } |
372 // Entry with id == kMaxEntriesBranchReach - 1. | 372 // Entry with id == kMaxEntriesBranchReach - 1. |
373 __ bind(&trampoline_jump); | 373 __ bind(&trampoline_jump); |
374 __ Branch(USE_DELAY_SLOT, &done_special); | 374 __ BranchShort(USE_DELAY_SLOT, &done_special); |
375 __ li(at, -1); | 375 __ li(at, -1); |
376 | 376 |
377 for (int i = kMaxEntriesBranchReach; i < count(); i++) { | 377 for (int i = kMaxEntriesBranchReach; i < count(); i++) { |
378 Label start; | 378 Label start; |
379 __ bind(&start); | 379 __ bind(&start); |
380 DCHECK(is_int16(i)); | 380 DCHECK(is_int16(i)); |
381 __ Branch(USE_DELAY_SLOT, &done); // Expose delay slot. | 381 __ Branch(USE_DELAY_SLOT, &done); // Expose delay slot. |
382 __ li(at, i); // In the delay slot. | 382 __ li(at, i); // In the delay slot. |
383 } | 383 } |
384 | 384 |
(...skipping 20 matching lines...) Expand all Loading... |
405 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 405 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
406 // No out-of-line constant pool support. | 406 // No out-of-line constant pool support. |
407 UNREACHABLE(); | 407 UNREACHABLE(); |
408 } | 408 } |
409 | 409 |
410 | 410 |
411 #undef __ | 411 #undef __ |
412 | 412 |
413 | 413 |
414 } } // namespace v8::internal | 414 } } // namespace v8::internal |
OLD | NEW |