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

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

Issue 2760603002: Revert of MIPS[64]: Fix unaligned arguments storage in Wasm-to-interpreter entry (Closed)
Patch Set: Fix Created 3 years, 9 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 | src/utils.h » ('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/assembler-inl.h" 9 #include "src/assembler-inl.h"
10 #include "src/base/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 : Int64Lowering::GetParameterCountAfterLowering(sig); 2916 : Int64Lowering::GetParameterCountAfterLowering(sig);
2917 2917
2918 // Build the start and the parameter nodes. 2918 // Build the start and the parameter nodes.
2919 Node* start = Start(param_count + 3); 2919 Node* start = Start(param_count + 3);
2920 *effect_ = start; 2920 *effect_ = start;
2921 *control_ = start; 2921 *control_ = start;
2922 2922
2923 // Compute size for the argument buffer. 2923 // Compute size for the argument buffer.
2924 int args_size_bytes = 0; 2924 int args_size_bytes = 0;
2925 for (int i = 0; i < wasm_count; i++) { 2925 for (int i = 0; i < wasm_count; i++) {
2926 args_size_bytes += 2926 args_size_bytes += 1 << ElementSizeLog2Of(sig->GetParam(i));
2927 RoundUpToMultipleOfPowOf2(1 << ElementSizeLog2Of(sig->GetParam(i)), 8);
2928 } 2927 }
2929 2928
2930 // The return value is also passed via this buffer: 2929 // The return value is also passed via this buffer:
2931 DCHECK_GE(wasm::kV8MaxWasmFunctionReturns, sig->return_count()); 2930 DCHECK_GE(wasm::kV8MaxWasmFunctionReturns, sig->return_count());
2932 // TODO(wasm): Handle multi-value returns. 2931 // TODO(wasm): Handle multi-value returns.
2933 DCHECK_EQ(1, wasm::kV8MaxWasmFunctionReturns); 2932 DCHECK_EQ(1, wasm::kV8MaxWasmFunctionReturns);
2934 int return_size_bytes = 2933 int return_size_bytes =
2935 sig->return_count() == 0 ? 0 : 1 << ElementSizeLog2Of(sig->GetReturn(0)); 2934 sig->return_count() == 0 ? 0 : 1 << ElementSizeLog2Of(sig->GetReturn(0));
2936 2935
2937 // Get a stack slot for the arguments. 2936 // Get a stack slot for the arguments.
(...skipping 24 matching lines...) Expand all
2962 param, *effect_, *control_); 2961 param, *effect_, *control_);
2963 offset += 8; 2962 offset += 8;
2964 2963
2965 } else { 2964 } else {
2966 MachineRepresentation param_rep = sig->GetParam(i); 2965 MachineRepresentation param_rep = sig->GetParam(i);
2967 StoreRepresentation store_rep(param_rep, 2966 StoreRepresentation store_rep(param_rep,
2968 WriteBarrierKind::kNoWriteBarrier); 2967 WriteBarrierKind::kNoWriteBarrier);
2969 *effect_ = 2968 *effect_ =
2970 graph()->NewNode(jsgraph()->machine()->Store(store_rep), arg_buffer, 2969 graph()->NewNode(jsgraph()->machine()->Store(store_rep), arg_buffer,
2971 Int32Constant(offset), param, *effect_, *control_); 2970 Int32Constant(offset), param, *effect_, *control_);
2972 offset += RoundUpToMultipleOfPowOf2(1 << ElementSizeLog2Of(param_rep), 8); 2971 offset += 1 << ElementSizeLog2Of(param_rep);
2973 } 2972 }
2974
2975 DCHECK(IsAligned(offset, 8));
2976 } 2973 }
2977 DCHECK_EQ(param_count, param_index); 2974 DCHECK_EQ(param_count, param_index);
2978 DCHECK_EQ(args_size_bytes, offset); 2975 DCHECK_EQ(args_size_bytes, offset);
2979 2976
2980 // We are passing the raw arg_buffer here. To the GC and other parts, it looks 2977 // We are passing the raw arg_buffer here. To the GC and other parts, it looks
2981 // like a Smi (lowest bit not set). In the runtime function however, don't 2978 // like a Smi (lowest bit not set). In the runtime function however, don't
2982 // call Smi::value on it, but just cast it to a byte pointer. 2979 // call Smi::value on it, but just cast it to a byte pointer.
2983 Node* parameters[] = { 2980 Node* parameters[] = {
2984 jsgraph()->HeapConstant(instance), // wasm instance 2981 jsgraph()->HeapConstant(instance), // wasm instance
2985 jsgraph()->SmiConstant(function_index), // function index 2982 jsgraph()->SmiConstant(function_index), // function index
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
3943 3940
3944 Handle<Code> CompileWasmInterpreterEntry(Isolate* isolate, uint32_t func_index, 3941 Handle<Code> CompileWasmInterpreterEntry(Isolate* isolate, uint32_t func_index,
3945 wasm::FunctionSig* sig, 3942 wasm::FunctionSig* sig,
3946 Handle<WasmInstanceObject> instance) { 3943 Handle<WasmInstanceObject> instance) {
3947 //---------------------------------------------------------------------------- 3944 //----------------------------------------------------------------------------
3948 // Create the Graph 3945 // Create the Graph
3949 //---------------------------------------------------------------------------- 3946 //----------------------------------------------------------------------------
3950 Zone zone(isolate->allocator(), ZONE_NAME); 3947 Zone zone(isolate->allocator(), ZONE_NAME);
3951 Graph graph(&zone); 3948 Graph graph(&zone);
3952 CommonOperatorBuilder common(&zone); 3949 CommonOperatorBuilder common(&zone);
3953 MachineOperatorBuilder machine( 3950 MachineOperatorBuilder machine(&zone);
3954 &zone, MachineType::PointerRepresentation(),
3955 InstructionSelector::SupportedMachineOperatorFlags(),
3956 InstructionSelector::AlignmentRequirements());
3957 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); 3951 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine);
3958 3952
3959 Node* control = nullptr; 3953 Node* control = nullptr;
3960 Node* effect = nullptr; 3954 Node* effect = nullptr;
3961 3955
3962 WasmGraphBuilder builder(nullptr, &zone, &jsgraph, sig); 3956 WasmGraphBuilder builder(nullptr, &zone, &jsgraph, sig);
3963 builder.set_control_ptr(&control); 3957 builder.set_control_ptr(&control);
3964 builder.set_effect_ptr(&effect); 3958 builder.set_effect_ptr(&effect);
3965 builder.BuildWasmInterpreterEntry(func_index, sig, instance); 3959 builder.BuildWasmInterpreterEntry(func_index, sig, instance);
3966 3960
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
4200 wasm::ErrorThrower* thrower, Isolate* isolate, 4194 wasm::ErrorThrower* thrower, Isolate* isolate,
4201 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { 4195 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) {
4202 WasmCompilationUnit unit(isolate, module_env, function); 4196 WasmCompilationUnit unit(isolate, module_env, function);
4203 unit.ExecuteCompilation(); 4197 unit.ExecuteCompilation();
4204 return unit.FinishCompilation(thrower); 4198 return unit.FinishCompilation(thrower);
4205 } 4199 }
4206 4200
4207 } // namespace compiler 4201 } // namespace compiler
4208 } // namespace internal 4202 } // namespace internal
4209 } // namespace v8 4203 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698