OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/interpreter/control-flow-builders.h" | 9 #include "src/interpreter/control-flow-builders.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 } else if (expr->expression()->IsVariableProxy()) { | 1776 } else if (expr->expression()->IsVariableProxy()) { |
1777 // Delete of an unqualified identifier is allowed in sloppy mode but is | 1777 // Delete of an unqualified identifier is allowed in sloppy mode but is |
1778 // not allowed in strict mode. Deleting 'this' is allowed in both modes. | 1778 // not allowed in strict mode. Deleting 'this' is allowed in both modes. |
1779 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 1779 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
1780 Variable* variable = proxy->var(); | 1780 Variable* variable = proxy->var(); |
1781 DCHECK(is_sloppy(language_mode()) || variable->HasThisName(isolate())); | 1781 DCHECK(is_sloppy(language_mode()) || variable->HasThisName(isolate())); |
1782 switch (variable->location()) { | 1782 switch (variable->location()) { |
1783 case VariableLocation::GLOBAL: | 1783 case VariableLocation::GLOBAL: |
1784 case VariableLocation::UNALLOCATED: { | 1784 case VariableLocation::UNALLOCATED: { |
1785 // Global var, let, const or variables not explicitly declared. | 1785 // Global var, let, const or variables not explicitly declared. |
1786 Register native_context = execution_result()->NewRegister(); | |
1787 Register global_object = execution_result()->NewRegister(); | 1786 Register global_object = execution_result()->NewRegister(); |
1788 builder() | 1787 builder() |
1789 ->LoadContextSlot(execution_context()->reg(), | 1788 ->LoadContextSlot(execution_context()->reg(), |
1790 Context::NATIVE_CONTEXT_INDEX) | 1789 Context::GLOBAL_OBJECT_INDEX) |
1791 .StoreAccumulatorInRegister(native_context) | |
1792 .LoadContextSlot(native_context, Context::EXTENSION_INDEX) | |
1793 .StoreAccumulatorInRegister(global_object) | 1790 .StoreAccumulatorInRegister(global_object) |
1794 .LoadLiteral(variable->name()) | 1791 .LoadLiteral(variable->name()) |
1795 .Delete(global_object, language_mode()); | 1792 .Delete(global_object, language_mode()); |
1796 break; | 1793 break; |
1797 } | 1794 } |
1798 case VariableLocation::PARAMETER: | 1795 case VariableLocation::PARAMETER: |
1799 case VariableLocation::LOCAL: | 1796 case VariableLocation::LOCAL: |
1800 case VariableLocation::CONTEXT: { | 1797 case VariableLocation::CONTEXT: { |
1801 // Deleting local var/let/const, context variables, and arguments | 1798 // Deleting local var/let/const, context variables, and arguments |
1802 // does not have any effect. | 1799 // does not have any effect. |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2228 } | 2225 } |
2229 | 2226 |
2230 | 2227 |
2231 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 2228 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
2232 return info()->feedback_vector()->GetIndex(slot); | 2229 return info()->feedback_vector()->GetIndex(slot); |
2233 } | 2230 } |
2234 | 2231 |
2235 } // namespace interpreter | 2232 } // namespace interpreter |
2236 } // namespace internal | 2233 } // namespace internal |
2237 } // namespace v8 | 2234 } // namespace v8 |
OLD | NEW |