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

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

Issue 2111843002: [wasm] Fix receiver conversion for WASM->JS calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/mjsunit/wasm/import-table.js » ('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 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 desc = Linkage::GetStubCallDescriptor(isolate, graph()->zone(), 2598 desc = Linkage::GetStubCallDescriptor(isolate, graph()->zone(),
2599 callable.descriptor(), wasm_count + 1, 2599 callable.descriptor(), wasm_count + 1,
2600 CallDescriptor::kNoFlags); 2600 CallDescriptor::kNoFlags);
2601 arg_count_before_args = true; 2601 arg_count_before_args = true;
2602 } 2602 }
2603 2603
2604 args[pos++] = jsgraph()->Constant(function); // JS function. 2604 args[pos++] = jsgraph()->Constant(function); // JS function.
2605 if (arg_count_before_args) { 2605 if (arg_count_before_args) {
2606 args[pos++] = jsgraph()->Int32Constant(wasm_count); // argument count 2606 args[pos++] = jsgraph()->Int32Constant(wasm_count); // argument count
2607 } 2607 }
2608 // JS receiver. 2608 // Create the receiver constant (either undefined or the global proxy).
2609 Handle<Object> global(function->context()->global_object(), isolate); 2609 Handle<Object> receiver(isolate->heap()->undefined_value(), isolate);
2610 args[pos++] = jsgraph()->Constant(global); 2610 if (is_sloppy(function->shared()->language_mode())) {
2611 receiver = Handle<Object>(function->context()->global_proxy(), isolate);
2612 }
2613 args[pos++] = jsgraph()->Constant(receiver);
2611 2614
2612 // Convert WASM numbers to JS values. 2615 // Convert WASM numbers to JS values.
2613 int param_index = 0; 2616 int param_index = 0;
2614 for (int i = 0; i < wasm_count; ++i) { 2617 for (int i = 0; i < wasm_count; ++i) {
2615 Node* param = 2618 Node* param =
2616 graph()->NewNode(jsgraph()->common()->Parameter(param_index++), start); 2619 graph()->NewNode(jsgraph()->common()->Parameter(param_index++), start);
2617 args[pos++] = ToJS(param, context, sig->GetParam(i)); 2620 args[pos++] = ToJS(param, context, sig->GetParam(i));
2618 if (jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kAstI64) { 2621 if (jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kAstI64) {
2619 // On 32 bit platforms we have to skip the high word of int64 parameters. 2622 // On 32 bit platforms we have to skip the high word of int64 parameters.
2620 param_index++; 2623 param_index++;
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
3459 function_->code_start_offset), 3462 function_->code_start_offset),
3460 compile_ms); 3463 compile_ms);
3461 } 3464 }
3462 3465
3463 return code; 3466 return code;
3464 } 3467 }
3465 3468
3466 } // namespace compiler 3469 } // namespace compiler
3467 } // namespace internal 3470 } // namespace internal
3468 } // namespace v8 3471 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/wasm/import-table.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698