OLD | NEW |
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 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 } | 1785 } |
1786 | 1786 |
1787 | 1787 |
1788 Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value, | 1788 Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value, |
1789 Token::Value op) { | 1789 Token::Value op) { |
1790 Node* the_hole = jsgraph()->TheHoleConstant(); | 1790 Node* the_hole = jsgraph()->TheHoleConstant(); |
1791 VariableMode mode = variable->mode(); | 1791 VariableMode mode = variable->mode(); |
1792 switch (variable->location()) { | 1792 switch (variable->location()) { |
1793 case Variable::UNALLOCATED: { | 1793 case Variable::UNALLOCATED: { |
1794 // Global var, const, or let variable. | 1794 // Global var, const, or let variable. |
1795 if (!info()->is_native()) { | |
1796 // TODO(turbofan): This special case is needed only because we don't | |
1797 // use StoreICs yet. Remove this once StoreNamed is lowered to an IC. | |
1798 Node* name = jsgraph()->Constant(variable->name()); | |
1799 Node* strict = jsgraph()->Constant(strict_mode()); | |
1800 Operator* op = javascript()->Runtime(Runtime::kStoreLookupSlot, 4); | |
1801 return NewNode(op, value, current_context(), name, strict); | |
1802 } | |
1803 Node* global = BuildLoadGlobalObject(); | 1795 Node* global = BuildLoadGlobalObject(); |
1804 PrintableUnique<Name> name = MakeUnique(variable->name()); | 1796 PrintableUnique<Name> name = MakeUnique(variable->name()); |
1805 Operator* op = javascript()->StoreNamed(name); | 1797 Operator* op = javascript()->StoreNamed(name); |
1806 return NewNode(op, global, value); | 1798 return NewNode(op, global, value); |
1807 } | 1799 } |
1808 case Variable::PARAMETER: | 1800 case Variable::PARAMETER: |
1809 case Variable::LOCAL: | 1801 case Variable::LOCAL: |
1810 // Local var, const, or let variable. | 1802 // Local var, const, or let variable. |
1811 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) { | 1803 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) { |
1812 // Perform an initialization check for legacy const variables. | 1804 // Perform an initialization check for legacy const variables. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 | 1969 |
1978 // Continue with the original environment. | 1970 // Continue with the original environment. |
1979 set_environment(continuation_env); | 1971 set_environment(continuation_env); |
1980 | 1972 |
1981 NewNode(common()->Continuation()); | 1973 NewNode(common()->Continuation()); |
1982 } | 1974 } |
1983 } | 1975 } |
1984 } | 1976 } |
1985 } | 1977 } |
1986 } // namespace v8::internal::compiler | 1978 } // namespace v8::internal::compiler |
OLD | NEW |