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 2403093002: [wasm] Canonicalize function signature indices for matching in indirect calls. (Closed)
Patch Set: Address review comments 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 | « src/api.cc ('k') | src/v8.gyp » ('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 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 ElementAccess access = AccessBuilder::ForFixedArrayElement(); 2141 ElementAccess access = AccessBuilder::ForFixedArrayElement();
2142 const int fixed_offset = access.header_size - access.tag(); 2142 const int fixed_offset = access.header_size - access.tag();
2143 { 2143 {
2144 Node* load_sig = graph()->NewNode( 2144 Node* load_sig = graph()->NewNode(
2145 machine->Load(MachineType::AnyTagged()), table, 2145 machine->Load(MachineType::AnyTagged()), table,
2146 graph()->NewNode(machine->Int32Add(), 2146 graph()->NewNode(machine->Int32Add(),
2147 graph()->NewNode(machine->Word32Shl(), key, 2147 graph()->NewNode(machine->Word32Shl(), key,
2148 Int32Constant(kPointerSizeLog2)), 2148 Int32Constant(kPointerSizeLog2)),
2149 Int32Constant(fixed_offset)), 2149 Int32Constant(fixed_offset)),
2150 *effect_, *control_); 2150 *effect_, *control_);
2151 int32_t key = module_->module->function_tables[0].map.Find(sig);
2152 DCHECK_GE(key, 0);
2151 Node* sig_match = 2153 Node* sig_match =
2152 graph()->NewNode(machine->Word32Equal(), 2154 graph()->NewNode(machine->Word32Equal(),
2153 BuildChangeSmiToInt32(load_sig), Int32Constant(index)); 2155 BuildChangeSmiToInt32(load_sig), Int32Constant(key));
2154 trap_->AddTrapIfFalse(wasm::kTrapFuncSigMismatch, sig_match, position); 2156 trap_->AddTrapIfFalse(wasm::kTrapFuncSigMismatch, sig_match, position);
2155 } 2157 }
2156 2158
2157 // Load code object from the table. 2159 // Load code object from the table.
2158 uint32_t offset = fixed_offset + kPointerSize * table_size; 2160 uint32_t offset = fixed_offset + kPointerSize * table_size;
2159 Node* load_code = graph()->NewNode( 2161 Node* load_code = graph()->NewNode(
2160 machine->Load(MachineType::AnyTagged()), table, 2162 machine->Load(MachineType::AnyTagged()), table,
2161 graph()->NewNode(machine->Int32Add(), 2163 graph()->NewNode(machine->Int32Add(),
2162 graph()->NewNode(machine->Word32Shl(), key, 2164 graph()->NewNode(machine->Word32Shl(), key,
2163 Int32Constant(kPointerSizeLog2)), 2165 Int32Constant(kPointerSizeLog2)),
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 function_->code_start_offset), 3409 function_->code_start_offset),
3408 compile_ms); 3410 compile_ms);
3409 } 3411 }
3410 3412
3411 return code; 3413 return code;
3412 } 3414 }
3413 3415
3414 } // namespace compiler 3416 } // namespace compiler
3415 } // namespace internal 3417 } // namespace internal
3416 } // namespace v8 3418 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698