Commit 250911ba authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Fix confusingly named variables

... and fix comments which I accidentally changed back to an old version
in https://crrev.com/c/2011086/.

R=jkummerow@chromium.org

Bug: chromium:667678
Change-Id: I2a801d9775bd2362290c5d1caaf5b9e24a9bd54d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2015241
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65968}
parent 2dcdd512
......@@ -410,9 +410,9 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
}
wasm::ErrorThrower thrower(isolate, "AsmJs::Instantiate");
MaybeHandle<Object> maybe_module_object =
MaybeHandle<WasmInstanceObject> maybe_instance =
wasm_engine->SyncInstantiate(isolate, &thrower, module, foreign, memory);
if (maybe_module_object.is_null()) {
if (maybe_instance.is_null()) {
// An exception caused by the module start function will be set as pending
// and bypass the {ErrorThrower}, this happens in case of a stack overflow.
if (isolate->has_pending_exception()) isolate->clear_pending_exception();
......@@ -427,7 +427,7 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
return MaybeHandle<Object>();
}
DCHECK(!thrower.error());
Handle<Object> module_object = maybe_module_object.ToHandleChecked();
Handle<WasmInstanceObject> instance = maybe_instance.ToHandleChecked();
ReportInstantiationSuccess(script, position,
instantiate_timer.Elapsed().InMillisecondsF());
......@@ -435,7 +435,7 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
Handle<Name> single_function_name(
isolate->factory()->InternalizeUtf8String(AsmJs::kSingleFunctionName));
MaybeHandle<Object> single_function =
Object::GetProperty(isolate, module_object, single_function_name);
Object::GetProperty(isolate, instance, single_function_name);
if (!single_function.is_null() &&
!single_function.ToHandleChecked()->IsUndefined(isolate)) {
return single_function;
......@@ -443,7 +443,7 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
Handle<String> exports_name =
isolate->factory()->InternalizeUtf8String("exports");
return Object::GetProperty(isolate, module_object, exports_name);
return Object::GetProperty(isolate, instance, exports_name);
}
} // namespace internal
......
......@@ -597,13 +597,14 @@ int GetSourcePosition(const WasmModule* module, uint32_t func_index,
DCHECK_EQ(is_asmjs_module(module),
module->asm_js_offset_information != nullptr);
if (!is_asmjs_module(module)) {
// for non-asm.js modules, we just add the function's start offset
// For non-asm.js modules, we just add the function's start offset
// to make a module-relative position.
return byte_offset + GetWasmFunctionOffset(module, func_index);
}
// asm.js modules have an additional offset table that must be searched.
// The passed func_index excludes imported functions.
// Note: {AsmJsOffsetInformation::GetSourcePosition} expects the function
// index relative to the first non-imported function.
DCHECK_LE(module->num_imported_functions, func_index);
return module->asm_js_offset_information->GetSourcePosition(
func_index - module->num_imported_functions, byte_offset,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment