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

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

Issue 10952002: Reapply "Deoptimization support in inlined code." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/intermediate_language.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) 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 3476 matching lines...) Expand 10 before | Expand all | Expand 10 after
3487 ASSERT(environment_->values_[index_] != NULL); 3487 ASSERT(environment_->values_[index_] != NULL);
3488 return environment_->values_[index_]; 3488 return environment_->values_[index_];
3489 } 3489 }
3490 3490
3491 void SetCurrentValue(Value* value) { 3491 void SetCurrentValue(Value* value) {
3492 ASSERT(!Done()); 3492 ASSERT(!Done());
3493 ASSERT(value != NULL); 3493 ASSERT(value != NULL);
3494 environment_->values_[index_] = value; 3494 environment_->values_[index_] = value;
3495 } 3495 }
3496 3496
3497 Location CurrentLocation() const {
3498 ASSERT(!Done());
3499 return environment_->locations_[index_];
3500 }
3501
3502 void SetCurrentLocation(Location loc) {
3503 ASSERT(!Done());
3504 environment_->locations_[index_] = loc;
3505 }
3506
3497 private: 3507 private:
3498 Environment* environment_; 3508 Environment* environment_;
3499 intptr_t index_; 3509 intptr_t index_;
3500 }; 3510 };
3501 3511
3502 // Iterate all non-NULL values in an environment, including outer 3512 // Iterate all non-NULL values in an environment, including outer
3503 // environments. Note that the iterator skips empty environments. 3513 // environments. Note that the iterator skips empty environments.
3504 class DeepIterator : public ValueObject { 3514 class DeepIterator : public ValueObject {
3505 public: 3515 public:
3506 explicit DeepIterator(Environment* environment) : iterator_(environment) { 3516 explicit DeepIterator(Environment* environment) : iterator_(environment) {
(...skipping 11 matching lines...) Expand all
3518 Value* CurrentValue() const { 3528 Value* CurrentValue() const {
3519 ASSERT(!Done()); 3529 ASSERT(!Done());
3520 return iterator_.CurrentValue(); 3530 return iterator_.CurrentValue();
3521 } 3531 }
3522 3532
3523 void SetCurrentValue(Value* value) { 3533 void SetCurrentValue(Value* value) {
3524 ASSERT(!Done()); 3534 ASSERT(!Done());
3525 iterator_.SetCurrentValue(value); 3535 iterator_.SetCurrentValue(value);
3526 } 3536 }
3527 3537
3538 Location CurrentLocation() const {
3539 ASSERT(!Done());
3540 return iterator_.CurrentLocation();
3541 }
3542
3543 void SetCurrentLocation(Location loc) {
3544 ASSERT(!Done());
3545 iterator_.SetCurrentLocation(loc);
3546 }
3547
3528 private: 3548 private:
3529 void SkipDone() { 3549 void SkipDone() {
3530 while (!Done() && iterator_.Done()) { 3550 while (!Done() && iterator_.Done()) {
3531 iterator_ = ShallowIterator(iterator_.environment()->outer()); 3551 iterator_ = ShallowIterator(iterator_.environment()->outer());
3532 } 3552 }
3533 } 3553 }
3534 3554
3535 ShallowIterator iterator_; 3555 ShallowIterator iterator_;
3536 }; 3556 };
3537 3557
3538 // Construct an environment by constructing uses from an array of definitions. 3558 // Construct an environment by constructing uses from an array of definitions.
3539 static Environment* From(const GrowableArray<Definition*>& definitions, 3559 static Environment* From(const GrowableArray<Definition*>& definitions,
3540 intptr_t fixed_parameter_count, 3560 intptr_t fixed_parameter_count,
3541 const Environment* outer); 3561 const Function& function);
3542 3562
3543 void set_locations(Location* locations) { 3563 void set_locations(Location* locations) {
3544 ASSERT(locations_ == NULL); 3564 ASSERT(locations_ == NULL);
3545 locations_ = locations; 3565 locations_ = locations;
3546 } 3566 }
3547 3567
3548 void set_deopt_id(intptr_t deopt_id) { deopt_id_ = deopt_id; } 3568 void set_deopt_id(intptr_t deopt_id) { deopt_id_ = deopt_id; }
3549 intptr_t deopt_id() const { return deopt_id_; } 3569 intptr_t deopt_id() const { return deopt_id_; }
3550 3570
3551 Environment* outer() const { return outer_; } 3571 Environment* outer() const { return outer_; }
(...skipping 24 matching lines...) Expand all
3576 index -= env->Length(); 3596 index -= env->Length();
3577 env = env->outer_; 3597 env = env->outer_;
3578 } 3598 }
3579 return env->ValueAt(index); 3599 return env->ValueAt(index);
3580 } 3600 }
3581 3601
3582 intptr_t fixed_parameter_count() const { 3602 intptr_t fixed_parameter_count() const {
3583 return fixed_parameter_count_; 3603 return fixed_parameter_count_;
3584 } 3604 }
3585 3605
3606 const Function& function() const { return function_; }
3607
3586 void DeepCopyTo(Instruction* instr) const; 3608 void DeepCopyTo(Instruction* instr) const;
3609 void DeepCopyToOuter(Instruction* instr) const;
3587 3610
3588 void PrintTo(BufferFormatter* f) const; 3611 void PrintTo(BufferFormatter* f) const;
3589 3612
3590 private: 3613 private:
3591 friend class ShallowIterator; 3614 friend class ShallowIterator;
3592 3615
3593 Environment(intptr_t length, 3616 Environment(intptr_t length,
3594 intptr_t fixed_parameter_count, 3617 intptr_t fixed_parameter_count,
3595 intptr_t deopt_id, 3618 intptr_t deopt_id,
3619 const Function& function,
3596 Environment* outer) 3620 Environment* outer)
3597 : values_(length), 3621 : values_(length),
3598 locations_(NULL), 3622 locations_(NULL),
3599 fixed_parameter_count_(fixed_parameter_count), 3623 fixed_parameter_count_(fixed_parameter_count),
3600 deopt_id_(deopt_id), 3624 deopt_id_(deopt_id),
3625 function_(function),
3601 outer_(outer) { } 3626 outer_(outer) { }
3602 3627
3603 Environment* DeepCopy() const; 3628 Environment* DeepCopy() const;
3604 3629
3605 GrowableArray<Value*> values_; 3630 GrowableArray<Value*> values_;
3606 Location* locations_; 3631 Location* locations_;
3607 const intptr_t fixed_parameter_count_; 3632 const intptr_t fixed_parameter_count_;
3608 intptr_t deopt_id_; 3633 intptr_t deopt_id_;
3634 const Function& function_;
3609 Environment* outer_; 3635 Environment* outer_;
3610 3636
3611 DISALLOW_COPY_AND_ASSIGN(Environment); 3637 DISALLOW_COPY_AND_ASSIGN(Environment);
3612 }; 3638 };
3613 3639
3614 3640
3615 // Visitor base class to visit each instruction and computation in a flow 3641 // Visitor base class to visit each instruction and computation in a flow
3616 // graph as defined by a reversed list of basic blocks. 3642 // graph as defined by a reversed list of basic blocks.
3617 class FlowGraphVisitor : public ValueObject { 3643 class FlowGraphVisitor : public ValueObject {
3618 public: 3644 public:
(...skipping 23 matching lines...) Expand all
3642 ForwardInstructionIterator* current_iterator_; 3668 ForwardInstructionIterator* current_iterator_;
3643 3669
3644 private: 3670 private:
3645 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 3671 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
3646 }; 3672 };
3647 3673
3648 3674
3649 } // namespace dart 3675 } // namespace dart
3650 3676
3651 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 3677 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698