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

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 10919008: Unbox phis that were proven to be of type Double. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 __ popl(EAX); // Get result into EAX. 470 __ popl(EAX); // Get result into EAX.
471 471
472 // Remove the stub frame as we are about to return. 472 // Remove the stub frame as we are about to return.
473 __ LeaveFrame(); 473 __ LeaveFrame();
474 __ ret(); 474 __ ret();
475 } 475 }
476 476
477 477
478 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, 478 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame,
479 intptr_t deopt_reason, 479 intptr_t deopt_reason,
480 intptr_t* saved_registers_address); 480 uword saved_registers_address);
481 481
482 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp); 482 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp);
483 483
484 // This stub translates optimized frame into unoptimized frame. The optimized 484 // This stub translates optimized frame into unoptimized frame. The optimized
485 // frame can contain values in registers and on stack, the unoptimized 485 // frame can contain values in registers and on stack, the unoptimized
486 // frame contains all values on stack. 486 // frame contains all values on stack.
487 // Deoptimization occurs in following steps: 487 // Deoptimization occurs in following steps:
488 // - Push all registers that can contain values. 488 // - Push all registers that can contain values.
489 // - Call C routine to copy the stack and saved registers into temporary buffer. 489 // - Call C routine to copy the stack and saved registers into temporary buffer.
490 // - Adjust caller's frame to correct unoptimized frame size. 490 // - Adjust caller's frame to correct unoptimized frame size.
491 // - Fill the unoptimized frame. 491 // - Fill the unoptimized frame.
492 // Stack: 492 // Stack:
493 // +------------------+ 493 // +------------------+
494 // | 0 as PC marker | <- TOS 494 // | 0 as PC marker | <- TOS
495 // +------------------+ 495 // +------------------+
496 // | Saved FP | 496 // | Saved FP |
497 // +------------------+ 497 // +------------------+
498 // | return-address | (deoptimization point) 498 // | return-address | (deoptimization point)
499 // +------------------+ 499 // +------------------+
500 // | optimized frame | 500 // | optimized frame |
501 // | ... | 501 // | ... |
502 // 502 //
503 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { 503 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
504 __ EnterFrame(0); 504 __ EnterFrame(0);
505 // Push registers in their enumeration order: lowest register number at 505 // Push registers in their enumeration order: lowest register number at
506 // lowest address. 506 // lowest address.
507 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) { 507 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) {
508 __ pushl(static_cast<Register>(i)); 508 __ pushl(static_cast<Register>(i));
509 } 509 }
510 __ subl(ESP, Immediate(kNumberOfXmmRegisters * kDoubleSize));
511 intptr_t offset = 0;
512 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) {
513 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx);
514 __ movsd(Address(ESP, offset), xmm_reg);
515 offset += kDoubleSize;
516 }
517
510 __ movl(ECX, ESP); // Saved saved registers block. 518 __ movl(ECX, ESP); // Saved saved registers block.
511 __ ReserveAlignedFrameSpace(1 * kWordSize); 519 __ ReserveAlignedFrameSpace(1 * kWordSize);
512 __ SmiUntag(EAX); 520 __ SmiUntag(EAX);
513 __ movl(Address(ESP, 0), ECX); // Start of register block. 521 __ movl(Address(ESP, 0), ECX); // Start of register block.
514 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); 522 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry);
515 // Result (EAX) is stack-size (FP - SP) in bytes, incl. the return address. 523 // Result (EAX) is stack-size (FP - SP) in bytes, incl. the return address.
516 __ LeaveFrame(); 524 __ LeaveFrame();
517 __ popl(EDX); // Preserve return address. 525 __ popl(EDX); // Preserve return address.
518 __ movl(ESP, EBP); 526 __ movl(ESP, EBP);
519 __ subl(ESP, EAX); 527 __ subl(ESP, EAX);
520 __ movl(Address(ESP, 0), EDX); 528 __ movl(Address(ESP, 0), EDX);
521 529
522 __ EnterFrame(0); 530 __ EnterFrame(0);
523 __ movl(ECX, ESP); // Get last FP address. 531 __ movl(ECX, ESP); // Get last FP address.
524 __ ReserveAlignedFrameSpace(1 * kWordSize); 532 __ ReserveAlignedFrameSpace(1 * kWordSize);
525 __ movl(Address(ESP, 0), ECX); 533 __ movl(Address(ESP, 0), ECX);
526 __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry); 534 __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry);
527 __ LeaveFrame(); 535 __ LeaveFrame();
536
537 __ EnterFrame(0);
srdjan 2012/08/30 17:59:24 Add comment somewhere that GC can occur only at ca
Vyacheslav Egorov (Google) 2012/09/21 12:51:52 Done.
538 __ CallRuntime(kDeoptimizeMaterializeDoublesRuntimeEntry);
539 __ LeaveFrame();
528 __ ret(); 540 __ ret();
529 } 541 }
530 542
531 543
532 // Called for inline allocation of arrays. 544 // Called for inline allocation of arrays.
533 // Input parameters: 545 // Input parameters:
534 // EDX : Array length as Smi. 546 // EDX : Array length as Smi.
535 // ECX : array element type (either NULL or an instantiated type). 547 // ECX : array element type (either NULL or an instantiated type).
536 // Uses EAX, EBX, ECX, EDI as temporary registers. 548 // Uses EAX, EBX, ECX, EDI as temporary registers.
537 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved. 549 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved.
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object. 1899 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object.
1888 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. 1900 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer.
1889 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. 1901 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX.
1890 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. 1902 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer.
1891 __ jmp(EBX); // Jump to the exception handler code. 1903 __ jmp(EBX); // Jump to the exception handler code.
1892 } 1904 }
1893 1905
1894 } // namespace dart 1906 } // namespace dart
1895 1907
1896 #endif // defined TARGET_ARCH_IA32 1908 #endif // defined TARGET_ARCH_IA32
OLDNEW
« runtime/vm/isolate.h ('K') | « runtime/vm/locations.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698