| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 __ InitializeRootRegister(); | 313 __ InitializeRootRegister(); |
| 314 | 314 |
| 315 __ pop(at); // Get continuation, leave pc on stack. | 315 __ pop(at); // Get continuation, leave pc on stack. |
| 316 __ pop(ra); | 316 __ pop(ra); |
| 317 __ Jump(at); | 317 __ Jump(at); |
| 318 __ stop("Unreachable."); | 318 __ stop("Unreachable."); |
| 319 } | 319 } |
| 320 | 320 |
| 321 | 321 |
| 322 // Maximum size of a table entry generated below. | 322 // Maximum size of a table entry generated below. |
| 323 const int Deoptimizer::table_entry_size_ = 7 * Assembler::kInstrSize; | 323 const int Deoptimizer::table_entry_size_ = 2 * Assembler::kInstrSize; |
| 324 | 324 |
| 325 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { | 325 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { |
| 326 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); | 326 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); |
| 327 | 327 |
| 328 // Create a sequence of deoptimization entries. | 328 // Create a sequence of deoptimization entries. |
| 329 // Note that registers are still live when jumping to an entry. | 329 // Note that registers are still live when jumping to an entry. |
| 330 Label table_start; | 330 Label table_start, done; |
| 331 __ bind(&table_start); | 331 __ bind(&table_start); |
| 332 for (int i = 0; i < count(); i++) { | 332 for (int i = 0; i < count(); i++) { |
| 333 Label start; | 333 Label start; |
| 334 __ bind(&start); | 334 __ bind(&start); |
| 335 __ addiu(sp, sp, -1 * kPointerSize); | 335 ASSERT(is_int16(i)); |
| 336 // Jump over the remaining deopt entries (including this one). | 336 __ Branch(USE_DELAY_SLOT, &done); // Expose delay slot. |
| 337 // This code is always reached by calling Jump, which puts the target (label | 337 __ li(at, i); // In the delay slot. |
| 338 // start) into t9. | |
| 339 const int remaining_entries = (count() - i) * table_entry_size_; | |
| 340 __ Addu(t9, t9, remaining_entries); | |
| 341 // 'at' was clobbered so we can only load the current entry value here. | |
| 342 __ li(at, i); | |
| 343 __ jr(t9); // Expose delay slot. | |
| 344 __ sw(at, MemOperand(sp, 0 * kPointerSize)); // In the delay slot. | |
| 345 | |
| 346 // Pad the rest of the code. | |
| 347 while (table_entry_size_ > (masm()->SizeOfCodeGeneratedSince(&start))) { | |
| 348 __ nop(); | |
| 349 } | |
| 350 | 338 |
| 351 ASSERT_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); | 339 ASSERT_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); |
| 352 } | 340 } |
| 353 | 341 |
| 354 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), | 342 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), |
| 355 count() * table_entry_size_); | 343 count() * table_entry_size_); |
| 344 __ bind(&done); |
| 345 __ Push(at); |
| 356 } | 346 } |
| 357 | 347 |
| 358 | 348 |
| 359 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { | 349 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { |
| 360 SetFrameSlot(offset, value); | 350 SetFrameSlot(offset, value); |
| 361 } | 351 } |
| 362 | 352 |
| 363 | 353 |
| 364 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { | 354 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { |
| 365 SetFrameSlot(offset, value); | 355 SetFrameSlot(offset, value); |
| 366 } | 356 } |
| 367 | 357 |
| 368 | 358 |
| 369 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 359 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
| 370 // No out-of-line constant pool support. | 360 // No out-of-line constant pool support. |
| 371 UNREACHABLE(); | 361 UNREACHABLE(); |
| 372 } | 362 } |
| 373 | 363 |
| 374 | 364 |
| 375 #undef __ | 365 #undef __ |
| 376 | 366 |
| 377 | 367 |
| 378 } } // namespace v8::internal | 368 } } // namespace v8::internal |
| OLD | NEW |