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

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

Issue 1812753002: - Move (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
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" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 2584 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 } 2595 }
2596 2596
2597 2597
2598 class CheckStackOverflowSlowPath : public SlowPathCode { 2598 class CheckStackOverflowSlowPath : public SlowPathCode {
2599 public: 2599 public:
2600 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) 2600 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction)
2601 : instruction_(instruction) { } 2601 : instruction_(instruction) { }
2602 2602
2603 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2603 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2604 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { 2604 if (FLAG_use_osr && osr_entry_label()->IsLinked()) {
2605 uword flags_address = Isolate::Current()->stack_overflow_flags_address();
2606 Register temp = instruction_->locs()->temp(0).reg();
2607 __ Comment("CheckStackOverflowSlowPathOsr"); 2605 __ Comment("CheckStackOverflowSlowPathOsr");
2608 __ Bind(osr_entry_label()); 2606 __ Bind(osr_entry_label());
2609 if (FLAG_allow_absolute_addresses) { 2607 __ movq(Address(THR, Thread::stack_overflow_flags_offset()),
2610 __ LoadImmediate(temp, Immediate(flags_address)); 2608 Immediate(Thread::kOsrRequest));
2611 __ movq(Address(temp, 0), Immediate(Isolate::kOsrRequest));
2612 } else {
2613 __ LoadIsolate(TMP);
2614 __ movq(Address(TMP, Isolate::stack_overflow_flags_offset()),
2615 Immediate(Isolate::kOsrRequest));
2616 }
2617 } 2609 }
2618 __ Comment("CheckStackOverflowSlowPath"); 2610 __ Comment("CheckStackOverflowSlowPath");
2619 __ Bind(entry_label()); 2611 __ Bind(entry_label());
2620 compiler->SaveLiveRegisters(instruction_->locs()); 2612 compiler->SaveLiveRegisters(instruction_->locs());
2621 // pending_deoptimization_env_ is needed to generate a runtime call that 2613 // pending_deoptimization_env_ is needed to generate a runtime call that
2622 // may throw an exception. 2614 // may throw an exception.
2623 ASSERT(compiler->pending_deoptimization_env_ == NULL); 2615 ASSERT(compiler->pending_deoptimization_env_ == NULL);
2624 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); 2616 Environment* env = compiler->SlowPathEnvironmentFor(instruction_);
2625 compiler->pending_deoptimization_env_ = env; 2617 compiler->pending_deoptimization_env_ = env;
2626 compiler->GenerateRuntimeCall(instruction_->token_pos(), 2618 compiler->GenerateRuntimeCall(instruction_->token_pos(),
(...skipping 24 matching lines...) Expand all
2651 Label osr_entry_label_; 2643 Label osr_entry_label_;
2652 }; 2644 };
2653 2645
2654 2646
2655 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2647 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2656 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); 2648 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this);
2657 compiler->AddSlowPathCode(slow_path); 2649 compiler->AddSlowPathCode(slow_path);
2658 2650
2659 Register temp = locs()->temp(0).reg(); 2651 Register temp = locs()->temp(0).reg();
2660 // Generate stack overflow check. 2652 // Generate stack overflow check.
2661 if (compiler->is_optimizing() && FLAG_allow_absolute_addresses) { 2653 __ cmpq(RSP, Address(THR, Thread::stack_limit_offset()));
2662 __ LoadImmediate(
2663 temp, Immediate(Isolate::Current()->stack_limit_address()));
2664 __ cmpq(RSP, Address(temp, 0));
2665 } else {
2666 __ LoadIsolate(temp);
2667 __ cmpq(RSP, Address(temp, Isolate::stack_limit_offset()));
2668 }
2669 __ j(BELOW_EQUAL, slow_path->entry_label()); 2654 __ j(BELOW_EQUAL, slow_path->entry_label());
2670 if (compiler->CanOSRFunction() && in_loop()) { 2655 if (compiler->CanOSRFunction() && in_loop()) {
2671 // In unoptimized code check the usage counter to trigger OSR at loop 2656 // In unoptimized code check the usage counter to trigger OSR at loop
2672 // stack checks. Use progressively higher thresholds for more deeply 2657 // stack checks. Use progressively higher thresholds for more deeply
2673 // nested loops to attempt to hit outer loops with OSR when possible. 2658 // nested loops to attempt to hit outer loops with OSR when possible.
2674 __ LoadObject(temp, compiler->parsed_function().function()); 2659 __ LoadObject(temp, compiler->parsed_function().function());
2675 int32_t threshold = 2660 int32_t threshold =
2676 FLAG_optimization_counter_threshold * (loop_depth() + 1); 2661 FLAG_optimization_counter_threshold * (loop_depth() + 1);
2677 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), 2662 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()),
2678 Immediate(threshold)); 2663 Immediate(threshold));
(...skipping 3843 matching lines...) Expand 10 before | Expand all | Expand 10 after
6522 __ Drop(1); 6507 __ Drop(1);
6523 __ popq(result); 6508 __ popq(result);
6524 } 6509 }
6525 6510
6526 6511
6527 } // namespace dart 6512 } // namespace dart
6528 6513
6529 #undef __ 6514 #undef __
6530 6515
6531 #endif // defined TARGET_ARCH_X64 6516 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698