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

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

Issue 23190029: Cleanup of deoptimization environment copying functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
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/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 667
668 void Instruction::InheritDeoptTarget(Instruction* other) { 668 void Instruction::InheritDeoptTarget(Instruction* other) {
669 ASSERT(other->env() != NULL); 669 ASSERT(other->env() != NULL);
670 deopt_id_ = other->deopt_id_; 670 deopt_id_ = other->deopt_id_;
671 other->env()->DeepCopyTo(this); 671 other->env()->DeepCopyTo(this);
672 env()->set_deopt_id(deopt_id_); 672 env()->set_deopt_id(deopt_id_);
673 } 673 }
674 674
675 675
676 void BranchInstr::InheritDeoptTarget(Instruction* other) { 676 void BranchInstr::InheritDeoptTarget(Instruction* other) {
677 ASSERT(env() == NULL);
677 Instruction::InheritDeoptTarget(other); 678 Instruction::InheritDeoptTarget(other);
678 comparison()->SetDeoptId(GetDeoptId()); 679 comparison()->SetDeoptId(GetDeoptId());
679 } 680 }
680 681
681 682
682 void Definition::ReplaceWith(Definition* other, 683 void Definition::ReplaceWith(Definition* other,
683 ForwardInstructionIterator* iterator) { 684 ForwardInstructionIterator* iterator) {
684 // Record other's input uses. 685 // Record other's input uses.
685 for (intptr_t i = other->InputCount() - 1; i >= 0; --i) { 686 for (intptr_t i = other->InputCount() - 1; i >= 0; --i) {
686 Value* input = other->InputAt(i); 687 Value* input = other->InputAt(i);
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 Isolate::kNoDeoptId, 1877 Isolate::kNoDeoptId,
1877 function, 1878 function,
1878 NULL); 1879 NULL);
1879 for (intptr_t i = 0; i < definitions.length(); ++i) { 1880 for (intptr_t i = 0; i < definitions.length(); ++i) {
1880 env->values_.Add(new Value(definitions[i])); 1881 env->values_.Add(new Value(definitions[i]));
1881 } 1882 }
1882 return env; 1883 return env;
1883 } 1884 }
1884 1885
1885 1886
1886 Environment* Environment::DeepCopy() const {
1887 return (this == NULL) ? NULL : DeepCopy(Length());
1888 }
1889
1890
1891 Environment* Environment::DeepCopy(intptr_t length) const { 1887 Environment* Environment::DeepCopy(intptr_t length) const {
1892 ASSERT(length <= values_.length()); 1888 ASSERT(length <= values_.length());
1893 if (this == NULL) return NULL;
1894 Environment* copy = 1889 Environment* copy =
1895 new Environment(length, 1890 new Environment(length,
1896 fixed_parameter_count_, 1891 fixed_parameter_count_,
1897 deopt_id_, 1892 deopt_id_,
1898 function_, 1893 function_,
1899 outer_->DeepCopy()); 1894 (outer_ == NULL) ? NULL : outer_->DeepCopy());
1900 for (intptr_t i = 0; i < length; ++i) { 1895 for (intptr_t i = 0; i < length; ++i) {
1901 copy->values_.Add(values_[i]->Copy()); 1896 copy->values_.Add(values_[i]->Copy());
1902 } 1897 }
1903 return copy; 1898 return copy;
1904 } 1899 }
1905 1900
1906 1901
1907 // Copies the environment and updates the environment use lists. 1902 // Copies the environment and updates the environment use lists.
1908 void Environment::DeepCopyTo(Instruction* instr) const { 1903 void Environment::DeepCopyTo(Instruction* instr) const {
1909 for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) { 1904 for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) {
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 default: 2650 default:
2656 UNREACHABLE(); 2651 UNREACHABLE();
2657 } 2652 }
2658 return kPowRuntimeEntry; 2653 return kPowRuntimeEntry;
2659 } 2654 }
2660 2655
2661 2656
2662 #undef __ 2657 #undef __
2663 2658
2664 } // namespace dart 2659 } // namespace dart
OLDNEW
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698