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_ = 4 * Assembler::kInstrSize; |
dusmil
2014/07/11 10:47:14
Real size now is 2 instructions.
kilvadyb
2014/07/11 12:06:05
Done.
| |
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 | 338 |
346 // Pad the rest of the code. | 339 // Pad the rest of the code. |
dusmil
2014/07/11 10:47:14
We can remove padding when size is changed.
kilvadyb
2014/07/11 12:06:05
Done.
| |
347 while (table_entry_size_ > (masm()->SizeOfCodeGeneratedSince(&start))) { | 340 while (table_entry_size_ > (masm()->SizeOfCodeGeneratedSince(&start))) { |
348 __ nop(); | 341 __ nop(); |
349 } | 342 } |
350 | |
351 ASSERT_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); | 343 ASSERT_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); |
352 } | 344 } |
353 | 345 |
354 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), | 346 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), |
355 count() * table_entry_size_); | 347 count() * table_entry_size_); |
348 __ bind(&done); | |
349 __ Push(at); | |
356 } | 350 } |
357 | 351 |
358 | 352 |
359 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { | 353 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { |
360 SetFrameSlot(offset, value); | 354 SetFrameSlot(offset, value); |
361 } | 355 } |
362 | 356 |
363 | 357 |
364 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { | 358 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { |
365 SetFrameSlot(offset, value); | 359 SetFrameSlot(offset, value); |
366 } | 360 } |
367 | 361 |
368 | 362 |
369 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 363 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
370 // No out-of-line constant pool support. | 364 // No out-of-line constant pool support. |
371 UNREACHABLE(); | 365 UNREACHABLE(); |
372 } | 366 } |
373 | 367 |
374 | 368 |
375 #undef __ | 369 #undef __ |
376 | 370 |
377 | 371 |
378 } } // namespace v8::internal | 372 } } // namespace v8::internal |
OLD | NEW |