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

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

Issue 10806047: Fix crash during parallel moves. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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/il_printer.cc ('k') | runtime/vm/locations.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 Value* left_; 2372 Value* left_;
2373 Value* right_; 2373 Value* right_;
2374 Token::Kind kind_; 2374 Token::Kind kind_;
2375 TargetEntryInstr* true_successor_; 2375 TargetEntryInstr* true_successor_;
2376 TargetEntryInstr* false_successor_; 2376 TargetEntryInstr* false_successor_;
2377 2377
2378 DISALLOW_COPY_AND_ASSIGN(BranchInstr); 2378 DISALLOW_COPY_AND_ASSIGN(BranchInstr);
2379 }; 2379 };
2380 2380
2381 2381
2382 // This class is often passed by value. Add additional fields with caution. 2382 class MoveOperands : public ZoneAllocated {
2383 class MoveOperands : public ValueObject {
2384 public: 2383 public:
2385 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { } 2384 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { }
2386 2385
2387 Location src() const { return src_; } 2386 Location src() const { return src_; }
2388 Location dest() const { return dest_; } 2387 Location dest() const { return dest_; }
2389 2388
2390 Location* src_slot() { return &src_; } 2389 Location* src_slot() { return &src_; }
2391 Location* dest_slot() { return &dest_; } 2390 Location* dest_slot() { return &dest_; }
2392 2391
2393 void set_src(Location src) { src_ = src; } 2392 void set_src(const Location& value) { src_ = value; }
2393 void set_dest(const Location& value) { dest_ = value; }
2394 2394
2395 // The parallel move resolver marks moves as "in-progress" by clearing the 2395 // The parallel move resolver marks moves as "in-progress" by clearing the
2396 // destination (but not the source). 2396 // destination (but not the source).
2397 Location MarkPending() { 2397 Location MarkPending() {
2398 ASSERT(!IsPending()); 2398 ASSERT(!IsPending());
2399 Location dest = dest_; 2399 Location dest = dest_;
2400 dest_ = Location::NoLocation(); 2400 dest_ = Location::NoLocation();
2401 return dest; 2401 return dest;
2402 } 2402 }
2403 2403
(...skipping 21 matching lines...) Expand all
2425 // We clear both operands to indicate move that's been eliminated. 2425 // We clear both operands to indicate move that's been eliminated.
2426 void Eliminate() { src_ = dest_ = Location::NoLocation(); } 2426 void Eliminate() { src_ = dest_ = Location::NoLocation(); }
2427 bool IsEliminated() const { 2427 bool IsEliminated() const {
2428 ASSERT(!src_.IsInvalid() || dest_.IsInvalid()); 2428 ASSERT(!src_.IsInvalid() || dest_.IsInvalid());
2429 return src_.IsInvalid(); 2429 return src_.IsInvalid();
2430 } 2430 }
2431 2431
2432 private: 2432 private:
2433 Location dest_; 2433 Location dest_;
2434 Location src_; 2434 Location src_;
2435
2436 DISALLOW_COPY_AND_ASSIGN(MoveOperands);
2435 }; 2437 };
2436 2438
2437 2439
2438 class ParallelMoveInstr : public Instruction { 2440 class ParallelMoveInstr : public Instruction {
2439 public: 2441 public:
2440 explicit ParallelMoveInstr() : moves_(4) { 2442 explicit ParallelMoveInstr() : moves_(4) {
2441 } 2443 }
2442 2444
2443 DECLARE_INSTRUCTION(ParallelMove) 2445 DECLARE_INSTRUCTION(ParallelMove)
2444 2446
2445 void AddMove(Location dest, Location src) { 2447 void AddMove(Location dest, Location src) {
2446 moves_.Add(MoveOperands(dest, src)); 2448 moves_.Add(new MoveOperands(dest, src));
2447 } 2449 }
2448 2450
2449 const GrowableArray<MoveOperands>& moves() { return moves_; } 2451 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; }
2452
2453 void SetSrcSlotAt(intptr_t index, const Location& loc);
2454 void SetDestSlotAt(intptr_t index, const Location& loc);
2455
2456 intptr_t NumMoves() const { return moves_.length(); }
2450 2457
2451 private: 2458 private:
2452 GrowableArray<MoveOperands> moves_; 2459 GrowableArray<MoveOperands*> moves_; // Elements cannot be null.
2453 2460
2454 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); 2461 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr);
2455 }; 2462 };
2456 2463
2457 #undef DECLARE_INSTRUCTION 2464 #undef DECLARE_INSTRUCTION
2458 2465
2459 2466
2460 class Environment : public ZoneAllocated { 2467 class Environment : public ZoneAllocated {
2461 public: 2468 public:
2462 // Construct an environment by copying from an array of values. 2469 // Construct an environment by copying from an array of values.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 const GrowableArray<BlockEntryInstr*>& block_order_; 2526 const GrowableArray<BlockEntryInstr*>& block_order_;
2520 2527
2521 private: 2528 private:
2522 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2529 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2523 }; 2530 };
2524 2531
2525 2532
2526 } // namespace dart 2533 } // namespace dart
2527 2534
2528 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2535 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/locations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698