| 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/compiler/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
| 10 #include "src/compiler/bytecode-branch-analysis.h" | 10 #include "src/compiler/bytecode-branch-analysis.h" |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 for (uint32_t d = 0; d < depth; d++) { | 899 for (uint32_t d = 0; d < depth; d++) { |
| 900 Node* extension_slot = | 900 Node* extension_slot = |
| 901 NewNode(javascript()->LoadContext(d, Context::EXTENSION_INDEX, false), | 901 NewNode(javascript()->LoadContext(d, Context::EXTENSION_INDEX, false), |
| 902 environment()->Context()); | 902 environment()->Context()); |
| 903 | 903 |
| 904 Node* check_no_extension = | 904 Node* check_no_extension = |
| 905 NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), | 905 NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), |
| 906 extension_slot, jsgraph()->TheHoleConstant()); | 906 extension_slot, jsgraph()->TheHoleConstant()); |
| 907 | 907 |
| 908 NewBranch(check_no_extension); | 908 NewBranch(check_no_extension); |
| 909 Environment* false_environment = environment(); | |
| 910 Environment* true_environment = environment()->CopyForConditional(); | 909 Environment* true_environment = environment()->CopyForConditional(); |
| 911 | 910 |
| 912 { | 911 { |
| 913 set_environment(false_environment); | |
| 914 NewIfFalse(); | 912 NewIfFalse(); |
| 915 // If there is an extension, merge into the slow path. | 913 // If there is an extension, merge into the slow path. |
| 916 if (slow_environment == nullptr) { | 914 if (slow_environment == nullptr) { |
| 917 slow_environment = false_environment; | 915 slow_environment = environment(); |
| 918 NewMerge(); | 916 NewMerge(); |
| 919 } else { | 917 } else { |
| 920 slow_environment->Merge(false_environment); | 918 slow_environment->Merge(environment()); |
| 921 } | 919 } |
| 922 } | 920 } |
| 923 | 921 |
| 924 { | 922 { |
| 925 set_environment(true_environment); | 923 set_environment(true_environment); |
| 926 NewIfTrue(); | 924 NewIfTrue(); |
| 927 // Do nothing on if there is no extension, eventually falling through to | 925 // Do nothing on if there is no extension, eventually falling through to |
| 928 // the fast path. | 926 // the fast path. |
| 929 } | 927 } |
| 930 } | 928 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 949 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); | 947 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); |
| 950 | 948 |
| 951 const Operator* op = | 949 const Operator* op = |
| 952 javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF | 950 javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF |
| 953 ? Runtime::kLoadLookupSlot | 951 ? Runtime::kLoadLookupSlot |
| 954 : Runtime::kLoadLookupSlotInsideTypeof); | 952 : Runtime::kLoadLookupSlotInsideTypeof); |
| 955 Node* value = NewNode(op, name); | 953 Node* value = NewNode(op, name); |
| 956 environment()->BindAccumulator(value, &states); | 954 environment()->BindAccumulator(value, &states); |
| 957 } | 955 } |
| 958 | 956 |
| 959 fast_environment->Merge(slow_environment); | 957 fast_environment->Merge(environment()); |
| 960 set_environment(fast_environment); | 958 set_environment(fast_environment); |
| 961 } | 959 } |
| 962 | 960 |
| 963 void BytecodeGraphBuilder::VisitLdaLookupContextSlot() { | 961 void BytecodeGraphBuilder::VisitLdaLookupContextSlot() { |
| 964 BuildLdaLookupContextSlot(TypeofMode::NOT_INSIDE_TYPEOF); | 962 BuildLdaLookupContextSlot(TypeofMode::NOT_INSIDE_TYPEOF); |
| 965 } | 963 } |
| 966 | 964 |
| 967 void BytecodeGraphBuilder::VisitLdaLookupContextSlotInsideTypeof() { | 965 void BytecodeGraphBuilder::VisitLdaLookupContextSlotInsideTypeof() { |
| 968 BuildLdaLookupContextSlot(TypeofMode::INSIDE_TYPEOF); | 966 BuildLdaLookupContextSlot(TypeofMode::INSIDE_TYPEOF); |
| 969 } | 967 } |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 // Phi does not exist yet, introduce one. | 2189 // Phi does not exist yet, introduce one. |
| 2192 value = NewPhi(inputs, value, control); | 2190 value = NewPhi(inputs, value, control); |
| 2193 value->ReplaceInput(inputs - 1, other); | 2191 value->ReplaceInput(inputs - 1, other); |
| 2194 } | 2192 } |
| 2195 return value; | 2193 return value; |
| 2196 } | 2194 } |
| 2197 | 2195 |
| 2198 } // namespace compiler | 2196 } // namespace compiler |
| 2199 } // namespace internal | 2197 } // namespace internal |
| 2200 } // namespace v8 | 2198 } // namespace v8 |
| OLD | NEW |