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

Side by Side Diff: src/rewriter.cc

Issue 126195: Fix issue 380. (Closed)
Patch Set: Created 11 years, 6 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 | « no previous file | test/cctest/test-func-name-inference.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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 277
278 void AstOptimizer::VisitAssignment(Assignment* node) { 278 void AstOptimizer::VisitAssignment(Assignment* node) {
279 ScopedFuncNameInferrer scoped_fni(&func_name_inferrer_); 279 ScopedFuncNameInferrer scoped_fni(&func_name_inferrer_);
280 switch (node->op()) { 280 switch (node->op()) {
281 case Token::INIT_VAR: 281 case Token::INIT_VAR:
282 case Token::INIT_CONST: 282 case Token::INIT_CONST:
283 case Token::ASSIGN: 283 case Token::ASSIGN:
284 // No type can be infered from the general assignment. 284 // No type can be infered from the general assignment.
285 285
286 scoped_fni.Enter(); 286 // Don't infer if it is "a = function(){...}();"-like expression.
287 if (node->value()->AsCall() == NULL) {
288 scoped_fni.Enter();
289 }
287 break; 290 break;
288 case Token::ASSIGN_BIT_OR: 291 case Token::ASSIGN_BIT_OR:
289 case Token::ASSIGN_BIT_XOR: 292 case Token::ASSIGN_BIT_XOR:
290 case Token::ASSIGN_BIT_AND: 293 case Token::ASSIGN_BIT_AND:
291 case Token::ASSIGN_SHL: 294 case Token::ASSIGN_SHL:
292 case Token::ASSIGN_SAR: 295 case Token::ASSIGN_SAR:
293 case Token::ASSIGN_SHR: 296 case Token::ASSIGN_SHR:
294 node->type()->SetAsLikelySmiIfUnknown(); 297 node->type()->SetAsLikelySmiIfUnknown();
295 node->target()->type()->SetAsLikelySmiIfUnknown(); 298 node->target()->type()->SetAsLikelySmiIfUnknown();
296 node->value()->type()->SetAsLikelySmiIfUnknown(); 299 node->value()->type()->SetAsLikelySmiIfUnknown();
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 optimizer.Optimize(body); 833 optimizer.Optimize(body);
831 if (optimizer.HasStackOverflow()) { 834 if (optimizer.HasStackOverflow()) {
832 return false; 835 return false;
833 } 836 }
834 } 837 }
835 return true; 838 return true;
836 } 839 }
837 840
838 841
839 } } // namespace v8::internal 842 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-func-name-inference.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698