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

Side by Side Diff: runtime/vm/stub_code_x64.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
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_X64) 6 #if defined(TARGET_ARCH_X64)
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 __ popq(RAX); // Get result into RAX. 463 __ popq(RAX); // Get result into RAX.
464 464
465 // Remove the stub frame as we are about to return. 465 // Remove the stub frame as we are about to return.
466 __ LeaveFrame(); 466 __ LeaveFrame();
467 __ ret(); 467 __ ret();
468 } 468 }
469 469
470 470
471 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, 471 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame,
472 intptr_t deopt_reason, 472 intptr_t deopt_reason,
473 intptr_t* saved_registers_address); 473 uword saved_registers_address);
474 474
475 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp); 475 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp);
476 476
477 // This stub translates optimized frame into unoptimized frame. The optimized 477 // This stub translates optimized frame into unoptimized frame. The optimized
478 // frame can contain values in registers and on stack, the unoptimized 478 // frame can contain values in registers and on stack, the unoptimized
479 // frame contains all values on stack. 479 // frame contains all values on stack.
480 // Deoptimization occurs in following steps: 480 // Deoptimization occurs in following steps:
481 // - Push all registers that can contain values. 481 // - Push all registers that can contain values.
482 // - Call C routine to copy the stack and saved registers into temporary buffer. 482 // - Call C routine to copy the stack and saved registers into temporary buffer.
483 // - Adjust caller's frame to correct unoptimized frame size. 483 // - Adjust caller's frame to correct unoptimized frame size.
484 // - Fill the unoptimized frame. 484 // - Fill the unoptimized frame.
485 // Stack: 485 // Stack:
486 // +------------------+ 486 // +------------------+
487 // | 0 as PC marker | <- TOS 487 // | 0 as PC marker | <- TOS
488 // +------------------+ 488 // +------------------+
489 // | Saved FP | 489 // | Saved FP |
490 // +------------------+ 490 // +------------------+
491 // | return-address | (deoptimization point) 491 // | return-address | (deoptimization point)
492 // +------------------+ 492 // +------------------+
493 // | optimized frame | 493 // | optimized frame |
494 // | ... | 494 // | ... |
495 // 495 //
496 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { 496 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
497 __ EnterFrame(0); 497 __ EnterFrame(0);
498 // Push registers in their enumeration order: lowest register number at 498 // Push registers in their enumeration order: lowest register number at
499 // lowest address. 499 // lowest address.
500 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) { 500 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) {
501 __ pushq(static_cast<Register>(i)); 501 __ pushq(static_cast<Register>(i));
502 } 502 }
503 __ subq(RSP, Immediate(kNumberOfXmmRegisters * kDoubleSize));
504 intptr_t offset = 0;
505 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) {
506 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx);
507 __ movsd(Address(RSP, offset), xmm_reg);
508 offset += kDoubleSize;
509 }
510
503 __ movq(RCX, RSP); // Saved saved registers block. 511 __ movq(RCX, RSP); // Saved saved registers block.
504 __ ReserveAlignedFrameSpace(0); 512 __ ReserveAlignedFrameSpace(0);
505 __ SmiUntag(RAX); 513 __ SmiUntag(RAX);
506 __ movq(RDI, RCX); // Set up argument 1 saved_registers_address. 514 __ movq(RDI, RCX); // Set up argument 1 saved_registers_address.
507 515
508 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); 516 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry);
509 // Result (RAX) is stack-size (FP - SP) in bytes, incl. the return address. 517 // Result (RAX) is stack-size (FP - SP) in bytes, incl. the return address.
510 __ LeaveFrame(); 518 __ LeaveFrame();
511 __ popq(RCX); // Preserve return address. 519 __ popq(RCX); // Preserve return address.
512 __ movq(RSP, RBP); 520 __ movq(RSP, RBP);
513 __ subq(RSP, RAX); 521 __ subq(RSP, RAX);
514 __ movq(Address(RSP, 0), RCX); 522 __ movq(Address(RSP, 0), RCX);
515 523
516 __ EnterFrame(0); 524 __ EnterFrame(0);
517 __ movq(RCX, RSP); // Get last FP address. 525 __ movq(RCX, RSP); // Get last FP address.
518 __ ReserveAlignedFrameSpace(0); 526 __ ReserveAlignedFrameSpace(0);
519 __ movq(RDI, RCX); // Set up argument 1 last_fp. 527 __ movq(RDI, RCX); // Set up argument 1 last_fp.
520 __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry); 528 __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry);
521 __ LeaveFrame(); 529 __ LeaveFrame();
530
531 __ EnterFrame(0);
532 __ CallRuntime(kDeoptimizeMaterializeDoublesRuntimeEntry);
533 __ LeaveFrame();
534
522 __ ret(); 535 __ ret();
523 } 536 }
524 537
525 538
526 // Called for inline allocation of arrays. 539 // Called for inline allocation of arrays.
527 // Input parameters: 540 // Input parameters:
528 // R10 : Array length as Smi. 541 // R10 : Array length as Smi.
529 // RBX : array element type (either NULL or an instantiated type). 542 // RBX : array element type (either NULL or an instantiated type).
530 // NOTE: R10 cannot be clobbered here as the caller relies on it being saved. 543 // NOTE: R10 cannot be clobbered here as the caller relies on it being saved.
531 // The newly allocated object is returned in RAX. 544 // The newly allocated object is returned in RAX.
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { 1860 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) {
1848 __ movq(RAX, RCX); // error object. 1861 __ movq(RAX, RCX); // error object.
1849 __ movq(RBP, RDX); // target frame_pointer. 1862 __ movq(RBP, RDX); // target frame_pointer.
1850 __ movq(RSP, RSI); // target stack_pointer. 1863 __ movq(RSP, RSI); // target stack_pointer.
1851 __ jmp(RDI); // Jump to the exception handler code. 1864 __ jmp(RDI); // Jump to the exception handler code.
1852 } 1865 }
1853 1866
1854 } // namespace dart 1867 } // namespace dart
1855 1868
1856 #endif // defined TARGET_ARCH_X64 1869 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698