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/compiler/wasm-compiler.h" | 5 #include "src/compiler/wasm-compiler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 | 10 |
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 ElementAccess access = AccessBuilder::ForFixedArrayElement(); | 2169 ElementAccess access = AccessBuilder::ForFixedArrayElement(); |
2170 const int fixed_offset = access.header_size - access.tag(); | 2170 const int fixed_offset = access.header_size - access.tag(); |
2171 { | 2171 { |
2172 Node* load_sig = graph()->NewNode( | 2172 Node* load_sig = graph()->NewNode( |
2173 machine->Load(MachineType::AnyTagged()), table, | 2173 machine->Load(MachineType::AnyTagged()), table, |
2174 graph()->NewNode(machine->Int32Add(), | 2174 graph()->NewNode(machine->Int32Add(), |
2175 graph()->NewNode(machine->Word32Shl(), key, | 2175 graph()->NewNode(machine->Word32Shl(), key, |
2176 Int32Constant(kPointerSizeLog2)), | 2176 Int32Constant(kPointerSizeLog2)), |
2177 Int32Constant(fixed_offset)), | 2177 Int32Constant(fixed_offset)), |
2178 *effect_, *control_); | 2178 *effect_, *control_); |
2179 int32_t key = module_->module->function_tables[0].map.Find(sig); | 2179 auto map = const_cast<wasm::SignatureMap&>( |
2180 DCHECK_GE(key, 0); | 2180 module_->module->function_tables[0].map); |
2181 Node* sig_match = graph()->NewNode(machine->WordEqual(), load_sig, | 2181 Node* sig_match = graph()->NewNode( |
2182 jsgraph()->SmiConstant(key)); | 2182 machine->WordEqual(), load_sig, |
| 2183 jsgraph()->SmiConstant(static_cast<int>(map.FindOrInsert(sig)))); |
2183 trap_->AddTrapIfFalse(wasm::kTrapFuncSigMismatch, sig_match, position); | 2184 trap_->AddTrapIfFalse(wasm::kTrapFuncSigMismatch, sig_match, position); |
2184 } | 2185 } |
2185 | 2186 |
2186 // Load code object from the table. | 2187 // Load code object from the table. |
2187 uint32_t offset = fixed_offset + kPointerSize * table_size; | 2188 uint32_t offset = fixed_offset + kPointerSize * table_size; |
2188 Node* load_code = graph()->NewNode( | 2189 Node* load_code = graph()->NewNode( |
2189 machine->Load(MachineType::AnyTagged()), table, | 2190 machine->Load(MachineType::AnyTagged()), table, |
2190 graph()->NewNode(machine->Int32Add(), | 2191 graph()->NewNode(machine->Int32Add(), |
2191 graph()->NewNode(machine->Word32Shl(), key, | 2192 graph()->NewNode(machine->Word32Shl(), key, |
2192 Int32Constant(kPointerSizeLog2)), | 2193 Int32Constant(kPointerSizeLog2)), |
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3458 function_->code_start_offset), | 3459 function_->code_start_offset), |
3459 compile_ms); | 3460 compile_ms); |
3460 } | 3461 } |
3461 | 3462 |
3462 return code; | 3463 return code; |
3463 } | 3464 } |
3464 | 3465 |
3465 } // namespace compiler | 3466 } // namespace compiler |
3466 } // namespace internal | 3467 } // namespace internal |
3467 } // namespace v8 | 3468 } // namespace v8 |
OLD | NEW |