| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
| 6 #include "src/compiler/scheduler.h" | 6 #include "src/compiler/scheduler.h" |
| 7 #include "src/compiler/structured-machine-assembler.h" | 7 #include "src/compiler/structured-machine-assembler.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void StructuredMachineAssembler::Merge(EnvironmentVector* environments, | 206 void StructuredMachineAssembler::Merge(EnvironmentVector* environments, |
| 207 int truncate_at) { | 207 int truncate_at) { |
| 208 DCHECK(current_environment_ == NULL || current_environment_->is_dead_); | 208 DCHECK(current_environment_ == NULL || current_environment_->is_dead_); |
| 209 Environment* next = new (zone()) Environment(zone(), NULL, false); | 209 Environment* next = new (zone()) Environment(zone(), NULL, false); |
| 210 current_environment_ = next; | 210 current_environment_ = next; |
| 211 size_t n_vars = number_of_variables_; | 211 size_t n_vars = number_of_variables_; |
| 212 NodeVector& vars = next->variables_; | 212 NodeVector& vars = next->variables_; |
| 213 vars.reserve(n_vars); | 213 vars.reserve(n_vars); |
| 214 Node** scratch = NULL; | 214 Node** scratch = NULL; |
| 215 size_t n_envs = environments->size(); | 215 size_t n_envs = environments->size(); |
| 216 Environment** live_environments = zone()->NewArray<Environment*>(n_envs); | 216 Environment** live_environments = |
| 217 zone()->NewArray<Environment*>(static_cast<int>(n_envs)); |
| 217 size_t n_live = 0; | 218 size_t n_live = 0; |
| 218 for (size_t i = 0; i < n_envs; i++) { | 219 for (size_t i = 0; i < n_envs; i++) { |
| 219 if (environments->at(i)->is_dead_) continue; | 220 if (environments->at(i)->is_dead_) continue; |
| 220 live_environments[n_live++] = environments->at(i); | 221 live_environments[n_live++] = environments->at(i); |
| 221 } | 222 } |
| 222 n_envs = n_live; | 223 n_envs = n_live; |
| 223 if (n_live == 0) next->is_dead_ = true; | 224 if (n_live == 0) next->is_dead_ = true; |
| 224 if (!next->is_dead_) { | 225 if (!next->is_dead_) { |
| 225 next->block_ = schedule()->NewBasicBlock(); | 226 next->block_ = schedule()->NewBasicBlock(); |
| 226 } | 227 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 242 if (val == resolved) continue; | 243 if (val == resolved) continue; |
| 243 if (i != 0) break; | 244 if (i != 0) break; |
| 244 resolved = val; | 245 resolved = val; |
| 245 } | 246 } |
| 246 // Have to generate a phi. | 247 // Have to generate a phi. |
| 247 if (i < n_envs) { | 248 if (i < n_envs) { |
| 248 // All values thus far uninitialized, variable used out of scope. | 249 // All values thus far uninitialized, variable used out of scope. |
| 249 CHECK(resolved != NULL); | 250 CHECK(resolved != NULL); |
| 250 // Init scratch buffer. | 251 // Init scratch buffer. |
| 251 if (scratch == NULL) { | 252 if (scratch == NULL) { |
| 252 scratch = zone()->NewArray<Node*>(n_envs); | 253 scratch = zone()->NewArray<Node*>(static_cast<int>(n_envs)); |
| 253 } | 254 } |
| 254 for (size_t k = 0; k < i; k++) { | 255 for (size_t k = 0; k < i; k++) { |
| 255 scratch[k] = resolved; | 256 scratch[k] = resolved; |
| 256 } | 257 } |
| 257 for (; i < n_envs; i++) { | 258 for (; i < n_envs; i++) { |
| 258 scratch[i] = live_environments[i]->variables_[j]; | 259 scratch[i] = live_environments[i]->variables_[j]; |
| 259 } | 260 } |
| 260 resolved = graph()->NewNode(common()->Phi(static_cast<int>(n_envs)), | 261 resolved = graph()->NewNode(common()->Phi(static_cast<int>(n_envs)), |
| 261 static_cast<int>(n_envs), scratch); | 262 static_cast<int>(n_envs), scratch); |
| 262 if (next->block_ != NULL) { | 263 if (next->block_ != NULL) { |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 } | 655 } |
| 655 pending_header_merges_.clear(); | 656 pending_header_merges_.clear(); |
| 656 pending_exit_merges_.clear(); | 657 pending_exit_merges_.clear(); |
| 657 header_environment_ = NULL; | 658 header_environment_ = NULL; |
| 658 DCHECK(IsDone()); | 659 DCHECK(IsDone()); |
| 659 } | 660 } |
| 660 | 661 |
| 661 } // namespace compiler | 662 } // namespace compiler |
| 662 } // namespace internal | 663 } // namespace internal |
| 663 } // namespace v8 | 664 } // namespace v8 |
| OLD | NEW |