OLD | NEW |
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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 // This stub translates optimized frame into unoptimized frame. The optimized | 315 // This stub translates optimized frame into unoptimized frame. The optimized |
316 // frame can contain values in registers and on stack, the unoptimized | 316 // frame can contain values in registers and on stack, the unoptimized |
317 // frame contains all values on stack. | 317 // frame contains all values on stack. |
318 // Deoptimization occurs in following steps: | 318 // Deoptimization occurs in following steps: |
319 // - Push all registers that can contain values. | 319 // - Push all registers that can contain values. |
320 // - Call C routine to copy the stack and saved registers into temporary buffer. | 320 // - Call C routine to copy the stack and saved registers into temporary buffer. |
321 // - Adjust caller's frame to correct unoptimized frame size. | 321 // - Adjust caller's frame to correct unoptimized frame size. |
322 // - Fill the unoptimized frame. | 322 // - Fill the unoptimized frame. |
323 // - Materialize objects that require allocation (e.g. Double instances). | 323 // - Materialize objects that require allocation (e.g. Double instances). |
324 // GC can occur only after frame is fully rewritten. | 324 // GC can occur only after frame is fully rewritten. |
325 // Stack: | 325 // Stack after EnterFrame(0) below: |
326 // +------------------+ | 326 // +------------------+ |
327 // | Saved FP | <- TOS | 327 // | Saved FP | <- TOS |
328 // +------------------+ | 328 // +------------------+ |
329 // | return-address | (deoptimization point) | 329 // | return-address | (deoptimization point) |
330 // +------------------+ | 330 // +------------------+ |
331 // | optimized frame | | 331 // | optimized frame | |
332 // | ... | | 332 // | ... | |
333 // | 333 // |
334 // Parts of the code cannot GC, part of the code can GC. | 334 // Parts of the code cannot GC, part of the code can GC. |
335 static void GenerateDeoptimizationSequence(Assembler* assembler, | 335 static void GenerateDeoptimizationSequence(Assembler* assembler, |
(...skipping 10 matching lines...) Expand all Loading... |
346 __ pushl(static_cast<Register>(i)); | 346 __ pushl(static_cast<Register>(i)); |
347 } | 347 } |
348 __ subl(ESP, Immediate(kNumberOfXmmRegisters * kFpuRegisterSize)); | 348 __ subl(ESP, Immediate(kNumberOfXmmRegisters * kFpuRegisterSize)); |
349 intptr_t offset = 0; | 349 intptr_t offset = 0; |
350 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) { | 350 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) { |
351 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx); | 351 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx); |
352 __ movups(Address(ESP, offset), xmm_reg); | 352 __ movups(Address(ESP, offset), xmm_reg); |
353 offset += kFpuRegisterSize; | 353 offset += kFpuRegisterSize; |
354 } | 354 } |
355 | 355 |
356 __ movl(ECX, ESP); // Saved saved registers block. | 356 __ movl(ECX, ESP); // Preserve saved registers block. |
357 __ ReserveAlignedFrameSpace(1 * kWordSize); | 357 __ ReserveAlignedFrameSpace(1 * kWordSize); |
358 __ SmiUntag(EAX); | |
359 __ movl(Address(ESP, 0), ECX); // Start of register block. | 358 __ movl(Address(ESP, 0), ECX); // Start of register block. |
360 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); | 359 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); |
361 // Result (EAX) is stack-size (FP - SP) in bytes, incl. the return address. | 360 // Result (EAX) is stack-size (FP - SP) in bytes, incl. the return address. |
362 | 361 |
363 if (preserve_eax) { | 362 if (preserve_eax) { |
364 // Restore result into EBX temporarily. | 363 // Restore result into EBX temporarily. |
365 __ movl(EBX, Address(EBP, saved_eax_offset_from_ebp * kWordSize)); | 364 __ movl(EBX, Address(EBP, saved_eax_offset_from_ebp * kWordSize)); |
366 } | 365 } |
367 | 366 |
368 __ LeaveFrame(); | 367 __ LeaveFrame(); |
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 __ Bind(&done); | 2100 __ Bind(&done); |
2102 __ popl(temp); | 2101 __ popl(temp); |
2103 __ popl(right); | 2102 __ popl(right); |
2104 __ popl(left); | 2103 __ popl(left); |
2105 __ ret(); | 2104 __ ret(); |
2106 } | 2105 } |
2107 | 2106 |
2108 } // namespace dart | 2107 } // namespace dart |
2109 | 2108 |
2110 #endif // defined TARGET_ARCH_IA32 | 2109 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |