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