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

Side by Side Diff: src/ast.cc

Issue 669270: Remove unneeded variable usage analysis. (Closed)
Patch Set: Created 10 years, 9 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/ast.h ('k') | src/compiler.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 VariableProxy::VariableProxy(Handle<String> name, 61 VariableProxy::VariableProxy(Handle<String> name,
62 bool is_this, 62 bool is_this,
63 bool inside_with) 63 bool inside_with)
64 : name_(name), 64 : name_(name),
65 var_(NULL), 65 var_(NULL),
66 is_this_(is_this), 66 is_this_(is_this),
67 inside_with_(inside_with) { 67 inside_with_(inside_with) {
68 // names must be canonicalized for fast equality checks 68 // names must be canonicalized for fast equality checks
69 ASSERT(name->IsSymbol()); 69 ASSERT(name->IsSymbol());
70 // at least one access, otherwise no need for a VariableProxy
71 var_uses_.RecordRead(1);
72 } 70 }
73 71
74 72
75 VariableProxy::VariableProxy(bool is_this) 73 VariableProxy::VariableProxy(bool is_this)
76 : is_this_(is_this) { 74 : is_this_(is_this) {
77 } 75 }
78 76
79 77
80 void VariableProxy::BindTo(Variable* var) { 78 void VariableProxy::BindTo(Variable* var) {
81 ASSERT(var_ == NULL); // must be bound only once 79 ASSERT(var_ == NULL); // must be bound only once
82 ASSERT(var != NULL); // must bind 80 ASSERT(var != NULL); // must bind
83 ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name())); 81 ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name()));
84 // Ideally CONST-ness should match. However, this is very hard to achieve 82 // Ideally CONST-ness should match. However, this is very hard to achieve
85 // because we don't know the exact semantics of conflicting (const and 83 // because we don't know the exact semantics of conflicting (const and
86 // non-const) multiple variable declarations, const vars introduced via 84 // non-const) multiple variable declarations, const vars introduced via
87 // eval() etc. Const-ness and variable declarations are a complete mess 85 // eval() etc. Const-ness and variable declarations are a complete mess
88 // in JS. Sigh... 86 // in JS. Sigh...
89 var_ = var; 87 var_ = var;
90 var->var_uses()->RecordUses(&var_uses_); 88 var->set_is_used(true);
91 var->obj_uses()->RecordUses(&obj_uses_);
92 } 89 }
93 90
94 91
95 Token::Value Assignment::binary_op() const { 92 Token::Value Assignment::binary_op() const {
96 switch (op_) { 93 switch (op_) {
97 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; 94 case Token::ASSIGN_BIT_OR: return Token::BIT_OR;
98 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; 95 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR;
99 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; 96 case Token::ASSIGN_BIT_AND: return Token::BIT_AND;
100 case Token::ASSIGN_SHL: return Token::SHL; 97 case Token::ASSIGN_SHL: return Token::SHL;
101 case Token::ASSIGN_SAR: return Token::SAR; 98 case Token::ASSIGN_SAR: return Token::SAR;
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 if (kInfinity - max_match_ < node_max_match) { 479 if (kInfinity - max_match_ < node_max_match) {
483 max_match_ = kInfinity; 480 max_match_ = kInfinity;
484 } else { 481 } else {
485 max_match_ += node->max_match(); 482 max_match_ += node->max_match();
486 } 483 }
487 } 484 }
488 } 485 }
489 486
490 487
491 } } // namespace v8::internal 488 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698