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

Side by Side Diff: src/parser.cc

Issue 8273037: Merge r9430, r9433, r9508 and 9615 into 3.6 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.6/
Patch Set: '' Created 9 years, 2 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/objects-inl.h ('k') | src/profile-generator.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 int position = -1; 1746 int position = -1;
1747 if (peek() == Token::ASSIGN) { 1747 if (peek() == Token::ASSIGN) {
1748 Expect(Token::ASSIGN, CHECK_OK); 1748 Expect(Token::ASSIGN, CHECK_OK);
1749 position = scanner().location().beg_pos; 1749 position = scanner().location().beg_pos;
1750 value = ParseAssignmentExpression(var_context != kForStatement, CHECK_OK); 1750 value = ParseAssignmentExpression(var_context != kForStatement, CHECK_OK);
1751 // Don't infer if it is "a = function(){...}();"-like expression. 1751 // Don't infer if it is "a = function(){...}();"-like expression.
1752 if (fni_ != NULL && 1752 if (fni_ != NULL &&
1753 value->AsCall() == NULL && 1753 value->AsCall() == NULL &&
1754 value->AsCallNew() == NULL) { 1754 value->AsCallNew() == NULL) {
1755 fni_->Infer(); 1755 fni_->Infer();
1756 } else {
1757 fni_->RemoveLastFunction();
1756 } 1758 }
1757 } 1759 }
1758 1760
1759 // Make sure that 'const x' and 'let x' initialize 'x' to undefined. 1761 // Make sure that 'const x' and 'let x' initialize 'x' to undefined.
1760 if (value == NULL && needs_init) { 1762 if (value == NULL && needs_init) {
1761 value = GetLiteralUndefined(); 1763 value = GetLiteralUndefined();
1762 } 1764 }
1763 1765
1764 // Global variable declarations must be compiled in a specific 1766 // Global variable declarations must be compiled in a specific
1765 // way. When the script containing the global variable declaration 1767 // way. When the script containing the global variable declaration
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 2498
2497 if (fni_ != NULL) { 2499 if (fni_ != NULL) {
2498 // Check if the right hand side is a call to avoid inferring a 2500 // Check if the right hand side is a call to avoid inferring a
2499 // name if we're dealing with "a = function(){...}();"-like 2501 // name if we're dealing with "a = function(){...}();"-like
2500 // expression. 2502 // expression.
2501 if ((op == Token::INIT_VAR 2503 if ((op == Token::INIT_VAR
2502 || op == Token::INIT_CONST 2504 || op == Token::INIT_CONST
2503 || op == Token::ASSIGN) 2505 || op == Token::ASSIGN)
2504 && (right->AsCall() == NULL && right->AsCallNew() == NULL)) { 2506 && (right->AsCall() == NULL && right->AsCallNew() == NULL)) {
2505 fni_->Infer(); 2507 fni_->Infer();
2508 } else {
2509 fni_->RemoveLastFunction();
2506 } 2510 }
2507 fni_->Leave(); 2511 fni_->Leave();
2508 } 2512 }
2509 2513
2510 return new(zone()) Assignment(isolate(), op, expression, right, pos); 2514 return new(zone()) Assignment(isolate(), op, expression, right, pos);
2511 } 2515 }
2512 2516
2513 2517
2514 // Precedence = 3 2518 // Precedence = 3
2515 Expression* Parser::ParseConditionalExpression(bool accept_IN, bool* ok) { 2519 Expression* Parser::ParseConditionalExpression(bool accept_IN, bool* ok) {
(...skipping 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after
5223 result = parser.ParseProgram(source, 5227 result = parser.ParseProgram(source,
5224 info->is_global(), 5228 info->is_global(),
5225 info->StrictMode()); 5229 info->StrictMode());
5226 } 5230 }
5227 } 5231 }
5228 info->SetFunction(result); 5232 info->SetFunction(result);
5229 return (result != NULL); 5233 return (result != NULL);
5230 } 5234 }
5231 5235
5232 } } // namespace v8::internal 5236 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/profile-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698