| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
| 8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
| 9 #include "src/base/atomic-utils.h" | 9 #include "src/base/atomic-utils.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 break; | 1662 break; |
| 1663 } | 1663 } |
| 1664 case kExternalGlobal: { | 1664 case kExternalGlobal: { |
| 1665 // Global imports are converted to numbers and written into the | 1665 // Global imports are converted to numbers and written into the |
| 1666 // {globals_} array buffer. | 1666 // {globals_} array buffer. |
| 1667 if (module_->globals[import.index].type == kWasmI64) { | 1667 if (module_->globals[import.index].type == kWasmI64) { |
| 1668 ReportLinkError("global import cannot have type i64", index, | 1668 ReportLinkError("global import cannot have type i64", index, |
| 1669 module_name, import_name); | 1669 module_name, import_name); |
| 1670 return -1; | 1670 return -1; |
| 1671 } | 1671 } |
| 1672 if (FLAG_fast_validate_asm) { |
| 1673 if (module_->globals[import.index].type == kWasmI32) { |
| 1674 value = Object::ToInt32(isolate_, value).ToHandleChecked(); |
| 1675 } else { |
| 1676 value = Object::ToNumber(value).ToHandleChecked(); |
| 1677 } |
| 1678 } |
| 1672 if (!value->IsNumber()) { | 1679 if (!value->IsNumber()) { |
| 1673 ReportLinkError("global import must be a number", index, | 1680 ReportLinkError("global import must be a number", index, |
| 1674 module_name, import_name); | 1681 module_name, import_name); |
| 1675 return -1; | 1682 return -1; |
| 1676 } | 1683 } |
| 1677 WriteGlobalValue(module_->globals[import.index], value); | 1684 WriteGlobalValue(module_->globals[import.index], value); |
| 1678 break; | 1685 break; |
| 1679 } | 1686 } |
| 1680 default: | 1687 default: |
| 1681 UNREACHABLE(); | 1688 UNREACHABLE(); |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 Handle<String> module_property_name = | 2757 Handle<String> module_property_name = |
| 2751 isolate->factory()->InternalizeUtf8String("module"); | 2758 isolate->factory()->InternalizeUtf8String("module"); |
| 2752 Handle<String> instance_property_name = | 2759 Handle<String> instance_property_name = |
| 2753 isolate->factory()->InternalizeUtf8String("instance"); | 2760 isolate->factory()->InternalizeUtf8String("instance"); |
| 2754 JSObject::AddProperty(ret, module_property_name, module, NONE); | 2761 JSObject::AddProperty(ret, module_property_name, module, NONE); |
| 2755 JSObject::AddProperty(ret, instance_property_name, | 2762 JSObject::AddProperty(ret, instance_property_name, |
| 2756 instance_object.ToHandleChecked(), NONE); | 2763 instance_object.ToHandleChecked(), NONE); |
| 2757 | 2764 |
| 2758 ResolvePromise(isolate, promise, ret); | 2765 ResolvePromise(isolate, promise, ret); |
| 2759 } | 2766 } |
| OLD | NEW |