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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 } | 881 } |
882 | 882 |
883 void BytecodeGraphBuilder::VisitLdaLookupSlot() { | 883 void BytecodeGraphBuilder::VisitLdaLookupSlot() { |
884 BuildLdaLookupSlot(TypeofMode::NOT_INSIDE_TYPEOF); | 884 BuildLdaLookupSlot(TypeofMode::NOT_INSIDE_TYPEOF); |
885 } | 885 } |
886 | 886 |
887 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeof() { | 887 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeof() { |
888 BuildLdaLookupSlot(TypeofMode::INSIDE_TYPEOF); | 888 BuildLdaLookupSlot(TypeofMode::INSIDE_TYPEOF); |
889 } | 889 } |
890 | 890 |
| 891 void BytecodeGraphBuilder::BuildLdaLookupContextSlot(TypeofMode typeof_mode) { |
| 892 // TODO(leszeks): Build the fast path here. |
| 893 |
| 894 // Slow path, do a runtime load lookup. |
| 895 { |
| 896 FrameStateBeforeAndAfter states(this); |
| 897 |
| 898 Node* name = |
| 899 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); |
| 900 |
| 901 const Operator* op = |
| 902 javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF |
| 903 ? Runtime::kLoadLookupSlot |
| 904 : Runtime::kLoadLookupSlotInsideTypeof); |
| 905 Node* value = NewNode(op, name); |
| 906 environment()->BindAccumulator(value, &states); |
| 907 } |
| 908 } |
| 909 |
| 910 void BytecodeGraphBuilder::VisitLdaLookupContextSlot() { |
| 911 BuildLdaLookupContextSlot(TypeofMode::NOT_INSIDE_TYPEOF); |
| 912 } |
| 913 |
| 914 void BytecodeGraphBuilder::VisitLdaLookupContextSlotInsideTypeof() { |
| 915 BuildLdaLookupContextSlot(TypeofMode::INSIDE_TYPEOF); |
| 916 } |
| 917 |
891 void BytecodeGraphBuilder::BuildStaLookupSlot(LanguageMode language_mode) { | 918 void BytecodeGraphBuilder::BuildStaLookupSlot(LanguageMode language_mode) { |
892 FrameStateBeforeAndAfter states(this); | 919 FrameStateBeforeAndAfter states(this); |
893 Node* value = environment()->LookupAccumulator(); | 920 Node* value = environment()->LookupAccumulator(); |
894 Node* name = | 921 Node* name = |
895 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); | 922 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); |
896 const Operator* op = javascript()->CallRuntime( | 923 const Operator* op = javascript()->CallRuntime( |
897 is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict | 924 is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict |
898 : Runtime::kStoreLookupSlot_Sloppy); | 925 : Runtime::kStoreLookupSlot_Sloppy); |
899 Node* store = NewNode(op, name, value); | 926 Node* store = NewNode(op, name, value); |
900 environment()->BindAccumulator(store, &states); | 927 environment()->BindAccumulator(store, &states); |
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 // Phi does not exist yet, introduce one. | 2117 // Phi does not exist yet, introduce one. |
2091 value = NewPhi(inputs, value, control); | 2118 value = NewPhi(inputs, value, control); |
2092 value->ReplaceInput(inputs - 1, other); | 2119 value->ReplaceInput(inputs - 1, other); |
2093 } | 2120 } |
2094 return value; | 2121 return value; |
2095 } | 2122 } |
2096 | 2123 |
2097 } // namespace compiler | 2124 } // namespace compiler |
2098 } // namespace internal | 2125 } // namespace internal |
2099 } // namespace v8 | 2126 } // namespace v8 |
OLD | NEW |