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