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

Side by Side Diff: src/data-flow.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 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
« no previous file with comments | « src/data-flow.h ('k') | src/debug.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 15 matching lines...) Expand all
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "data-flow.h" 30 #include "data-flow.h"
31 #include "scopes.h" 31 #include "scopes.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36
37 #ifdef DEBUG 36 #ifdef DEBUG
38 void BitVector::Print() { 37 void BitVector::Print() {
39 bool first = true; 38 bool first = true;
40 PrintF("{"); 39 PrintF("{");
41 for (int i = 0; i < length(); i++) { 40 for (int i = 0; i < length(); i++) {
42 if (Contains(i)) { 41 if (Contains(i)) {
43 if (!first) PrintF(","); 42 if (!first) PrintF(",");
44 first = false; 43 first = false;
45 PrintF("%d", i); 44 PrintF("%d", i);
46 } 45 }
47 } 46 }
48 PrintF("}"); 47 PrintF("}");
49 } 48 }
50 #endif 49 #endif
51 50
52 51
52 void BitVector::Iterator::Advance() {
53 current_++;
54 uint32_t val = current_value_;
55 while (val == 0) {
56 current_index_++;
57 if (Done()) return;
58 val = target_->data_[current_index_];
59 current_ = current_index_ << 5;
60 }
61 val = SkipZeroBytes(val);
62 val = SkipZeroBits(val);
63 current_value_ = val >> 1;
64 }
65
66
53 bool AssignedVariablesAnalyzer::Analyze(CompilationInfo* info) { 67 bool AssignedVariablesAnalyzer::Analyze(CompilationInfo* info) {
54 info_ = info;
55 Scope* scope = info->scope(); 68 Scope* scope = info->scope();
56 int variables = scope->num_parameters() + scope->num_stack_slots(); 69 int size = scope->num_parameters() + scope->num_stack_slots();
57 if (variables == 0) return true; 70 if (size == 0) return true;
58 av_.ExpandTo(variables); 71 AssignedVariablesAnalyzer analyzer(info, size);
59 VisitStatements(info->function()->body()); 72 return analyzer.Analyze();
73 }
74
75
76 AssignedVariablesAnalyzer::AssignedVariablesAnalyzer(CompilationInfo* info,
77 int size)
78 : info_(info), av_(size) {
79 }
80
81
82 bool AssignedVariablesAnalyzer::Analyze() {
83 ASSERT(av_.length() > 0);
84 VisitStatements(info_->function()->body());
60 return !HasStackOverflow(); 85 return !HasStackOverflow();
61 } 86 }
62 87
63 88
64 Variable* AssignedVariablesAnalyzer::FindSmiLoopVariable(ForStatement* stmt) { 89 Variable* AssignedVariablesAnalyzer::FindSmiLoopVariable(ForStatement* stmt) {
65 // The loop must have all necessary parts. 90 // The loop must have all necessary parts.
66 if (stmt->init() == NULL || stmt->cond() == NULL || stmt->next() == NULL) { 91 if (stmt->init() == NULL || stmt->cond() == NULL || stmt->next() == NULL) {
67 return NULL; 92 return NULL;
68 } 93 }
69 // The initialization statement has to be a simple assignment. 94 // The initialization statement has to be a simple assignment.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 av_.Clear(); 336 av_.Clear();
312 Visit(expr->then_expression()); 337 Visit(expr->then_expression());
313 result.Union(av_); 338 result.Union(av_);
314 339
315 av_.Clear(); 340 av_.Clear();
316 Visit(expr->else_expression()); 341 Visit(expr->else_expression());
317 av_.Union(result); 342 av_.Union(result);
318 } 343 }
319 344
320 345
321 void AssignedVariablesAnalyzer::VisitSlot(Slot* expr) {
322 UNREACHABLE();
323 }
324
325
326 void AssignedVariablesAnalyzer::VisitVariableProxy(VariableProxy* expr) { 346 void AssignedVariablesAnalyzer::VisitVariableProxy(VariableProxy* expr) {
327 // Nothing to do. 347 // Nothing to do.
328 ASSERT(av_.IsEmpty()); 348 ASSERT(av_.IsEmpty());
329 } 349 }
330 350
331 351
332 void AssignedVariablesAnalyzer::VisitLiteral(Literal* expr) { 352 void AssignedVariablesAnalyzer::VisitLiteral(Literal* expr) {
333 // Nothing to do. 353 // Nothing to do.
334 ASSERT(av_.IsEmpty()); 354 ASSERT(av_.IsEmpty());
335 } 355 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 ASSERT(av_.IsEmpty()); 536 ASSERT(av_.IsEmpty());
517 } 537 }
518 538
519 539
520 void AssignedVariablesAnalyzer::VisitDeclaration(Declaration* decl) { 540 void AssignedVariablesAnalyzer::VisitDeclaration(Declaration* decl) {
521 UNREACHABLE(); 541 UNREACHABLE();
522 } 542 }
523 543
524 544
525 } } // namespace v8::internal 545 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/data-flow.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698