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

Side by Side Diff: src/wasm/wasm-module.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: Fix tests 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 | « src/wasm/wasm-module.h ('k') | test/mjsunit/mjsunit.status » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/base/atomic-utils.h" 5 #include "src/base/atomic-utils.h"
6 #include "src/macro-assembler.h" 6 #include "src/macro-assembler.h"
7 #include "src/objects.h" 7 #include "src/objects.h"
8 #include "src/property-descriptor.h" 8 #include "src/property-descriptor.h"
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 } 1261 }
1262 1262
1263 WasmDebugInfo* GetDebugInfo(JSObject* wasm) { 1263 WasmDebugInfo* GetDebugInfo(JSObject* wasm) {
1264 Object* info = wasm->GetInternalField(kWasmDebugInfo); 1264 Object* info = wasm->GetInternalField(kWasmDebugInfo);
1265 if (!info->IsUndefined(wasm->GetIsolate())) return WasmDebugInfo::cast(info); 1265 if (!info->IsUndefined(wasm->GetIsolate())) return WasmDebugInfo::cast(info);
1266 Handle<WasmDebugInfo> new_info = WasmDebugInfo::New(handle(wasm)); 1266 Handle<WasmDebugInfo> new_info = WasmDebugInfo::New(handle(wasm));
1267 wasm->SetInternalField(kWasmDebugInfo, *new_info); 1267 wasm->SetInternalField(kWasmDebugInfo, *new_info);
1268 return *new_info; 1268 return *new_info;
1269 } 1269 }
1270 1270
1271 bool UpdateWasmModuleMemory(JSObject* object, Address old_start, 1271 bool UpdateWasmModuleMemory(Handle<JSObject> object, Address old_start,
1272 Address new_start, uint32_t old_size, 1272 Address new_start, uint32_t old_size,
1273 uint32_t new_size) { 1273 uint32_t new_size) {
1274 if (!IsWasmObject(object)) { 1274 DisallowHeapAllocation no_allocation;
1275 if (!IsWasmObject(*object)) {
1275 return false; 1276 return false;
1276 } 1277 }
1277 1278
1278 // Get code table associated with the module js_object 1279 // Get code table associated with the module js_object
1279 Object* obj = object->GetInternalField(kWasmModuleCodeTable); 1280 Object* obj = object->GetInternalField(kWasmModuleCodeTable);
1280 Handle<FixedArray> code_table(FixedArray::cast(obj)); 1281 Handle<FixedArray> code_table(FixedArray::cast(obj));
1281 1282
1282 // Iterate through the code objects in the code table and update relocation 1283 // Iterate through the code objects in the code table and update relocation
1283 // information 1284 // information
1284 for (int i = 0; i < code_table->length(); i++) { 1285 for (int i = 0; i < code_table->length(); i++) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); 1369 return static_cast<int32_t>(HeapNumber::cast(*result)->value());
1369 } 1370 }
1370 thrower.Error("WASM.compileRun() failed: Return value should be number"); 1371 thrower.Error("WASM.compileRun() failed: Return value should be number");
1371 return -1; 1372 return -1;
1372 } 1373 }
1373 1374
1374 } // namespace testing 1375 } // namespace testing
1375 } // namespace wasm 1376 } // namespace wasm
1376 } // namespace internal 1377 } // namespace internal
1377 } // namespace v8 1378 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698