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

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

Issue 16888013: Revert "Initial implementation of on-stack replacement (OSR)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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/intermediate_language_ia32.cc ('k') | runtime/vm/object.h » ('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" // 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 "lib/error.h" 10 #include "lib/error.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/flow_graph_compiler.h" 12 #include "vm/flow_graph_compiler.h"
13 #include "vm/locations.h" 13 #include "vm/locations.h"
14 #include "vm/object_store.h" 14 #include "vm/object_store.h"
15 #include "vm/parser.h" 15 #include "vm/parser.h"
16 #include "vm/stack_frame.h" 16 #include "vm/stack_frame.h"
17 #include "vm/stub_code.h" 17 #include "vm/stub_code.h"
18 #include "vm/symbols.h" 18 #include "vm/symbols.h"
19 19
20 #define __ compiler->assembler()-> 20 #define __ compiler->assembler()->
21 21
22 namespace dart { 22 namespace dart {
23 23
24 DECLARE_FLAG(int, optimization_counter_threshold); 24 DECLARE_FLAG(int, optimization_counter_threshold);
25 DECLARE_FLAG(bool, propagate_ic_data); 25 DECLARE_FLAG(bool, propagate_ic_data);
26 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 26 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
27 DECLARE_FLAG(bool, use_osr);
28 27
29 // Generic summary for call instructions that have all arguments pushed 28 // Generic summary for call instructions that have all arguments pushed
30 // on the stack and return the result in a fixed register RAX. 29 // on the stack and return the result in a fixed register RAX.
31 LocationSummary* Instruction::MakeCallSummary() { 30 LocationSummary* Instruction::MakeCallSummary() {
32 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); 31 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall);
33 result->set_out(Location::RegisterLocation(RAX)); 32 result->set_out(Location::RegisterLocation(RAX));
34 return result; 33 return result;
35 } 34 }
36 35
37 36
(...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 __ Bind(entry_label()); 2094 __ Bind(entry_label());
2096 compiler->SaveLiveRegisters(instruction_->locs()); 2095 compiler->SaveLiveRegisters(instruction_->locs());
2097 // pending_deoptimization_env_ is needed to generate a runtime call that 2096 // pending_deoptimization_env_ is needed to generate a runtime call that
2098 // may throw an exception. 2097 // may throw an exception.
2099 ASSERT(compiler->pending_deoptimization_env_ == NULL); 2098 ASSERT(compiler->pending_deoptimization_env_ == NULL);
2100 compiler->pending_deoptimization_env_ = instruction_->env(); 2099 compiler->pending_deoptimization_env_ = instruction_->env();
2101 compiler->GenerateCallRuntime(instruction_->token_pos(), 2100 compiler->GenerateCallRuntime(instruction_->token_pos(),
2102 instruction_->deopt_id(), 2101 instruction_->deopt_id(),
2103 kStackOverflowRuntimeEntry, 2102 kStackOverflowRuntimeEntry,
2104 instruction_->locs()); 2103 instruction_->locs());
2105
2106 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
2107 // In unoptimized code, record loop stack checks as possible OSR entries.
2108 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry,
2109 instruction_->deopt_id(),
2110 0); // No token position.
2111 }
2112 compiler->pending_deoptimization_env_ = NULL; 2104 compiler->pending_deoptimization_env_ = NULL;
2113 compiler->RestoreLiveRegisters(instruction_->locs()); 2105 compiler->RestoreLiveRegisters(instruction_->locs());
2114 __ jmp(exit_label()); 2106 __ jmp(exit_label());
2115 } 2107 }
2116 2108
2117 private: 2109 private:
2118 CheckStackOverflowInstr* instruction_; 2110 CheckStackOverflowInstr* instruction_;
2119 }; 2111 };
2120 2112
2121 2113
2122 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2114 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2123 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); 2115 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this);
2124 compiler->AddSlowPathCode(slow_path); 2116 compiler->AddSlowPathCode(slow_path);
2125 2117
2126 Register temp = locs()->temp(0).reg(); 2118 Register temp = locs()->temp(0).reg();
2127 // Generate stack overflow check. 2119 // Generate stack overflow check.
2128 __ movq(temp, Immediate(Isolate::Current()->stack_limit_address())); 2120 __ movq(temp, Immediate(Isolate::Current()->stack_limit_address()));
2129 __ cmpq(RSP, Address(temp, 0)); 2121 __ cmpq(RSP, Address(temp, 0));
2130 __ j(BELOW_EQUAL, slow_path->entry_label()); 2122 __ j(BELOW_EQUAL, slow_path->entry_label());
2131 if (FLAG_use_osr && !compiler->is_optimizing() && in_loop()) {
2132 // In unoptimized code check the usage counter to trigger OSR at loop
2133 // stack checks.
2134 __ LoadObject(temp, compiler->parsed_function().function());
2135 __ cmpq(FieldAddress(temp, Function::usage_counter_offset()),
2136 Immediate(2 * FLAG_optimization_counter_threshold));
2137 __ j(GREATER_EQUAL, slow_path->entry_label());
2138 }
2139 __ Bind(slow_path->exit_label()); 2123 __ Bind(slow_path->exit_label());
2140 } 2124 }
2141 2125
2142 2126
2143 static void Emit53BitOverflowCheck(FlowGraphCompiler* compiler, 2127 static void Emit53BitOverflowCheck(FlowGraphCompiler* compiler,
2144 Label* overflow, 2128 Label* overflow,
2145 Register result) { 2129 Register result) {
2146 if (FLAG_throw_on_javascript_int_overflow) { 2130 if (FLAG_throw_on_javascript_int_overflow) {
2147 ASSERT(overflow != NULL); 2131 ASSERT(overflow != NULL);
2148 __ movq(TMP, result); // result is a tagged Smi. 2132 __ movq(TMP, result); // result is a tagged Smi.
(...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after
4425 PcDescriptors::kOther, 4409 PcDescriptors::kOther,
4426 locs()); 4410 locs());
4427 __ Drop(2); // Discard type arguments and receiver. 4411 __ Drop(2); // Discard type arguments and receiver.
4428 } 4412 }
4429 4413
4430 } // namespace dart 4414 } // namespace dart
4431 4415
4432 #undef __ 4416 #undef __
4433 4417
4434 #endif // defined TARGET_ARCH_X64 4418 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698