Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 2439613003: [wasm] Fix canonicalization bug for function signatures in CallIndirect. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698