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

Side by Side Diff: runtime/vm/intermediate_language_mips.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_ia32.cc ('k') | runtime/vm/intermediate_language_x64.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" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 return summary; 2305 return summary;
2306 } 2306 }
2307 2307
2308 2308
2309 class CheckStackOverflowSlowPath : public SlowPathCode { 2309 class CheckStackOverflowSlowPath : public SlowPathCode {
2310 public: 2310 public:
2311 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) 2311 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction)
2312 : instruction_(instruction) { } 2312 : instruction_(instruction) { }
2313 2313
2314 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2314 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2315 if (FLAG_use_osr) {
2316 uword flags_address = Isolate::Current()->stack_overflow_flags_address();
2317 Register value = instruction_->locs()->temp(0).reg();
2318 __ TraceSimMsg("CheckStackOverflowSlowPathOsr");
2319 __ Comment("CheckStackOverflowSlowPathOsr");
2320 __ Bind(osr_entry_label());
2321 __ LoadImmediate(TMP, flags_address);
2322 __ LoadImmediate(value, Isolate::kOsrRequest);
2323 __ sw(value, Address(TMP));
2324 }
2315 __ TraceSimMsg("CheckStackOverflowSlowPath"); 2325 __ TraceSimMsg("CheckStackOverflowSlowPath");
2316 __ Comment("CheckStackOverflowSlowPath"); 2326 __ Comment("CheckStackOverflowSlowPath");
2317 __ Bind(entry_label()); 2327 __ Bind(entry_label());
2318 compiler->SaveLiveRegisters(instruction_->locs()); 2328 compiler->SaveLiveRegisters(instruction_->locs());
2319 // pending_deoptimization_env_ is needed to generate a runtime call that 2329 // pending_deoptimization_env_ is needed to generate a runtime call that
2320 // may throw an exception. 2330 // may throw an exception.
2321 ASSERT(compiler->pending_deoptimization_env_ == NULL); 2331 ASSERT(compiler->pending_deoptimization_env_ == NULL);
2322 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); 2332 Environment* env = compiler->SlowPathEnvironmentFor(instruction_);
2323 compiler->pending_deoptimization_env_ = env; 2333 compiler->pending_deoptimization_env_ = env;
2324 compiler->GenerateRuntimeCall(instruction_->token_pos(), 2334 compiler->GenerateRuntimeCall(instruction_->token_pos(),
2325 instruction_->deopt_id(), 2335 instruction_->deopt_id(),
2326 kStackOverflowRuntimeEntry, 2336 kStackOverflowRuntimeEntry,
2327 0, 2337 0,
2328 instruction_->locs()); 2338 instruction_->locs());
2329 2339
2330 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { 2340 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
2331 // In unoptimized code, record loop stack checks as possible OSR entries. 2341 // In unoptimized code, record loop stack checks as possible OSR entries.
2332 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, 2342 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry,
2333 instruction_->deopt_id(), 2343 instruction_->deopt_id(),
2334 0); // No token position. 2344 0); // No token position.
2335 } 2345 }
2336 compiler->pending_deoptimization_env_ = NULL; 2346 compiler->pending_deoptimization_env_ = NULL;
2337 compiler->RestoreLiveRegisters(instruction_->locs()); 2347 compiler->RestoreLiveRegisters(instruction_->locs());
2338 __ b(exit_label()); 2348 __ b(exit_label());
2339 } 2349 }
2340 2350
2351 Label* osr_entry_label() {
2352 ASSERT(FLAG_use_osr);
2353 return &osr_entry_label_;
2354 }
2355
2341 private: 2356 private:
2342 CheckStackOverflowInstr* instruction_; 2357 CheckStackOverflowInstr* instruction_;
2358 Label osr_entry_label_;
2343 }; 2359 };
2344 2360
2345 2361
2346 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2362 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2347 __ TraceSimMsg("CheckStackOverflowInstr"); 2363 __ TraceSimMsg("CheckStackOverflowInstr");
2348 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); 2364 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this);
2349 compiler->AddSlowPathCode(slow_path); 2365 compiler->AddSlowPathCode(slow_path);
2350 2366
2351 __ LoadImmediate(TMP, Isolate::Current()->stack_limit_address()); 2367 __ LoadImmediate(TMP, Isolate::Current()->stack_limit_address());
2352
2353 __ lw(CMPRES1, Address(TMP)); 2368 __ lw(CMPRES1, Address(TMP));
2354 __ BranchUnsignedLessEqual(SP, CMPRES1, slow_path->entry_label()); 2369 __ BranchUnsignedLessEqual(SP, CMPRES1, slow_path->entry_label());
2355 if (compiler->CanOSRFunction() && in_loop()) { 2370 if (compiler->CanOSRFunction() && in_loop()) {
2356 Register temp = locs()->temp(0).reg(); 2371 Register temp = locs()->temp(0).reg();
2357 // In unoptimized code check the usage counter to trigger OSR at loop 2372 // In unoptimized code check the usage counter to trigger OSR at loop
2358 // stack checks. Use progressively higher thresholds for more deeply 2373 // stack checks. Use progressively higher thresholds for more deeply
2359 // nested loops to attempt to hit outer loops with OSR when possible. 2374 // nested loops to attempt to hit outer loops with OSR when possible.
2360 __ LoadObject(temp, compiler->parsed_function().function()); 2375 __ LoadObject(temp, compiler->parsed_function().function());
2361 intptr_t threshold = 2376 intptr_t threshold =
2362 FLAG_optimization_counter_threshold * (loop_depth() + 1); 2377 FLAG_optimization_counter_threshold * (loop_depth() + 1);
2363 __ lw(temp, FieldAddress(temp, Function::usage_counter_offset())); 2378 __ lw(temp, FieldAddress(temp, Function::usage_counter_offset()));
2364 __ BranchSignedGreaterEqual(temp, threshold, slow_path->entry_label()); 2379 __ BranchSignedGreaterEqual(temp, threshold, slow_path->osr_entry_label());
2380 }
2381 if (compiler->ForceSlowPathForStackOverflow()) {
2382 __ b(slow_path->entry_label());
2365 } 2383 }
2366 __ Bind(slow_path->exit_label()); 2384 __ Bind(slow_path->exit_label());
2367 } 2385 }
2368 2386
2369 2387
2370 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, 2388 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
2371 BinarySmiOpInstr* shift_left) { 2389 BinarySmiOpInstr* shift_left) {
2372 const bool is_truncating = shift_left->is_truncating(); 2390 const bool is_truncating = shift_left->is_truncating();
2373 const LocationSummary& locs = *shift_left->locs(); 2391 const LocationSummary& locs = *shift_left->locs();
2374 Register left = locs.in(0).reg(); 2392 Register left = locs.in(0).reg();
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
4311 compiler->GenerateCall(token_pos(), 4329 compiler->GenerateCall(token_pos(),
4312 &label, 4330 &label,
4313 PcDescriptors::kOther, 4331 PcDescriptors::kOther,
4314 locs()); 4332 locs());
4315 __ Drop(ArgumentCount()); // Discard arguments. 4333 __ Drop(ArgumentCount()); // Discard arguments.
4316 } 4334 }
4317 4335
4318 } // namespace dart 4336 } // namespace dart
4319 4337
4320 #endif // defined TARGET_ARCH_MIPS 4338 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698