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/base/atomic-utils.h" | 7 #include "src/base/atomic-utils.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 | 9 |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 origin(kWasmOrigin), | 875 origin(kWasmOrigin), |
876 globals_size(0), | 876 globals_size(0), |
877 num_imported_functions(0), | 877 num_imported_functions(0), |
878 num_declared_functions(0), | 878 num_declared_functions(0), |
879 num_exported_functions(0), | 879 num_exported_functions(0), |
880 pending_tasks(new base::Semaphore(0)) {} | 880 pending_tasks(new base::Semaphore(0)) {} |
881 | 881 |
882 void EncodeInit(const WasmModule* module, Factory* factory, | 882 void EncodeInit(const WasmModule* module, Factory* factory, |
883 Handle<FixedArray> entry, int kind_index, int value_index, | 883 Handle<FixedArray> entry, int kind_index, int value_index, |
884 const WasmInitExpr& expr) { | 884 const WasmInitExpr& expr) { |
885 entry->set(kind_index, Smi::FromInt(0)); | 885 entry->set(kind_index, Smi::kZero); |
886 | 886 |
887 Handle<Object> value; | 887 Handle<Object> value; |
888 switch (expr.kind) { | 888 switch (expr.kind) { |
889 case WasmInitExpr::kGlobalIndex: { | 889 case WasmInitExpr::kGlobalIndex: { |
890 TRACE(" kind = 1, global index %u\n", expr.val.global_index); | 890 TRACE(" kind = 1, global index %u\n", expr.val.global_index); |
891 entry->set(kind_index, Smi::FromInt(1)); | 891 entry->set(kind_index, Smi::FromInt(1)); |
892 uint32_t offset = module->globals[expr.val.global_index].offset; | 892 uint32_t offset = module->globals[expr.val.global_index].offset; |
893 entry->set(value_index, Smi::FromInt(offset)); | 893 entry->set(value_index, Smi::FromInt(offset)); |
894 return; | 894 return; |
895 } | 895 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 } | 1112 } |
1113 inits->Shrink(index); | 1113 inits->Shrink(index); |
1114 ret->set_inits(inits); | 1114 ret->set_inits(inits); |
1115 } | 1115 } |
1116 | 1116 |
1117 // Record data for startup function. | 1117 // Record data for startup function. |
1118 if (start_function_index >= 0) { | 1118 if (start_function_index >= 0) { |
1119 HandleScope scope(isolate); | 1119 HandleScope scope(isolate); |
1120 Handle<FixedArray> startup_data = | 1120 Handle<FixedArray> startup_data = |
1121 factory->NewFixedArray(kWasmExportDataSize, TENURED); | 1121 factory->NewFixedArray(kWasmExportDataSize, TENURED); |
1122 startup_data->set(kExportArity, Smi::FromInt(0)); | 1122 startup_data->set(kExportArity, Smi::kZero); |
1123 startup_data->set(kExportIndex, Smi::FromInt(start_function_index)); | 1123 startup_data->set(kExportIndex, Smi::FromInt(start_function_index)); |
1124 ret->set_startup_function(startup_data); | 1124 ret->set_startup_function(startup_data); |
1125 } | 1125 } |
1126 | 1126 |
1127 // TODO(wasm): saving the module bytes for debugging is wasteful. We should | 1127 // TODO(wasm): saving the module bytes for debugging is wasteful. We should |
1128 // consider downloading this on-demand. | 1128 // consider downloading this on-demand. |
1129 { | 1129 { |
1130 size_t module_bytes_len = module_end - module_start; | 1130 size_t module_bytes_len = module_end - module_start; |
1131 DCHECK_LE(module_bytes_len, static_cast<size_t>(kMaxInt)); | 1131 DCHECK_LE(module_bytes_len, static_cast<size_t>(kMaxInt)); |
1132 Vector<const uint8_t> module_bytes_vec(module_start, | 1132 Vector<const uint8_t> module_bytes_vec(module_start, |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 WasmCompiledModule* compiled_module = | 2251 WasmCompiledModule* compiled_module = |
2252 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); | 2252 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); |
2253 CHECK(compiled_module->has_weak_module_object()); | 2253 CHECK(compiled_module->has_weak_module_object()); |
2254 CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); | 2254 CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); |
2255 } | 2255 } |
2256 | 2256 |
2257 } // namespace testing | 2257 } // namespace testing |
2258 } // namespace wasm | 2258 } // namespace wasm |
2259 } // namespace internal | 2259 } // namespace internal |
2260 } // namespace v8 | 2260 } // namespace v8 |
OLD | NEW |