OLD | NEW |
---|---|
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/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
798 input->definition()->AddInputUse(input); | 798 input->definition()->AddInputUse(input); |
799 } | 799 } |
800 // Take other's environment from this definition. | 800 // Take other's environment from this definition. |
801 ASSERT(other->env() == NULL); | 801 ASSERT(other->env() == NULL); |
802 other->SetEnvironment(env()); | 802 other->SetEnvironment(env()); |
803 env_ = NULL; | 803 env_ = NULL; |
804 // Replace all uses of this definition with other. | 804 // Replace all uses of this definition with other. |
805 ReplaceUsesWith(other); | 805 ReplaceUsesWith(other); |
806 // Reuse this instruction's SSA name for other. | 806 // Reuse this instruction's SSA name for other. |
807 ASSERT(!other->HasSSATemp()); | 807 ASSERT(!other->HasSSATemp()); |
808 if (HasSSATemp()) other->set_ssa_temp_index(ssa_temp_index()); | 808 if (HasSSATemp()) { |
809 other->set_ssa_temp_index(ssa_temp_index()); | |
810 if (RequiresPairSSAIndex()) { | |
811 ASSERT(other->RequiresPairSSAIndex()); | |
812 other->set_pair_ssa_index(pair_ssa_index()); | |
813 } | |
814 } | |
809 | 815 |
810 // Finally insert the other definition in place of this one in the graph. | 816 // Finally insert the other definition in place of this one in the graph. |
811 previous()->LinkTo(other); | 817 previous()->LinkTo(other); |
812 if ((iterator != NULL) && (this == iterator->Current())) { | 818 if ((iterator != NULL) && (this == iterator->Current())) { |
813 // Remove through the iterator. | 819 // Remove through the iterator. |
814 other->LinkTo(this); | 820 other->LinkTo(this); |
815 iterator->RemoveCurrentFromGraph(); | 821 iterator->RemoveCurrentFromGraph(); |
816 } else { | 822 } else { |
817 other->LinkTo(next()); | 823 other->LinkTo(next()); |
818 // Remove this definition's input uses. | 824 // Remove this definition's input uses. |
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3206 return kSinRuntimeEntry; | 3212 return kSinRuntimeEntry; |
3207 case MethodRecognizer::kMathCos: | 3213 case MethodRecognizer::kMathCos: |
3208 return kCosRuntimeEntry; | 3214 return kCosRuntimeEntry; |
3209 default: | 3215 default: |
3210 UNREACHABLE(); | 3216 UNREACHABLE(); |
3211 } | 3217 } |
3212 return kSinRuntimeEntry; | 3218 return kSinRuntimeEntry; |
3213 } | 3219 } |
3214 | 3220 |
3215 | 3221 |
3222 MergedMath2Instr::MergedMath2Instr(ZoneGrowableArray<Value*>* inputs, | |
3223 intptr_t original_deopt_id, | |
3224 MergedMath2Instr::Kind kind) | |
3225 : inputs_(inputs), | |
Florian Schneider
2014/04/04 11:52:46
pair_ssa_index_ is uninitialized.
Cutch
2014/04/04 16:34:46
Done.
| |
3226 kind_(kind) { | |
3227 ASSERT(inputs_->length() == InputCountFor(kind_)); | |
3228 for (intptr_t i = 0; i < inputs_->length(); ++i) { | |
3229 ASSERT((*inputs)[i] != NULL); | |
3230 (*inputs)[i]->set_instruction(this); | |
3231 (*inputs)[i]->set_use_index(i); | |
3232 } | |
3233 deopt_id_ = original_deopt_id; | |
3234 } | |
3235 | |
3236 | |
3237 intptr_t MergedMath2Instr::OutputIndexOf(intptr_t kind) { | |
3238 switch (kind) { | |
3239 case MethodRecognizer::kMathSin: return 1; | |
3240 case MethodRecognizer::kMathCos: return 0; | |
3241 default: UNIMPLEMENTED(); return -1; | |
3242 } | |
3243 } | |
3244 | |
3245 | |
3246 intptr_t MergedMath2Instr::OutputIndexOf(Token::Kind token) { | |
3247 switch (token) { | |
3248 case Token::kTRUNCDIV: return 0; | |
3249 case Token::kMOD: return 1; | |
3250 default: UNIMPLEMENTED(); return -1; | |
3251 } | |
3252 } | |
3253 | |
3254 | |
3216 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, | 3255 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, |
3217 intptr_t original_deopt_id, | 3256 intptr_t original_deopt_id, |
3218 MergedMathInstr::Kind kind) | 3257 MergedMathInstr::Kind kind) |
3219 : inputs_(inputs), | 3258 : inputs_(inputs), |
3220 kind_(kind) { | 3259 kind_(kind) { |
3221 ASSERT(inputs_->length() == InputCountFor(kind_)); | 3260 ASSERT(inputs_->length() == InputCountFor(kind_)); |
3222 for (intptr_t i = 0; i < inputs_->length(); ++i) { | 3261 for (intptr_t i = 0; i < inputs_->length(); ++i) { |
3223 ASSERT((*inputs)[i] != NULL); | 3262 ASSERT((*inputs)[i] != NULL); |
3224 (*inputs)[i]->set_instruction(this); | 3263 (*inputs)[i]->set_instruction(this); |
3225 (*inputs)[i]->set_use_index(i); | 3264 (*inputs)[i]->set_use_index(i); |
(...skipping 16 matching lines...) Expand all Loading... | |
3242 case Token::kTRUNCDIV: return 0; | 3281 case Token::kTRUNCDIV: return 0; |
3243 case Token::kMOD: return 1; | 3282 case Token::kMOD: return 1; |
3244 default: UNIMPLEMENTED(); return -1; | 3283 default: UNIMPLEMENTED(); return -1; |
3245 } | 3284 } |
3246 } | 3285 } |
3247 | 3286 |
3248 | 3287 |
3249 #undef __ | 3288 #undef __ |
3250 | 3289 |
3251 } // namespace dart | 3290 } // namespace dart |
OLD | NEW |