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

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

Issue 2284683005: [wasm] Use weak reference for wasm deopt data. (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/compiler/wasm-compiler.h" 9 #include "src/compiler/wasm-compiler.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 19 matching lines...) Expand all
30 Handle<JSObject> module_object; 30 Handle<JSObject> module_object;
31 31
32 { 32 {
33 // Get the module JSObject 33 // Get the module JSObject
34 DisallowHeapAllocation no_allocation; 34 DisallowHeapAllocation no_allocation;
35 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); 35 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top());
36 Address pc = 36 Address pc =
37 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); 37 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset);
38 Code* code = 38 Code* code =
39 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; 39 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
40 FixedArray* deopt_data = code->deoptimization_data(); 40 Object* undefined = *isolate->factory()->undefined_value();
41 DCHECK(deopt_data->length() == 2); 41 Object* owning_instance = wasm::GetOwningWasmInstance(undefined, code);
42 module_object = Handle<JSObject>::cast(handle(deopt_data->get(0), isolate)); 42 CHECK_NOT_NULL(owning_instance);
43 CHECK(!module_object->IsNull(isolate)); 43 CHECK_NE(owning_instance, undefined);
44 module_object = handle(JSObject::cast(owning_instance), isolate);
44 } 45 }
45 46
46 Address old_mem_start, new_mem_start; 47 Address old_mem_start, new_mem_start;
47 uint32_t old_size, new_size; 48 uint32_t old_size, new_size;
48 49
49 // Get mem buffer associated with module object 50 // Get mem buffer associated with module object
50 Handle<Object> obj(module_object->GetInternalField(kWasmMemArrayBuffer), 51 Handle<Object> obj(module_object->GetInternalField(kWasmMemArrayBuffer),
51 isolate); 52 isolate);
52 53
53 if (obj->IsUndefined(isolate)) { 54 if (obj->IsUndefined(isolate)) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 112 }
112 113
113 RUNTIME_FUNCTION(Runtime_WasmThrowTypeError) { 114 RUNTIME_FUNCTION(Runtime_WasmThrowTypeError) {
114 HandleScope scope(isolate); 115 HandleScope scope(isolate);
115 DCHECK_EQ(0, args.length()); 116 DCHECK_EQ(0, args.length());
116 THROW_NEW_ERROR_RETURN_FAILURE( 117 THROW_NEW_ERROR_RETURN_FAILURE(
117 isolate, NewTypeError(MessageTemplate::kWasmTrapTypeError)); 118 isolate, NewTypeError(MessageTemplate::kWasmTrapTypeError));
118 } 119 }
119 } // namespace internal 120 } // namespace internal
120 } // namespace v8 121 } // namespace v8
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | src/wasm/wasm-module.h » ('j') | src/wasm/wasm-module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698