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 2094573002: [wasm] Cleaning up code (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/wasm/asm-wasm-builder.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 "src/isolate-inl.h" 7 #include "src/isolate-inl.h"
8 8
9 #include "src/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 2344 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 // Create the context parameter 2355 // Create the context parameter
2356 Node* context = graph()->NewNode( 2356 Node* context = graph()->NewNode(
2357 jsgraph()->common()->Parameter( 2357 jsgraph()->common()->Parameter(
2358 Linkage::GetJSCallContextParamIndex(wasm_count + 1), "%context"), 2358 Linkage::GetJSCallContextParamIndex(wasm_count + 1), "%context"),
2359 graph()->start()); 2359 graph()->start());
2360 2360
2361 int pos = 0; 2361 int pos = 0;
2362 args[pos++] = HeapConstant(wasm_code); 2362 args[pos++] = HeapConstant(wasm_code);
2363 2363
2364 // Convert JS parameters to WASM numbers. 2364 // Convert JS parameters to WASM numbers.
2365 for (int i = 0; i < wasm_count; i++) { 2365 for (int i = 0; i < wasm_count; ++i) {
2366 Node* param = 2366 Node* param =
2367 graph()->NewNode(jsgraph()->common()->Parameter(i + 1), start); 2367 graph()->NewNode(jsgraph()->common()->Parameter(i + 1), start);
2368 Node* wasm_param = FromJS(param, context, sig->GetParam(i)); 2368 Node* wasm_param = FromJS(param, context, sig->GetParam(i));
2369 args[pos++] = wasm_param; 2369 args[pos++] = wasm_param;
2370 if (jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kAstI64) { 2370 if (jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kAstI64) {
2371 // We make up the high word with SAR to get the proper sign extension. 2371 // We make up the high word with SAR to get the proper sign extension.
2372 args[pos++] = graph()->NewNode(jsgraph()->machine()->Word32Sar(), 2372 args[pos++] = graph()->NewNode(jsgraph()->machine()->Word32Sar(),
2373 wasm_param, jsgraph()->Int32Constant(31)); 2373 wasm_param, jsgraph()->Int32Constant(31));
2374 } 2374 }
2375 } 2375 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 args[pos++] = jsgraph()->Constant(function); // JS function. 2444 args[pos++] = jsgraph()->Constant(function); // JS function.
2445 if (arg_count_before_args) { 2445 if (arg_count_before_args) {
2446 args[pos++] = jsgraph()->Int32Constant(wasm_count); // argument count 2446 args[pos++] = jsgraph()->Int32Constant(wasm_count); // argument count
2447 } 2447 }
2448 // JS receiver. 2448 // JS receiver.
2449 Handle<Object> global(function->context()->global_object(), isolate); 2449 Handle<Object> global(function->context()->global_object(), isolate);
2450 args[pos++] = jsgraph()->Constant(global); 2450 args[pos++] = jsgraph()->Constant(global);
2451 2451
2452 // Convert WASM numbers to JS values. 2452 // Convert WASM numbers to JS values.
2453 int param_index = 0; 2453 int param_index = 0;
2454 for (int i = 0; i < wasm_count; i++) { 2454 for (int i = 0; i < wasm_count; ++i) {
2455 Node* param = 2455 Node* param =
2456 graph()->NewNode(jsgraph()->common()->Parameter(param_index++), start); 2456 graph()->NewNode(jsgraph()->common()->Parameter(param_index++), start);
2457 args[pos++] = ToJS(param, context, sig->GetParam(i)); 2457 args[pos++] = ToJS(param, context, sig->GetParam(i));
2458 if (jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kAstI64) { 2458 if (jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kAstI64) {
2459 // On 32 bit platforms we have to skip the high word of int64 parameters. 2459 // On 32 bit platforms we have to skip the high word of int64 parameters.
2460 param_index++; 2460 param_index++;
2461 } 2461 }
2462 } 2462 }
2463 2463
2464 if (add_new_target_undefined) { 2464 if (add_new_target_undefined) {
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 function_->code_start_offset), 3270 function_->code_start_offset),
3271 compile_ms); 3271 compile_ms);
3272 } 3272 }
3273 3273
3274 return code; 3274 return code;
3275 } 3275 }
3276 3276
3277 } // namespace compiler 3277 } // namespace compiler
3278 } // namespace internal 3278 } // namespace internal
3279 } // namespace v8 3279 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/asm-wasm-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698