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

Unified Diff: src/wasm/wasm-debug.cc

Issue 2591653002: [wasm] Introduce WasmSharedModuleData and refactor other objects (Closed)
Patch Set: Fix SLOW_DCHECK Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/value-serializer.cc ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-debug.cc
diff --git a/src/wasm/wasm-debug.cc b/src/wasm/wasm-debug.cc
index 27b43017493e67b8dc71f582b5253c9024cad6c1..0fe0ae98a7883697c2a724140d829283bab3d627 100644
--- a/src/wasm/wasm-debug.cc
+++ b/src/wasm/wasm-debug.cc
@@ -13,33 +13,11 @@
using namespace v8::internal;
using namespace v8::internal::wasm;
-namespace {
-
-enum {
- kWasmDebugInfoWasmObj,
- kWasmDebugInfoWasmBytesHash,
- kWasmDebugInfoAsmJsOffsets,
- kWasmDebugInfoNumEntries
-};
-
-} // namespace
-
Handle<WasmDebugInfo> WasmDebugInfo::New(Handle<WasmInstanceObject> instance) {
Isolate *isolate = instance->GetIsolate();
Factory *factory = isolate->factory();
- Handle<FixedArray> arr =
- factory->NewFixedArray(kWasmDebugInfoNumEntries, TENURED);
- arr->set(kWasmDebugInfoWasmObj, *instance);
- int hash = 0;
- Handle<SeqOneByteString> wasm_bytes =
- instance->get_compiled_module()->module_bytes();
- {
- DisallowHeapAllocation no_gc;
- hash = StringHasher::HashSequentialString(
- wasm_bytes->GetChars(), wasm_bytes->length(), kZeroHashSeed);
- }
- Handle<Object> hash_obj = factory->NewNumberFromInt(hash, TENURED);
- arr->set(kWasmDebugInfoWasmBytesHash, *hash_obj);
+ Handle<FixedArray> arr = factory->NewFixedArray(kFieldCount, TENURED);
+ arr->set(kInstance, *instance);
return Handle<WasmDebugInfo>::cast(arr);
}
@@ -47,9 +25,7 @@ Handle<WasmDebugInfo> WasmDebugInfo::New(Handle<WasmInstanceObject> instance) {
bool WasmDebugInfo::IsDebugInfo(Object *object) {
if (!object->IsFixedArray()) return false;
FixedArray *arr = FixedArray::cast(object);
- return arr->length() == kWasmDebugInfoNumEntries &&
- IsWasmInstance(arr->get(kWasmDebugInfoWasmObj)) &&
- arr->get(kWasmDebugInfoWasmBytesHash)->IsNumber();
+ return arr->length() == kFieldCount && IsWasmInstance(arr->get(kInstance));
}
WasmDebugInfo *WasmDebugInfo::cast(Object *object) {
@@ -58,5 +34,5 @@ WasmDebugInfo *WasmDebugInfo::cast(Object *object) {
}
WasmInstanceObject *WasmDebugInfo::wasm_instance() {
- return WasmInstanceObject::cast(get(kWasmDebugInfoWasmObj));
+ return WasmInstanceObject::cast(get(kInstance));
}
« no previous file with comments | « src/value-serializer.cc ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698