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

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

Issue 2105013004: Explicitly Disallow heap allocation when wasm memory references are updated (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 | src/wasm/wasm-module.h » ('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 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/conversions.h" 9 #include "src/conversions.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
11 #include "src/factory.h" 11 #include "src/factory.h"
12 #include "src/frames-inl.h" 12 #include "src/frames-inl.h"
13 #include "src/objects-inl.h" 13 #include "src/objects-inl.h"
14 #include "src/v8memory.h" 14 #include "src/v8memory.h"
15 #include "src/wasm/wasm-module.h" 15 #include "src/wasm/wasm-module.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 19
20 RUNTIME_FUNCTION(Runtime_WasmGrowMemory) { 20 RUNTIME_FUNCTION(Runtime_WasmGrowMemory) {
21 HandleScope scope(isolate); 21 HandleScope scope(isolate);
22 DCHECK_EQ(1, args.length()); 22 DCHECK_EQ(1, args.length());
23 uint32_t delta_pages = 0; 23 uint32_t delta_pages = 0;
24 RUNTIME_ASSERT(args[0]->ToUint32(&delta_pages)); 24 RUNTIME_ASSERT(args[0]->ToUint32(&delta_pages));
25 25
26 // Get the module JSObject 26 // Get the module JSObject
27 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); 27 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top());
28 Address pc = 28 Address pc =
29 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); 29 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset);
30 Code* code = isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; 30 Code* code = isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
ahaas 2016/06/29 07:13:31 Use also "the DisallowHeapAllocation no_allocation
gdeepti 2016/06/29 23:38:38 Thanks for clarifying that, used "DisallowHeapAllo
31 FixedArray* deopt_data = code->deoptimization_data(); 31 FixedArray* deopt_data = code->deoptimization_data();
32 DCHECK(deopt_data->length() == 2); 32 DCHECK(deopt_data->length() == 2);
33 JSObject* module_object = JSObject::cast(deopt_data->get(0)); 33 Handle<JSObject> module_object(JSObject::cast(deopt_data->get(0)));
34 RUNTIME_ASSERT(!module_object->IsNull(isolate)); 34 RUNTIME_ASSERT(!module_object->IsNull(isolate));
35 35
36 Address old_mem_start, new_mem_start; 36 Address old_mem_start, new_mem_start;
37 uint32_t old_size, new_size; 37 uint32_t old_size, new_size;
38 const int kWasmMemArrayBuffer = 2; 38 const int kWasmMemArrayBuffer = 2;
39 39
40 // Get mem buffer associated with module object 40 // Get mem buffer associated with module object
41 Object* obj = module_object->GetInternalField(kWasmMemArrayBuffer); 41 Object* obj = module_object->GetInternalField(kWasmMemArrayBuffer);
42 42
43 if (obj->IsUndefined(isolate)) { 43 if (obj->IsUndefined(isolate)) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 RUNTIME_ASSERT(wasm::UpdateWasmModuleMemory( 101 RUNTIME_ASSERT(wasm::UpdateWasmModuleMemory(
102 module_object, old_mem_start, new_mem_start, old_size, new_size)); 102 module_object, old_mem_start, new_mem_start, old_size, new_size));
103 103
104 return *isolate->factory()->NewNumberFromUint(old_size / 104 return *isolate->factory()->NewNumberFromUint(old_size /
105 wasm::WasmModule::kPageSize); 105 wasm::WasmModule::kPageSize);
106 } 106 }
107 107
108 } // namespace internal 108 } // namespace internal
109 } // namespace v8 109 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698