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

Side by Side Diff: src/parser.cc

Issue 19199002: Fix sloppy-mode 'const' under Harmony flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | « no previous file | test/mjsunit/regress/regress-173361.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 // same variable if it is declared several times. This is not a 1556 // same variable if it is declared several times. This is not a
1557 // semantic issue as long as we keep the source order, but it may be 1557 // semantic issue as long as we keep the source order, but it may be
1558 // a performance issue since it may lead to repeated 1558 // a performance issue since it may lead to repeated
1559 // Runtime::DeclareContextSlot() calls. 1559 // Runtime::DeclareContextSlot() calls.
1560 declaration_scope->AddDeclaration(declaration); 1560 declaration_scope->AddDeclaration(declaration);
1561 1561
1562 if (mode == CONST && declaration_scope->is_global_scope()) { 1562 if (mode == CONST && declaration_scope->is_global_scope()) {
1563 // For global const variables we bind the proxy to a variable. 1563 // For global const variables we bind the proxy to a variable.
1564 ASSERT(resolve); // should be set by all callers 1564 ASSERT(resolve); // should be set by all callers
1565 Variable::Kind kind = Variable::NORMAL; 1565 Variable::Kind kind = Variable::NORMAL;
1566 var = new(zone()) Variable(declaration_scope, 1566 var = new(zone()) Variable(
1567 name, 1567 declaration_scope, name, mode, true, kind,
1568 mode, 1568 kNeedsInitialization, proxy->interface());
1569 true,
1570 kind,
1571 kNeedsInitialization);
1572 } else if (declaration_scope->is_eval_scope() && 1569 } else if (declaration_scope->is_eval_scope() &&
1573 declaration_scope->is_classic_mode()) { 1570 declaration_scope->is_classic_mode()) {
1574 // For variable declarations in a non-strict eval scope the proxy is bound 1571 // For variable declarations in a non-strict eval scope the proxy is bound
1575 // to a lookup variable to force a dynamic declaration using the 1572 // to a lookup variable to force a dynamic declaration using the
1576 // DeclareContextSlot runtime function. 1573 // DeclareContextSlot runtime function.
1577 Variable::Kind kind = Variable::NORMAL; 1574 Variable::Kind kind = Variable::NORMAL;
1578 var = new(zone()) Variable(declaration_scope, 1575 var = new(zone()) Variable(
1579 name, 1576 declaration_scope, name, mode, true, kind,
1580 mode, 1577 declaration->initialization(), proxy->interface());
1581 true,
1582 kind,
1583 declaration->initialization());
1584 var->AllocateTo(Variable::LOOKUP, -1); 1578 var->AllocateTo(Variable::LOOKUP, -1);
1585 resolve = true; 1579 resolve = true;
1586 } 1580 }
1587 1581
1588 // If requested and we have a local variable, bind the proxy to the variable 1582 // If requested and we have a local variable, bind the proxy to the variable
1589 // at parse-time. This is used for functions (and consts) declared inside 1583 // at parse-time. This is used for functions (and consts) declared inside
1590 // statements: the corresponding function (or const) variable must be in the 1584 // statements: the corresponding function (or const) variable must be in the
1591 // function scope and not a statement-local scope, e.g. as provided with a 1585 // function scope and not a statement-local scope, e.g. as provided with a
1592 // 'with' statement: 1586 // 'with' statement:
1593 // 1587 //
(...skipping 4325 matching lines...) Expand 10 before | Expand all | Expand 10 after
5919 ASSERT(info()->isolate()->has_pending_exception()); 5913 ASSERT(info()->isolate()->has_pending_exception());
5920 } else { 5914 } else {
5921 result = ParseProgram(); 5915 result = ParseProgram();
5922 } 5916 }
5923 } 5917 }
5924 info()->SetFunction(result); 5918 info()->SetFunction(result);
5925 return (result != NULL); 5919 return (result != NULL);
5926 } 5920 }
5927 5921
5928 } } // namespace v8::internal 5922 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-173361.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698