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

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

Issue 722243002: Indirectly dispatch all backtracking jumps through the same block. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: return on unreachable Created 6 years, 1 month 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.h ('k') | runtime/vm/regexp.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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_allocator.h" 10 #include "vm/flow_graph_allocator.h"
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 2523 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
2524 GetDeoptId(), 2524 GetDeoptId(),
2525 Scanner::kNoSourcePos); 2525 Scanner::kNoSourcePos);
2526 } 2526 }
2527 if (HasParallelMove()) { 2527 if (HasParallelMove()) {
2528 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2528 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2529 } 2529 }
2530 } 2530 }
2531 2531
2532 2532
2533 void IndirectGotoInstr::ComputeOffsetTable(Isolate* isolate) {
2534 if (GetBlock()->offset() < 0) {
2535 // Don't generate a table when contained in an unreachable block.
2536 return;
2537 }
2538 ASSERT(SuccessorCount() == offsets_.Capacity());
2539 offsets_.SetLength(SuccessorCount());
2540 for (intptr_t i = 0; i < SuccessorCount(); i++) {
2541 TargetEntryInstr* target = SuccessorAt(i);
2542 intptr_t offset = target->offset();
2543
2544 // The intermediate block might be compacted, if so, use the indirect entry.
2545 if (offset < 0) {
2546 // Optimizations might have modified the immediate target block, but it
2547 // must end with a goto to the indirect entry. Also, we can't use
2548 // last_instruction because 'target' is compacted/unreachable.
2549 Instruction* last = target->next();
2550 while (last != NULL && !last->IsGoto()) {
2551 last = last->next();
2552 }
2553 ASSERT(last);
2554 IndirectEntryInstr* ientry =
2555 last->AsGoto()->successor()->AsIndirectEntry();
2556 ASSERT(ientry != NULL);
2557 ASSERT(ientry->indirect_id() == i);
2558 offset = ientry->offset();
2559 }
2560
2561 ASSERT(offset > 0);
2562 offset -= Assembler::EntryPointToPcMarkerOffset();
2563 offsets_.SetAt(i, Smi::ZoneHandle(isolate, Smi::New(offset)));
2564 }
2565 }
2566
2567
2533 LocationSummary* IndirectEntryInstr::MakeLocationSummary( 2568 LocationSummary* IndirectEntryInstr::MakeLocationSummary(
2534 Isolate* isolate, bool optimizing) const { 2569 Isolate* isolate, bool optimizing) const {
2535 return JoinEntryInstr::MakeLocationSummary(isolate, optimizing); 2570 return JoinEntryInstr::MakeLocationSummary(isolate, optimizing);
2536 } 2571 }
2537 2572
2538 2573
2539 void IndirectEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2574 void IndirectEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2540 JoinEntryInstr::EmitNativeCode(compiler); 2575 JoinEntryInstr::EmitNativeCode(compiler);
2541 } 2576 }
2542 2577
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 case Token::kTRUNCDIV: return 0; 3413 case Token::kTRUNCDIV: return 0;
3379 case Token::kMOD: return 1; 3414 case Token::kMOD: return 1;
3380 default: UNIMPLEMENTED(); return -1; 3415 default: UNIMPLEMENTED(); return -1;
3381 } 3416 }
3382 } 3417 }
3383 3418
3384 3419
3385 #undef __ 3420 #undef __
3386 3421
3387 } // namespace dart 3422 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/regexp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698