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

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

Issue 226543007: Implement new stacktrace and deoptimization stress testing flags: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 3rd times a charm Created 6 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/intermediate_language_mips.cc ('k') | runtime/vm/isolate.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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 return summary; 2310 return summary;
2311 } 2311 }
2312 2312
2313 2313
2314 class CheckStackOverflowSlowPath : public SlowPathCode { 2314 class CheckStackOverflowSlowPath : public SlowPathCode {
2315 public: 2315 public:
2316 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) 2316 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction)
2317 : instruction_(instruction) { } 2317 : instruction_(instruction) { }
2318 2318
2319 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2319 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2320 if (FLAG_use_osr) {
2321 uword flags_address = Isolate::Current()->stack_overflow_flags_address();
2322 Register temp = instruction_->locs()->temp(0).reg();
2323 __ Comment("CheckStackOverflowSlowPathOsr");
2324 __ Bind(osr_entry_label());
2325 __ LoadImmediate(temp, Immediate(flags_address), PP);
2326 __ movq(Address(temp, 0), Immediate(Isolate::kOsrRequest));
2327 }
2320 __ Comment("CheckStackOverflowSlowPath"); 2328 __ Comment("CheckStackOverflowSlowPath");
2321 __ Bind(entry_label()); 2329 __ Bind(entry_label());
2322 compiler->SaveLiveRegisters(instruction_->locs()); 2330 compiler->SaveLiveRegisters(instruction_->locs());
2323 // pending_deoptimization_env_ is needed to generate a runtime call that 2331 // pending_deoptimization_env_ is needed to generate a runtime call that
2324 // may throw an exception. 2332 // may throw an exception.
2325 ASSERT(compiler->pending_deoptimization_env_ == NULL); 2333 ASSERT(compiler->pending_deoptimization_env_ == NULL);
2326 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); 2334 Environment* env = compiler->SlowPathEnvironmentFor(instruction_);
2327 compiler->pending_deoptimization_env_ = env; 2335 compiler->pending_deoptimization_env_ = env;
2328 compiler->GenerateRuntimeCall(instruction_->token_pos(), 2336 compiler->GenerateRuntimeCall(instruction_->token_pos(),
2329 instruction_->deopt_id(), 2337 instruction_->deopt_id(),
2330 kStackOverflowRuntimeEntry, 2338 kStackOverflowRuntimeEntry,
2331 0, 2339 0,
2332 instruction_->locs()); 2340 instruction_->locs());
2333 2341
2334 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { 2342 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
2335 // In unoptimized code, record loop stack checks as possible OSR entries. 2343 // In unoptimized code, record loop stack checks as possible OSR entries.
2336 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, 2344 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry,
2337 instruction_->deopt_id(), 2345 instruction_->deopt_id(),
2338 0); // No token position. 2346 0); // No token position.
2339 } 2347 }
2340 compiler->pending_deoptimization_env_ = NULL; 2348 compiler->pending_deoptimization_env_ = NULL;
2341 compiler->RestoreLiveRegisters(instruction_->locs()); 2349 compiler->RestoreLiveRegisters(instruction_->locs());
2342 __ jmp(exit_label()); 2350 __ jmp(exit_label());
2343 } 2351 }
2344 2352
2353
2354 Label* osr_entry_label() {
2355 ASSERT(FLAG_use_osr);
2356 return &osr_entry_label_;
2357 }
2358
2345 private: 2359 private:
2346 CheckStackOverflowInstr* instruction_; 2360 CheckStackOverflowInstr* instruction_;
2361 Label osr_entry_label_;
2347 }; 2362 };
2348 2363
2349 2364
2350 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2365 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2351 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); 2366 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this);
2352 compiler->AddSlowPathCode(slow_path); 2367 compiler->AddSlowPathCode(slow_path);
2353 2368
2354 Register temp = locs()->temp(0).reg(); 2369 Register temp = locs()->temp(0).reg();
2355 // Generate stack overflow check. 2370 // Generate stack overflow check.
2356 __ LoadImmediate( 2371 __ LoadImmediate(
2357 temp, Immediate(Isolate::Current()->stack_limit_address()), PP); 2372 temp, Immediate(Isolate::Current()->stack_limit_address()), PP);
2358 __ cmpq(RSP, Address(temp, 0)); 2373 __ cmpq(RSP, Address(temp, 0));
2359 __ j(BELOW_EQUAL, slow_path->entry_label()); 2374 __ j(BELOW_EQUAL, slow_path->entry_label());
2360 if (compiler->CanOSRFunction() && in_loop()) { 2375 if (compiler->CanOSRFunction() && in_loop()) {
2361 // In unoptimized code check the usage counter to trigger OSR at loop 2376 // In unoptimized code check the usage counter to trigger OSR at loop
2362 // stack checks. Use progressively higher thresholds for more deeply 2377 // stack checks. Use progressively higher thresholds for more deeply
2363 // nested loops to attempt to hit outer loops with OSR when possible. 2378 // nested loops to attempt to hit outer loops with OSR when possible.
2364 __ LoadObject(temp, compiler->parsed_function().function(), PP); 2379 __ LoadObject(temp, compiler->parsed_function().function(), PP);
2365 intptr_t threshold = 2380 intptr_t threshold =
2366 FLAG_optimization_counter_threshold * (loop_depth() + 1); 2381 FLAG_optimization_counter_threshold * (loop_depth() + 1);
2367 __ CompareImmediate(FieldAddress(temp, Function::usage_counter_offset()), 2382 __ CompareImmediate(FieldAddress(temp, Function::usage_counter_offset()),
2368 Immediate(threshold), PP); 2383 Immediate(threshold), PP);
2369 __ j(GREATER_EQUAL, slow_path->entry_label()); 2384 __ j(GREATER_EQUAL, slow_path->osr_entry_label());
2385 }
2386 if (compiler->ForceSlowPathForStackOverflow()) {
2387 __ jmp(slow_path->entry_label());
2370 } 2388 }
2371 __ Bind(slow_path->exit_label()); 2389 __ Bind(slow_path->exit_label());
2372 } 2390 }
2373 2391
2374 2392
2375 static void EmitJavascriptOverflowCheck(FlowGraphCompiler* compiler, 2393 static void EmitJavascriptOverflowCheck(FlowGraphCompiler* compiler,
2376 Range* range, 2394 Range* range,
2377 Label* overflow, 2395 Label* overflow,
2378 Register result) { 2396 Register result) {
2379 if (!range->IsWithin(-0x20000000000000LL, 0x20000000000000LL)) { 2397 if (!range->IsWithin(-0x20000000000000LL, 0x20000000000000LL)) {
(...skipping 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after
5429 PcDescriptors::kOther, 5447 PcDescriptors::kOther,
5430 locs()); 5448 locs());
5431 __ Drop(ArgumentCount()); // Discard arguments. 5449 __ Drop(ArgumentCount()); // Discard arguments.
5432 } 5450 }
5433 5451
5434 } // namespace dart 5452 } // namespace dart
5435 5453
5436 #undef __ 5454 #undef __
5437 5455
5438 #endif // defined TARGET_ARCH_X64 5456 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698