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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 // Required to get M_E etc. in MSVC. | 7 // Required to get M_E etc. in MSVC. |
8 #if defined(_WIN32) | 8 #if defined(_WIN32) |
9 #define _USE_MATH_DEFINES | 9 #define _USE_MATH_DEFINES |
10 #endif | 10 #endif |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 ZoneHashMap::Entry* entry = | 775 ZoneHashMap::Entry* entry = |
776 function_tables_.Lookup(v, ComputePointerHash(v)); | 776 function_tables_.Lookup(v, ComputePointerHash(v)); |
777 if (entry == nullptr) { | 777 if (entry == nullptr) { |
778 return nullptr; | 778 return nullptr; |
779 } | 779 } |
780 return reinterpret_cast<FunctionTableIndices*>(entry->value); | 780 return reinterpret_cast<FunctionTableIndices*>(entry->value); |
781 } | 781 } |
782 | 782 |
783 void PopulateFunctionTable(VariableProxy* table, ArrayLiteral* funcs) { | 783 void PopulateFunctionTable(VariableProxy* table, ArrayLiteral* funcs) { |
784 FunctionTableIndices* indices = LookupFunctionTable(table->var()); | 784 FunctionTableIndices* indices = LookupFunctionTable(table->var()); |
785 DCHECK_NOT_NULL(indices); | 785 // Ignore unused function tables. |
| 786 if (indices == nullptr) { |
| 787 return; |
| 788 } |
786 for (int i = 0; i < funcs->values()->length(); ++i) { | 789 for (int i = 0; i < funcs->values()->length(); ++i) { |
787 VariableProxy* func = funcs->values()->at(i)->AsVariableProxy(); | 790 VariableProxy* func = funcs->values()->at(i)->AsVariableProxy(); |
788 DCHECK_NOT_NULL(func); | 791 DCHECK_NOT_NULL(func); |
789 builder_->SetIndirectFunction( | 792 builder_->SetIndirectFunction( |
790 indices->start_index + i, | 793 indices->start_index + i, |
791 LookupOrInsertFunction(func->var())->func_index()); | 794 LookupOrInsertFunction(func->var())->func_index()); |
792 } | 795 } |
793 } | 796 } |
794 | 797 |
795 class ImportedFunctionTable { | 798 class ImportedFunctionTable { |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer); | 1962 impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer); |
1960 return {module_buffer, asm_offsets_buffer, success}; | 1963 return {module_buffer, asm_offsets_buffer, success}; |
1961 } | 1964 } |
1962 | 1965 |
1963 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; | 1966 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; |
1964 const char* AsmWasmBuilder::single_function_name = "__single_function__"; | 1967 const char* AsmWasmBuilder::single_function_name = "__single_function__"; |
1965 | 1968 |
1966 } // namespace wasm | 1969 } // namespace wasm |
1967 } // namespace internal | 1970 } // namespace internal |
1968 } // namespace v8 | 1971 } // namespace v8 |
OLD | NEW |