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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 435393004: Carry along ContextualMode in JSLoadNamed operators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | src/compiler/js-generic-lowering.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/control-builders.h" 8 #include "src/compiler/control-builders.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 } 1678 }
1679 1679
1680 1680
1681 Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, 1681 Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
1682 ContextualMode contextual_mode) { 1682 ContextualMode contextual_mode) {
1683 Node* the_hole = jsgraph()->TheHoleConstant(); 1683 Node* the_hole = jsgraph()->TheHoleConstant();
1684 VariableMode mode = variable->mode(); 1684 VariableMode mode = variable->mode();
1685 switch (variable->location()) { 1685 switch (variable->location()) {
1686 case Variable::UNALLOCATED: { 1686 case Variable::UNALLOCATED: {
1687 // Global var, const, or let variable. 1687 // Global var, const, or let variable.
1688 if (!info()->is_native()) {
1689 // TODO(turbofan): This special case is needed only because we don't
1690 // use LoadICs yet. Remove this once LoadNamed is lowered to an IC.
1691 Node* name = jsgraph()->Constant(variable->name());
1692 Runtime::FunctionId function_id =
1693 (contextual_mode == CONTEXTUAL)
1694 ? Runtime::kLoadLookupSlot
1695 : Runtime::kLoadLookupSlotNoReferenceError;
1696 Operator* op = javascript()->Runtime(function_id, 2);
1697 Node* pair = NewNode(op, current_context(), name);
1698 return NewNode(common()->Projection(0), pair);
1699 }
1700 Node* global = BuildLoadGlobalObject(); 1688 Node* global = BuildLoadGlobalObject();
1701 PrintableUnique<Name> name = MakeUnique(variable->name()); 1689 PrintableUnique<Name> name = MakeUnique(variable->name());
1702 Operator* op = javascript()->LoadNamed(name); 1690 Operator* op = javascript()->LoadNamed(name, contextual_mode);
1703 return NewNode(op, global); 1691 return NewNode(op, global);
1704 } 1692 }
1705 case Variable::PARAMETER: 1693 case Variable::PARAMETER:
1706 case Variable::LOCAL: { 1694 case Variable::LOCAL: {
1707 // Local var, const, or let variable. 1695 // Local var, const, or let variable.
1708 Node* value = environment()->Lookup(variable); 1696 Node* value = environment()->Lookup(variable);
1709 if (mode == CONST_LEGACY) { 1697 if (mode == CONST_LEGACY) {
1710 // Perform check for uninitialized legacy const variables. 1698 // Perform check for uninitialized legacy const variables.
1711 if (value->op() == the_hole->op()) { 1699 if (value->op() == the_hole->op()) {
1712 value = jsgraph()->UndefinedConstant(); 1700 value = jsgraph()->UndefinedConstant();
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 1960
1973 // Continue with the original environment. 1961 // Continue with the original environment.
1974 set_environment(continuation_env); 1962 set_environment(continuation_env);
1975 1963
1976 NewNode(common()->Continuation()); 1964 NewNode(common()->Continuation());
1977 } 1965 }
1978 } 1966 }
1979 } 1967 }
1980 } 1968 }
1981 } // namespace v8::internal::compiler 1969 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « no previous file | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698