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

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

Issue 1390153004: Move deopt_id and related helpers/definitions from Isolate to Thread (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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/constant_propagator.h" 8 #include "vm/constant_propagator.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 } 78 }
79 return defn; 79 return defn;
80 } 80 }
81 81
82 82
83 const ICData* Instruction::GetICData( 83 const ICData* Instruction::GetICData(
84 const ZoneGrowableArray<const ICData*>& ic_data_array) const { 84 const ZoneGrowableArray<const ICData*>& ic_data_array) const {
85 // The deopt_id can be outside the range of the IC data array for 85 // The deopt_id can be outside the range of the IC data array for
86 // computations added in the optimizing compiler. 86 // computations added in the optimizing compiler.
87 ASSERT(deopt_id_ != Isolate::kNoDeoptId); 87 ASSERT(deopt_id_ != Thread::kNoDeoptId);
88 if (deopt_id_ < ic_data_array.length()) { 88 if (deopt_id_ < ic_data_array.length()) {
89 return ic_data_array[deopt_id_]; 89 return ic_data_array[deopt_id_];
90 } 90 }
91 return NULL; 91 return NULL;
92 } 92 }
93 93
94 94
95 intptr_t Instruction::Hashcode() const { 95 intptr_t Instruction::Hashcode() const {
96 intptr_t result = tag(); 96 intptr_t result = tag();
97 for (intptr_t i = 0; i < InputCount(); ++i) { 97 for (intptr_t i = 0; i < InputCount(); ++i) {
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 for (Environment::DeepIterator it(env()); !it.Done(); it.Advance()) { 791 for (Environment::DeepIterator it(env()); !it.Done(); it.Advance()) {
792 it.CurrentValue()->RemoveFromUseList(); 792 it.CurrentValue()->RemoveFromUseList();
793 } 793 }
794 } 794 }
795 795
796 796
797 void Instruction::InheritDeoptTargetAfter(FlowGraph* flow_graph, 797 void Instruction::InheritDeoptTargetAfter(FlowGraph* flow_graph,
798 Definition* call, 798 Definition* call,
799 Definition* result) { 799 Definition* result) {
800 ASSERT(call->env() != NULL); 800 ASSERT(call->env() != NULL);
801 deopt_id_ = Isolate::ToDeoptAfter(call->deopt_id_); 801 deopt_id_ = Thread::ToDeoptAfter(call->deopt_id_);
802 call->env()->DeepCopyAfterTo(flow_graph->zone(), 802 call->env()->DeepCopyAfterTo(flow_graph->zone(),
803 this, 803 this,
804 call->ArgumentCount(), 804 call->ArgumentCount(),
805 flow_graph->constant_dead(), 805 flow_graph->constant_dead(),
806 result != NULL ? result 806 result != NULL ? result
807 : flow_graph->constant_dead()); 807 : flow_graph->constant_dead());
808 env()->set_deopt_id(deopt_id_); 808 env()->set_deopt_id(deopt_id_);
809 } 809 }
810 810
811 811
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 BoxIntegerInstr* box_defn = value()->definition()->AsBoxInteger(); 2195 BoxIntegerInstr* box_defn = value()->definition()->AsBoxInteger();
2196 if (box_defn != NULL) { 2196 if (box_defn != NULL) {
2197 if (box_defn->value()->definition()->representation() == representation()) { 2197 if (box_defn->value()->definition()->representation() == representation()) {
2198 return box_defn->value()->definition(); 2198 return box_defn->value()->definition();
2199 } else { 2199 } else {
2200 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( 2200 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr(
2201 box_defn->value()->definition()->representation(), 2201 box_defn->value()->definition()->representation(),
2202 representation(), 2202 representation(),
2203 box_defn->value()->CopyWithType(), 2203 box_defn->value()->CopyWithType(),
2204 (representation() == kUnboxedInt32) ? 2204 (representation() == kUnboxedInt32) ?
2205 GetDeoptId() : Isolate::kNoDeoptId); 2205 GetDeoptId() : Thread::kNoDeoptId);
2206 // TODO(vegorov): marking resulting converter as truncating when 2206 // TODO(vegorov): marking resulting converter as truncating when
2207 // unboxing can't deoptimize is a workaround for the missing 2207 // unboxing can't deoptimize is a workaround for the missing
2208 // deoptimization environment when we insert converter after 2208 // deoptimization environment when we insert converter after
2209 // EliminateEnvironments and there is a mismatch between predicates 2209 // EliminateEnvironments and there is a mismatch between predicates
2210 // UnboxIntConverterInstr::CanDeoptimize and UnboxInt32::CanDeoptimize. 2210 // UnboxIntConverterInstr::CanDeoptimize and UnboxInt32::CanDeoptimize.
2211 if ((representation() == kUnboxedInt32) && 2211 if ((representation() == kUnboxedInt32) &&
2212 (is_truncating() || !CanDeoptimize())) { 2212 (is_truncating() || !CanDeoptimize())) {
2213 converter->mark_truncating(); 2213 converter->mark_truncating();
2214 } 2214 }
2215 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); 2215 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 value()->definition()->AsUnboxedIntConverter(); 2258 value()->definition()->AsUnboxedIntConverter();
2259 if ((box_defn != NULL) && (box_defn->representation() == from())) { 2259 if ((box_defn != NULL) && (box_defn->representation() == from())) {
2260 if (box_defn->from() == to()) { 2260 if (box_defn->from() == to()) {
2261 return box_defn->value()->definition(); 2261 return box_defn->value()->definition();
2262 } 2262 }
2263 2263
2264 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( 2264 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr(
2265 box_defn->from(), 2265 box_defn->from(),
2266 representation(), 2266 representation(),
2267 box_defn->value()->CopyWithType(), 2267 box_defn->value()->CopyWithType(),
2268 (to() == kUnboxedInt32) ? GetDeoptId() : Isolate::kNoDeoptId); 2268 (to() == kUnboxedInt32) ? GetDeoptId() : Thread::kNoDeoptId);
2269 if ((representation() == kUnboxedInt32) && is_truncating()) { 2269 if ((representation() == kUnboxedInt32) && is_truncating()) {
2270 converter->mark_truncating(); 2270 converter->mark_truncating();
2271 } 2271 }
2272 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); 2272 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue);
2273 return converter; 2273 return converter;
2274 } 2274 }
2275 2275
2276 UnboxInt64Instr* unbox_defn = value()->definition()->AsUnboxInt64(); 2276 UnboxInt64Instr* unbox_defn = value()->definition()->AsUnboxInt64();
2277 if (unbox_defn != NULL && 2277 if (unbox_defn != NULL &&
2278 (from() == kUnboxedMint) && 2278 (from() == kUnboxedMint) &&
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 2937
2938 StrictCompareInstr::StrictCompareInstr(intptr_t token_pos, 2938 StrictCompareInstr::StrictCompareInstr(intptr_t token_pos,
2939 Token::Kind kind, 2939 Token::Kind kind,
2940 Value* left, 2940 Value* left,
2941 Value* right, 2941 Value* right,
2942 bool needs_number_check) 2942 bool needs_number_check)
2943 : ComparisonInstr(token_pos, 2943 : ComparisonInstr(token_pos,
2944 kind, 2944 kind,
2945 left, 2945 left,
2946 right, 2946 right,
2947 Isolate::Current()->GetNextDeoptId()), 2947 Thread::Current()->GetNextDeoptId()),
2948 needs_number_check_(needs_number_check) { 2948 needs_number_check_(needs_number_check) {
2949 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); 2949 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT));
2950 } 2950 }
2951 2951
2952 2952
2953 LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone, 2953 LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone,
2954 bool optimizing) const { 2954 bool optimizing) const {
2955 return MakeCallSummary(zone); 2955 return MakeCallSummary(zone);
2956 } 2956 }
2957 2957
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 } 3165 }
3166 3166
3167 3167
3168 Environment* Environment::From(Zone* zone, 3168 Environment* Environment::From(Zone* zone,
3169 const GrowableArray<Definition*>& definitions, 3169 const GrowableArray<Definition*>& definitions,
3170 intptr_t fixed_parameter_count, 3170 intptr_t fixed_parameter_count,
3171 const ParsedFunction& parsed_function) { 3171 const ParsedFunction& parsed_function) {
3172 Environment* env = 3172 Environment* env =
3173 new(zone) Environment(definitions.length(), 3173 new(zone) Environment(definitions.length(),
3174 fixed_parameter_count, 3174 fixed_parameter_count,
3175 Isolate::kNoDeoptId, 3175 Thread::kNoDeoptId,
3176 parsed_function, 3176 parsed_function,
3177 NULL); 3177 NULL);
3178 for (intptr_t i = 0; i < definitions.length(); ++i) { 3178 for (intptr_t i = 0; i < definitions.length(); ++i) {
3179 env->values_.Add(new(zone) Value(definitions[i])); 3179 env->values_.Add(new(zone) Value(definitions[i]));
3180 } 3180 }
3181 return env; 3181 return env;
3182 } 3182 }
3183 3183
3184 3184
3185 Environment* Environment::DeepCopy(Zone* zone, intptr_t length) const { 3185 Environment* Environment::DeepCopy(Zone* zone, intptr_t length) const {
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
3646 case Token::kTRUNCDIV: return 0; 3646 case Token::kTRUNCDIV: return 0;
3647 case Token::kMOD: return 1; 3647 case Token::kMOD: return 1;
3648 default: UNIMPLEMENTED(); return -1; 3648 default: UNIMPLEMENTED(); return -1;
3649 } 3649 }
3650 } 3650 }
3651 3651
3652 3652
3653 #undef __ 3653 #undef __
3654 3654
3655 } // namespace dart 3655 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698