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/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 ModuleDescriptor* mod = scope()->GetModuleScope()->module(); | 2035 ModuleDescriptor* mod = scope()->GetModuleScope()->module(); |
2036 // There may be several export names for this local name, but it doesn't | 2036 // There may be several export names for this local name, but it doesn't |
2037 // matter which one we pick, as they all map to the same cell. | 2037 // matter which one we pick, as they all map to the same cell. |
2038 auto it = mod->regular_exports().find(variable->raw_name()); | 2038 auto it = mod->regular_exports().find(variable->raw_name()); |
2039 DCHECK(it != mod->regular_exports().end()); | 2039 DCHECK(it != mod->regular_exports().end()); |
2040 | 2040 |
2041 RegisterList args = register_allocator()->NewRegisterList(2); | 2041 RegisterList args = register_allocator()->NewRegisterList(2); |
2042 builder() | 2042 builder() |
2043 ->StoreAccumulatorInRegister(args[1]) | 2043 ->StoreAccumulatorInRegister(args[1]) |
2044 .LoadLiteral(it->second->export_name->string()) | 2044 .LoadLiteral(it->second->export_name->string()) |
2045 .StoreAccumulatorInRegister(args[0]) | 2045 .StoreAccumulatorInRegister(args[0]); |
2046 .CallRuntime(Runtime::kStoreModuleExport, args); | 2046 if (needs_hole_check) { |
| 2047 builder()->CallRuntime(Runtime::kLoadModuleExport, args[0]); |
| 2048 BuildHoleCheckForVariableAssignment(variable, op); |
| 2049 } |
| 2050 builder() |
| 2051 ->CallRuntime(Runtime::kStoreModuleExport, args) |
| 2052 .LoadAccumulatorWithRegister(args[1]); |
2047 break; | 2053 break; |
2048 } | 2054 } |
2049 } | 2055 } |
2050 } | 2056 } |
2051 | 2057 |
2052 void BytecodeGenerator::VisitAssignment(Assignment* expr) { | 2058 void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
2053 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); | 2059 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); |
2054 Register object, key; | 2060 Register object, key; |
2055 RegisterList super_property_args; | 2061 RegisterList super_property_args; |
2056 Handle<String> name; | 2062 Handle<String> name; |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 } | 3189 } |
3184 | 3190 |
3185 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3191 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3186 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3192 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3187 : Runtime::kStoreKeyedToSuper_Sloppy; | 3193 : Runtime::kStoreKeyedToSuper_Sloppy; |
3188 } | 3194 } |
3189 | 3195 |
3190 } // namespace interpreter | 3196 } // namespace interpreter |
3191 } // namespace internal | 3197 } // namespace internal |
3192 } // namespace v8 | 3198 } // namespace v8 |
OLD | NEW |