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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 break; | 1821 break; |
1822 } | 1822 } |
1823 case kExternalGlobal: { | 1823 case kExternalGlobal: { |
1824 // Global imports are converted to numbers and written into the | 1824 // Global imports are converted to numbers and written into the |
1825 // {globals_} array buffer. | 1825 // {globals_} array buffer. |
1826 if (module_->globals[import.index].type == kWasmI64) { | 1826 if (module_->globals[import.index].type == kWasmI64) { |
1827 ReportLinkError("global import cannot have type i64", index, | 1827 ReportLinkError("global import cannot have type i64", index, |
1828 module_name, import_name); | 1828 module_name, import_name); |
1829 return -1; | 1829 return -1; |
1830 } | 1830 } |
| 1831 if (FLAG_fast_validate_asm) { |
| 1832 if (module_->globals[import.index].type == kWasmI32) { |
| 1833 value = Object::ToInt32(isolate_, value).ToHandleChecked(); |
| 1834 } else { |
| 1835 value = Object::ToNumber(value).ToHandleChecked(); |
| 1836 } |
| 1837 } |
1831 if (!value->IsNumber()) { | 1838 if (!value->IsNumber()) { |
1832 ReportLinkError("global import must be a number", index, | 1839 ReportLinkError("global import must be a number", index, |
1833 module_name, import_name); | 1840 module_name, import_name); |
1834 return -1; | 1841 return -1; |
1835 } | 1842 } |
1836 WriteGlobalValue(module_->globals[import.index], value); | 1843 WriteGlobalValue(module_->globals[import.index], value); |
1837 break; | 1844 break; |
1838 } | 1845 } |
1839 default: | 1846 default: |
1840 UNREACHABLE(); | 1847 UNREACHABLE(); |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3202 callee_compiled->instruction_start()); | 3209 callee_compiled->instruction_start()); |
3203 } | 3210 } |
3204 DCHECK_EQ(non_compiled_functions.size(), idx); | 3211 DCHECK_EQ(non_compiled_functions.size(), idx); |
3205 } | 3212 } |
3206 | 3213 |
3207 Code* ret = | 3214 Code* ret = |
3208 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); | 3215 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); |
3209 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); | 3216 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); |
3210 return handle(ret, isolate); | 3217 return handle(ret, isolate); |
3211 } | 3218 } |
OLD | NEW |