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/js-typed-lowering.h" | 5 #include "src/compiler/js-typed-lowering.h" |
6 | 6 |
7 #include "src/ast/modules.h" | 7 #include "src/ast/modules.h" |
8 #include "src/builtins/builtins-utils.h" | 8 #include "src/builtins/builtins-utils.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compilation-dependencies.h" | 10 #include "src/compilation-dependencies.h" |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 } | 1392 } |
1393 | 1393 |
1394 Node* JSTypedLowering::BuildGetModuleCell(Node* node) { | 1394 Node* JSTypedLowering::BuildGetModuleCell(Node* node) { |
1395 DCHECK(node->opcode() == IrOpcode::kJSLoadModule || | 1395 DCHECK(node->opcode() == IrOpcode::kJSLoadModule || |
1396 node->opcode() == IrOpcode::kJSStoreModule); | 1396 node->opcode() == IrOpcode::kJSStoreModule); |
1397 Node* effect = NodeProperties::GetEffectInput(node); | 1397 Node* effect = NodeProperties::GetEffectInput(node); |
1398 Node* control = NodeProperties::GetControlInput(node); | 1398 Node* control = NodeProperties::GetControlInput(node); |
1399 | 1399 |
1400 int32_t cell_index = OpParameter<int32_t>(node); | 1400 int32_t cell_index = OpParameter<int32_t>(node); |
1401 Node* module = NodeProperties::GetValueInput(node, 0); | 1401 Node* module = NodeProperties::GetValueInput(node, 0); |
| 1402 Type* module_type = NodeProperties::GetType(module); |
| 1403 |
| 1404 if (module_type->IsHeapConstant()) { |
| 1405 Handle<Module> module_constant = |
| 1406 Handle<Module>::cast(module_type->AsHeapConstant()->Value()); |
| 1407 Handle<Cell> cell_constant(module_constant->GetCell(cell_index), isolate()); |
| 1408 return jsgraph()->HeapConstant(cell_constant); |
| 1409 } |
1402 | 1410 |
1403 FieldAccess field_access; | 1411 FieldAccess field_access; |
1404 int index; | 1412 int index; |
1405 if (ModuleDescriptor::GetCellIndexKind(cell_index) == | 1413 if (ModuleDescriptor::GetCellIndexKind(cell_index) == |
1406 ModuleDescriptor::kExport) { | 1414 ModuleDescriptor::kExport) { |
1407 field_access = AccessBuilder::ForModuleRegularExports(); | 1415 field_access = AccessBuilder::ForModuleRegularExports(); |
1408 index = cell_index - 1; | 1416 index = cell_index - 1; |
1409 } else { | 1417 } else { |
1410 DCHECK_EQ(ModuleDescriptor::GetCellIndexKind(cell_index), | 1418 DCHECK_EQ(ModuleDescriptor::GetCellIndexKind(cell_index), |
1411 ModuleDescriptor::kImport); | 1419 ModuleDescriptor::kImport); |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 } | 2235 } |
2228 | 2236 |
2229 | 2237 |
2230 CompilationDependencies* JSTypedLowering::dependencies() const { | 2238 CompilationDependencies* JSTypedLowering::dependencies() const { |
2231 return dependencies_; | 2239 return dependencies_; |
2232 } | 2240 } |
2233 | 2241 |
2234 } // namespace compiler | 2242 } // namespace compiler |
2235 } // namespace internal | 2243 } // namespace internal |
2236 } // namespace v8 | 2244 } // namespace v8 |
OLD | NEW |