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

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

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