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

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

Issue 14476009: Enable api tests on ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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
« no previous file with comments | « 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // This stub translates optimized frame into unoptimized frame. The optimized 309 // This stub translates optimized frame into unoptimized frame. The optimized
310 // frame can contain values in registers and on stack, the unoptimized 310 // frame can contain values in registers and on stack, the unoptimized
311 // frame contains all values on stack. 311 // frame contains all values on stack.
312 // Deoptimization occurs in following steps: 312 // Deoptimization occurs in following steps:
313 // - Push all registers that can contain values. 313 // - Push all registers that can contain values.
314 // - Call C routine to copy the stack and saved registers into temporary buffer. 314 // - Call C routine to copy the stack and saved registers into temporary buffer.
315 // - Adjust caller's frame to correct unoptimized frame size. 315 // - Adjust caller's frame to correct unoptimized frame size.
316 // - Fill the unoptimized frame. 316 // - Fill the unoptimized frame.
317 // - Materialize objects that require allocation (e.g. Double instances). 317 // - Materialize objects that require allocation (e.g. Double instances).
318 // GC can occur only after frame is fully rewritten. 318 // GC can occur only after frame is fully rewritten.
319 // Stack: 319 // Stack after EnterFrame(0) below:
320 // +------------------+ 320 // +------------------+
321 // | Saved FP | 321 // | Saved FP | <- TOS
322 // +------------------+ 322 // +------------------+
323 // | return-address | (deoptimization point) 323 // | return-address | (deoptimization point)
324 // +------------------+ 324 // +------------------+
325 // | optimized frame | 325 // | optimized frame |
326 // | ... | 326 // | ... |
327 // 327 //
328 // Parts of the code cannot GC, part of the code can GC. 328 // Parts of the code cannot GC, part of the code can GC.
329 static void GenerateDeoptimizationSequence(Assembler* assembler, 329 static void GenerateDeoptimizationSequence(Assembler* assembler,
330 bool preserve_rax) { 330 bool preserve_rax) {
331 __ EnterFrame(0); 331 __ EnterFrame(0);
332 // The code in this frame may not cause GC. kDeoptimizeCopyFrameRuntimeEntry 332 // The code in this frame may not cause GC. kDeoptimizeCopyFrameRuntimeEntry
333 // and kDeoptimizeFillFrameRuntimeEntry are leaf runtime calls. 333 // and kDeoptimizeFillFrameRuntimeEntry are leaf runtime calls.
334 const intptr_t saved_rax_offset_from_ebp = -(kNumberOfCpuRegisters - RAX); 334 const intptr_t saved_rax_offset_from_ebp = -(kNumberOfCpuRegisters - RAX);
335 // Result in EAX is preserved as part of pushing all registers below. 335 // Result in EAX is preserved as part of pushing all registers below.
336 336
337 // Push registers in their enumeration order: lowest register number at 337 // Push registers in their enumeration order: lowest register number at
338 // lowest address. 338 // lowest address.
339 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) { 339 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) {
340 __ pushq(static_cast<Register>(i)); 340 __ pushq(static_cast<Register>(i));
341 } 341 }
342 __ subq(RSP, Immediate(kNumberOfXmmRegisters * kFpuRegisterSize)); 342 __ subq(RSP, Immediate(kNumberOfXmmRegisters * kFpuRegisterSize));
343 intptr_t offset = 0; 343 intptr_t offset = 0;
344 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) { 344 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) {
345 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx); 345 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx);
346 __ movups(Address(RSP, offset), xmm_reg); 346 __ movups(Address(RSP, offset), xmm_reg);
347 offset += kFpuRegisterSize; 347 offset += kFpuRegisterSize;
348 } 348 }
349 349
350 __ movq(RCX, RSP); // Saved saved registers block. 350 __ movq(RDI, RSP); // Pass address of saved registers block.
351 __ ReserveAlignedFrameSpace(0); 351 __ ReserveAlignedFrameSpace(0);
352 __ SmiUntag(RAX);
353 __ movq(RDI, RCX); // Set up argument 1 saved_registers_address.
354
355 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); 352 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry);
356 // Result (RAX) is stack-size (FP - SP) in bytes, incl. the return address. 353 // Result (RAX) is stack-size (FP - SP) in bytes, incl. the return address.
357 354
358 if (preserve_rax) { 355 if (preserve_rax) {
359 // Restore result into RBX temporarily. 356 // Restore result into RBX temporarily.
360 __ movq(RBX, Address(RBP, saved_rax_offset_from_ebp * kWordSize)); 357 __ movq(RBX, Address(RBP, saved_rax_offset_from_ebp * kWordSize));
361 } 358 }
362 359
363 __ LeaveFrame(); 360 __ LeaveFrame();
364 __ popq(RCX); // Preserve return address. 361 __ popq(RCX); // Preserve return address.
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 __ cmpq(left, right); 2054 __ cmpq(left, right);
2058 __ Bind(&done); 2055 __ Bind(&done);
2059 __ popq(right); 2056 __ popq(right);
2060 __ popq(left); 2057 __ popq(left);
2061 __ ret(); 2058 __ ret();
2062 } 2059 }
2063 2060
2064 } // namespace dart 2061 } // namespace dart
2065 2062
2066 #endif // defined TARGET_ARCH_X64 2063 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698