| 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 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2052 | 2052 | 
| 2053 Handle<FixedArray> BuildFunctionTable(Isolate* isolate, uint32_t index, | 2053 Handle<FixedArray> BuildFunctionTable(Isolate* isolate, uint32_t index, | 
| 2054                                       const WasmModule* module) { | 2054                                       const WasmModule* module) { | 
| 2055   const WasmIndirectFunctionTable* table = &module->function_tables[index]; | 2055   const WasmIndirectFunctionTable* table = &module->function_tables[index]; | 
| 2056   DCHECK_EQ(table->size, table->values.size()); | 2056   DCHECK_EQ(table->size, table->values.size()); | 
| 2057   DCHECK_GE(table->max_size, table->size); | 2057   DCHECK_GE(table->max_size, table->size); | 
| 2058   Handle<FixedArray> values = | 2058   Handle<FixedArray> values = | 
| 2059       isolate->factory()->NewFixedArray(2 * table->max_size, TENURED); | 2059       isolate->factory()->NewFixedArray(2 * table->max_size, TENURED); | 
| 2060   for (uint32_t i = 0; i < table->size; ++i) { | 2060   for (uint32_t i = 0; i < table->size; ++i) { | 
| 2061     const WasmFunction* function = &module->functions[table->values[i]]; | 2061     const WasmFunction* function = &module->functions[table->values[i]]; | 
| 2062     values->set(i, Smi::FromInt(function->sig_index)); | 2062     int32_t index = table->map.Find(function->sig); | 
|  | 2063     DCHECK_GE(index, 0); | 
|  | 2064     values->set(i, Smi::FromInt(index)); | 
| 2063     values->set(i + table->max_size, Smi::FromInt(table->values[i])); | 2065     values->set(i + table->max_size, Smi::FromInt(table->values[i])); | 
| 2064   } | 2066   } | 
| 2065   // Set the remaining elements to -1 (instead of "undefined"). These | 2067   // Set the remaining elements to -1 (instead of "undefined"). These | 
| 2066   // elements are accessed directly as SMIs (without a check). On 64-bit | 2068   // elements are accessed directly as SMIs (without a check). On 64-bit | 
| 2067   // platforms, it is possible to have the top bits of "undefined" take | 2069   // platforms, it is possible to have the top bits of "undefined" take | 
| 2068   // small integer values (or zero), which are more likely to be equal to | 2070   // small integer values (or zero), which are more likely to be equal to | 
| 2069   // the signature index we check against. | 2071   // the signature index we check against. | 
| 2070   for (uint32_t i = table->size; i < table->max_size; ++i) { | 2072   for (uint32_t i = table->size; i < table->max_size; ++i) { | 
| 2071     values->set(i, Smi::FromInt(-1)); | 2073     values->set(i, Smi::FromInt(-1)); | 
| 2072   } | 2074   } | 
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2276   WasmCompiledModule* compiled_module = | 2278   WasmCompiledModule* compiled_module = | 
| 2277       WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); | 2279       WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); | 
| 2278   CHECK(compiled_module->has_weak_module_object()); | 2280   CHECK(compiled_module->has_weak_module_object()); | 
| 2279   CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); | 2281   CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); | 
| 2280 } | 2282 } | 
| 2281 | 2283 | 
| 2282 }  // namespace testing | 2284 }  // namespace testing | 
| 2283 }  // namespace wasm | 2285 }  // namespace wasm | 
| 2284 }  // namespace internal | 2286 }  // namespace internal | 
| 2285 }  // namespace v8 | 2287 }  // namespace v8 | 
| OLD | NEW | 
|---|