Chromium Code Reviews

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

Issue 2471883003: [wasm] WebAssembly.Memory object can be referenced by multiple Instance objects. (Closed)
Patch Set: Rebase, add Dcheck Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | src/wasm/wasm-js.h » ('j') | src/wasm/wasm-js.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39 matching lines...)
50 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); 50 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top());
51 Address pc = 51 Address pc =
52 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); 52 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset);
53 Code* code = 53 Code* code =
54 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; 54 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
55 Object* owning_instance = wasm::GetOwningWasmInstance(code); 55 Object* owning_instance = wasm::GetOwningWasmInstance(code);
56 CHECK_NOT_NULL(owning_instance); 56 CHECK_NOT_NULL(owning_instance);
57 module_instance = handle(JSObject::cast(owning_instance), isolate); 57 module_instance = handle(JSObject::cast(owning_instance), isolate);
58 } 58 }
59 return *isolate->factory()->NewNumberFromInt( 59 return *isolate->factory()->NewNumberFromInt(
60 wasm::GrowInstanceMemory(isolate, module_instance, delta_pages)); 60 wasm::GrowMemory(isolate, module_instance, delta_pages));
61 } 61 }
62 62
63 RUNTIME_FUNCTION(Runtime_WasmThrowTypeError) { 63 RUNTIME_FUNCTION(Runtime_WasmThrowTypeError) {
64 HandleScope scope(isolate); 64 HandleScope scope(isolate);
65 DCHECK_EQ(0, args.length()); 65 DCHECK_EQ(0, args.length());
66 THROW_NEW_ERROR_RETURN_FAILURE( 66 THROW_NEW_ERROR_RETURN_FAILURE(
67 isolate, NewTypeError(MessageTemplate::kWasmTrapTypeError)); 67 isolate, NewTypeError(MessageTemplate::kWasmTrapTypeError));
68 } 68 }
69 69
70 RUNTIME_FUNCTION(Runtime_WasmThrow) { 70 RUNTIME_FUNCTION(Runtime_WasmThrow) {
(...skipping 13 matching lines...)
84 Object* exception = args[0]; 84 Object* exception = args[0];
85 // The unwinder will only deliver exceptions to wasm if the exception is a 85 // The unwinder will only deliver exceptions to wasm if the exception is a
86 // Number or a Smi (which we have just converted to a Number.) This logic 86 // Number or a Smi (which we have just converted to a Number.) This logic
87 // lives in Isolate::is_catchable_by_wasm(Object*). 87 // lives in Isolate::is_catchable_by_wasm(Object*).
88 CHECK(exception->IsNumber()); 88 CHECK(exception->IsNumber());
89 return exception; 89 return exception;
90 } 90 }
91 91
92 } // namespace internal 92 } // namespace internal
93 } // namespace v8 93 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-js.h » ('j') | src/wasm/wasm-js.h » ('J')

Powered by Google App Engine