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

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

Issue 2380403003: Lazy deopt without code patching. (Closed)
Patch Set: remove tracing register assignment Created 4 years, 2 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
« no previous file with comments | « runtime/vm/stack_frame.h ('k') | runtime/vm/stub_code_arm64.cc » ('j') | 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_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 if (kind == kLazyDeoptFromReturn) { 515 if (kind == kLazyDeoptFromReturn) {
516 __ Push(R1); // Preserve result, it will be GC-d here. 516 __ Push(R1); // Preserve result, it will be GC-d here.
517 } else if (kind == kLazyDeoptFromThrow) { 517 } else if (kind == kLazyDeoptFromThrow) {
518 __ Push(R1); // Preserve exception, it will be GC-d here. 518 __ Push(R1); // Preserve exception, it will be GC-d here.
519 __ Push(R2); // Preserve stacktrace, it will be GC-d here. 519 __ Push(R2); // Preserve stacktrace, it will be GC-d here.
520 } 520 }
521 __ PushObject(Smi::ZoneHandle()); // Space for the result. 521 __ PushObject(Smi::ZoneHandle()); // Space for the result.
522 __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0); 522 __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0);
523 // Result tells stub how many bytes to remove from the expression stack 523 // Result tells stub how many bytes to remove from the expression stack
524 // of the bottom-most frame. They were used as materialization arguments. 524 // of the bottom-most frame. They were used as materialization arguments.
525 __ Pop(R1); 525 __ Pop(R2);
526 if (kind == kLazyDeoptFromReturn) { 526 if (kind == kLazyDeoptFromReturn) {
527 __ Pop(R0); // Restore result. 527 __ Pop(R0); // Restore result.
528 } else if (kind == kLazyDeoptFromThrow) { 528 } else if (kind == kLazyDeoptFromThrow) {
529 __ Pop(R1); // Restore stacktrace. 529 __ Pop(R1); // Restore stacktrace.
530 __ Pop(R0); // Restore exception. 530 __ Pop(R0); // Restore exception.
531 } 531 }
532 __ LeaveStubFrame(); 532 __ LeaveStubFrame();
533 // Remove materialization arguments. 533 // Remove materialization arguments.
534 __ add(SP, SP, Operand(R1, ASR, kSmiTagSize)); 534 __ add(SP, SP, Operand(R2, ASR, kSmiTagSize));
535 __ Ret(); 535 __ Ret();
536 } 536 }
537 537
538 538
539 // LR: return address + call-instruction-size
540 // R0: result, must be preserved 539 // R0: result, must be preserved
541 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { 540 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) {
542 // Correct return address to point just after the call that is being
543 // deoptimized.
544 __ AddImmediate(LR, -CallPattern::DeoptCallPatternLengthInBytes());
545 // Push zap value instead of CODE_REG for lazy deopt. 541 // Push zap value instead of CODE_REG for lazy deopt.
546 __ LoadImmediate(IP, 0xf1f1f1f1); 542 __ LoadImmediate(IP, 0xf1f1f1f1);
547 __ Push(IP); 543 __ Push(IP);
544 // Return address for "call" to deopt stub.
545 __ LoadImmediate(LR, 0xe1e1e1e1);
546 __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset()));
548 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); 547 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn);
549 } 548 }
550 549
551 550
552 // LR: return address + call-instruction-size
553 // R0: exception, must be preserved 551 // R0: exception, must be preserved
554 // R1: stacktrace, must be preserved 552 // R1: stacktrace, must be preserved
555 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { 553 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) {
556 // Correct return address to point just after the call that is being
557 // deoptimized.
558 __ AddImmediate(LR, -CallPattern::DeoptCallPatternLengthInBytes());
559 // Push zap value instead of CODE_REG for lazy deopt. 554 // Push zap value instead of CODE_REG for lazy deopt.
560 __ LoadImmediate(IP, 0xf1f1f1f1); 555 __ LoadImmediate(IP, 0xf1f1f1f1);
561 __ Push(IP); 556 __ Push(IP);
557 // Return address for "call" to deopt stub.
558 __ LoadImmediate(LR, 0xe1e1e1e1);
559 __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset()));
562 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); 560 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow);
563 } 561 }
564 562
565 563
566 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { 564 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
567 GenerateDeoptimizationSequence(assembler, kEagerDeopt); 565 GenerateDeoptimizationSequence(assembler, kEagerDeopt);
568 } 566 }
569 567
570 568
571 static void GenerateDispatcherCode(Assembler* assembler, 569 static void GenerateDispatcherCode(Assembler* assembler,
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 } 2254 }
2257 2255
2258 2256
2259 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { 2257 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
2260 __ bkpt(0); 2258 __ bkpt(0);
2261 } 2259 }
2262 2260
2263 } // namespace dart 2261 } // namespace dart
2264 2262
2265 #endif // defined TARGET_ARCH_ARM 2263 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/stack_frame.h ('k') | runtime/vm/stub_code_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698