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

Side by Side Diff: src/compiler/structured-machine-assembler.cc

Issue 420033003: Fix 64-bit VS2010 build (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/compiler/scheduler.cc ('k') | src/compiler/x64/code-generator-x64.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 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 new_env->variables_.push_back(phi); 176 new_env->variables_.push_back(phi);
177 } 177 }
178 return new_env; 178 return new_env;
179 } 179 }
180 180
181 181
182 void StructuredMachineAssembler::MergeBackEdgesToLoopHeader( 182 void StructuredMachineAssembler::MergeBackEdgesToLoopHeader(
183 Environment* header, EnvironmentVector* environments) { 183 Environment* header, EnvironmentVector* environments) {
184 // Only merge as many variables are were declared before this loop. 184 // Only merge as many variables are were declared before this loop.
185 size_t n = header->variables_.size(); 185 int n = static_cast<int>(header->variables_.size());
186 // TODO(dcarney): invert loop order and extend phis once. 186 // TODO(dcarney): invert loop order and extend phis once.
187 for (EnvironmentVector::iterator i = environments->begin(); 187 for (EnvironmentVector::iterator i = environments->begin();
188 i != environments->end(); ++i) { 188 i != environments->end(); ++i) {
189 Environment* from = *i; 189 Environment* from = *i;
190 if (from->is_dead_) continue; 190 if (from->is_dead_) continue;
191 AddGoto(from, header); 191 AddGoto(from, header);
192 for (size_t i = 0; i < n; ++i) { 192 for (int i = 0; i < n; ++i) {
193 Node* phi = header->variables_[i]; 193 Node* phi = header->variables_[i];
194 if (phi == NULL) continue; 194 if (phi == NULL) continue;
195 phi->set_op(common()->Phi(phi->InputCount() + 1)); 195 phi->set_op(common()->Phi(phi->InputCount() + 1));
196 phi->AppendInput(zone(), VariableAt(from, i)); 196 phi->AppendInput(zone(), VariableAt(from, i));
197 } 197 }
198 } 198 }
199 } 199 }
200 200
201 201
202 void StructuredMachineAssembler::Merge(EnvironmentVector* environments, 202 void StructuredMachineAssembler::Merge(EnvironmentVector* environments,
(...skipping 23 matching lines...) Expand all
226 // Find first non equal variable. 226 // Find first non equal variable.
227 size_t i = 0; 227 size_t i = 0;
228 for (; i < n_envs; i++) { 228 for (; i < n_envs; i++) {
229 ASSERT(live_environments[i]->variables_.size() <= n_vars); 229 ASSERT(live_environments[i]->variables_.size() <= n_vars);
230 Node* val = NULL; 230 Node* val = NULL;
231 if (j < static_cast<size_t>(truncate_at)) { 231 if (j < static_cast<size_t>(truncate_at)) {
232 val = live_environments[i]->variables_.at(j); 232 val = live_environments[i]->variables_.at(j);
233 // TODO(dcarney): record start position at time of split. 233 // TODO(dcarney): record start position at time of split.
234 // all variables after this should not be NULL. 234 // all variables after this should not be NULL.
235 if (val != NULL) { 235 if (val != NULL) {
236 val = VariableAt(live_environments[i], j); 236 val = VariableAt(live_environments[i], static_cast<int>(j));
237 } 237 }
238 } 238 }
239 if (val == resolved) continue; 239 if (val == resolved) continue;
240 if (i != 0) break; 240 if (i != 0) break;
241 resolved = val; 241 resolved = val;
242 } 242 }
243 // Have to generate a phi. 243 // Have to generate a phi.
244 if (i < n_envs) { 244 if (i < n_envs) {
245 // All values thus far uninitialized, variable used out of scope. 245 // All values thus far uninitialized, variable used out of scope.
246 CHECK(resolved != NULL); 246 CHECK(resolved != NULL);
247 // Init scratch buffer. 247 // Init scratch buffer.
248 if (scratch == NULL) { 248 if (scratch == NULL) {
249 scratch = static_cast<Node**>(alloca(n_envs * sizeof(resolved))); 249 scratch = static_cast<Node**>(alloca(n_envs * sizeof(resolved)));
250 } 250 }
251 for (size_t k = 0; k < i; k++) { 251 for (size_t k = 0; k < i; k++) {
252 scratch[k] = resolved; 252 scratch[k] = resolved;
253 } 253 }
254 for (; i < n_envs; i++) { 254 for (; i < n_envs; i++) {
255 scratch[i] = live_environments[i]->variables_[j]; 255 scratch[i] = live_environments[i]->variables_[j];
256 } 256 }
257 resolved = graph()->NewNode(common()->Phi(n_envs), n_envs, scratch); 257 resolved = graph()->NewNode(common()->Phi(static_cast<int>(n_envs)),
258 static_cast<int>(n_envs), scratch);
258 if (next->block_ != NULL) { 259 if (next->block_ != NULL) {
259 schedule()->AddNode(next->block_, resolved); 260 schedule()->AddNode(next->block_, resolved);
260 } 261 }
261 } 262 }
262 vars.push_back(resolved); 263 vars.push_back(resolved);
263 } 264 }
264 } 265 }
265 266
266 267
267 void StructuredMachineAssembler::AddGoto(Environment* from, Environment* to) { 268 void StructuredMachineAssembler::AddGoto(Environment* from, Environment* to) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 638
638 639
639 void StructuredMachineAssembler::LoopBuilder::End() { 640 void StructuredMachineAssembler::LoopBuilder::End() {
640 ASSERT(!IsDone()); 641 ASSERT(!IsDone());
641 if (smasm_->current_environment_ != NULL) { 642 if (smasm_->current_environment_ != NULL) {
642 Continue(); 643 Continue();
643 } 644 }
644 // Do loop header merges. 645 // Do loop header merges.
645 smasm_->MergeBackEdgesToLoopHeader(header_environment_, 646 smasm_->MergeBackEdgesToLoopHeader(header_environment_,
646 &pending_header_merges_); 647 &pending_header_merges_);
647 int initial_size = header_environment_->variables_.size(); 648 int initial_size = static_cast<int>(header_environment_->variables_.size());
648 // Do loop exit merges, truncating loop variables away. 649 // Do loop exit merges, truncating loop variables away.
649 smasm_->Merge(&pending_exit_merges_, initial_size); 650 smasm_->Merge(&pending_exit_merges_, initial_size);
650 for (EnvironmentVector::iterator i = pending_exit_merges_.begin(); 651 for (EnvironmentVector::iterator i = pending_exit_merges_.begin();
651 i != pending_exit_merges_.end(); ++i) { 652 i != pending_exit_merges_.end(); ++i) {
652 smasm_->AddGoto(*i, smasm_->current_environment_); 653 smasm_->AddGoto(*i, smasm_->current_environment_);
653 } 654 }
654 pending_header_merges_.clear(); 655 pending_header_merges_.clear();
655 pending_exit_merges_.clear(); 656 pending_exit_merges_.clear();
656 header_environment_ = NULL; 657 header_environment_ = NULL;
657 ASSERT(IsDone()); 658 ASSERT(IsDone());
658 } 659 }
659 660
660 } // namespace compiler 661 } // namespace compiler
661 } // namespace internal 662 } // namespace internal
662 } // namespace v8 663 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/scheduler.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698