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

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

Issue 653073002: Fix bug with captured parameters and optimized try-catch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/scopes.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_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/cha.h" 10 #include "vm/cha.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 // Construct a ParallelMove instruction for parameters and locals. Skip the 404 // Construct a ParallelMove instruction for parameters and locals. Skip the
405 // special locals exception_var and stacktrace_var since they will be filled 405 // special locals exception_var and stacktrace_var since they will be filled
406 // when an exception is thrown. Constant locations are known to be the same 406 // when an exception is thrown. Constant locations are known to be the same
407 // at all instructions that may throw, and do not need to be materialized. 407 // at all instructions that may throw, and do not need to be materialized.
408 408
409 // Parameters first. 409 // Parameters first.
410 intptr_t i = 0; 410 intptr_t i = 0;
411 const intptr_t num_non_copied_params = flow_graph().num_non_copied_params(); 411 const intptr_t num_non_copied_params = flow_graph().num_non_copied_params();
412 ParallelMoveInstr* move_instr = new ParallelMoveInstr(); 412 ParallelMoveInstr* move_instr = new ParallelMoveInstr();
413 for (; i < num_non_copied_params; ++i) { 413 for (; i < num_non_copied_params; ++i) {
414 // Don't sync captured parameters. They are not in the environment.
415 if (flow_graph().captured_parameters()->Contains(i)) continue;
414 if ((*idefs)[i]->IsConstant()) continue; // Common constants 416 if ((*idefs)[i]->IsConstant()) continue; // Common constants
415 Location src = env->LocationAt(i); 417 Location src = env->LocationAt(i);
416 intptr_t dest_index = i - num_non_copied_params; 418 intptr_t dest_index = i - num_non_copied_params;
417 Location dest = Location::StackSlot(dest_index); 419 Location dest = Location::StackSlot(dest_index);
418 move_instr->AddMove(dest, src); 420 move_instr->AddMove(dest, src);
419 } 421 }
420 422
421 // Process locals. Skip exception_var and stacktrace_var. 423 // Process locals. Skip exception_var and stacktrace_var.
422 intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params; 424 intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params;
423 intptr_t ex_idx = local_base - catch_block->exception_var().index(); 425 intptr_t ex_idx = local_base - catch_block->exception_var().index();
424 intptr_t st_idx = local_base - catch_block->stacktrace_var().index(); 426 intptr_t st_idx = local_base - catch_block->stacktrace_var().index();
425 for (; i < flow_graph().variable_count(); ++i) { 427 for (; i < flow_graph().variable_count(); ++i) {
428 // Don't sync captured parameters. They are not in the environment.
429 if (flow_graph().captured_parameters()->Contains(i)) continue;
426 if (i == ex_idx || i == st_idx) continue; 430 if (i == ex_idx || i == st_idx) continue;
427 if ((*idefs)[i]->IsConstant()) continue; 431 if ((*idefs)[i]->IsConstant()) continue;
428 Location src = env->LocationAt(i); 432 Location src = env->LocationAt(i);
429 ASSERT(!src.IsFpuRegister()); 433 ASSERT(!src.IsFpuRegister());
430 ASSERT(!src.IsDoubleStackSlot()); 434 ASSERT(!src.IsDoubleStackSlot());
431 intptr_t dest_index = i - num_non_copied_params; 435 intptr_t dest_index = i - num_non_copied_params;
432 Location dest = Location::StackSlot(dest_index); 436 Location dest = Location::StackSlot(dest_index);
433 move_instr->AddMove(dest, src); 437 move_instr->AddMove(dest, src);
434 // Update safepoint bitmap to indicate that the target location 438 // Update safepoint bitmap to indicate that the target location
435 // now contains a pointer. 439 // now contains a pointer.
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 threshold = FLAG_optimization_counter_scale * basic_blocks + 1491 threshold = FLAG_optimization_counter_scale * basic_blocks +
1488 FLAG_min_optimization_counter_threshold; 1492 FLAG_min_optimization_counter_threshold;
1489 if (threshold > FLAG_optimization_counter_threshold) { 1493 if (threshold > FLAG_optimization_counter_threshold) {
1490 threshold = FLAG_optimization_counter_threshold; 1494 threshold = FLAG_optimization_counter_threshold;
1491 } 1495 }
1492 } 1496 }
1493 return threshold; 1497 return threshold;
1494 } 1498 }
1495 1499
1496 } // namespace dart 1500 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698