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

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

Issue 2125793002: [runtime] Deprecate RUNTIME_ASSERT from WASM methods. (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 | no next file » | 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 CHECK(args[0]->ToUint32(&delta_pages));
25 Handle<JSObject> module_object; 25 Handle<JSObject> module_object;
26 26
27 { 27 {
28 // Get the module JSObject 28 // Get the module JSObject
29 DisallowHeapAllocation no_allocation; 29 DisallowHeapAllocation no_allocation;
30 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); 30 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top());
31 Address pc = 31 Address pc =
32 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); 32 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset);
33 Code* code = 33 Code* code =
34 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; 34 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
35 FixedArray* deopt_data = code->deoptimization_data(); 35 FixedArray* deopt_data = code->deoptimization_data();
36 DCHECK(deopt_data->length() == 2); 36 DCHECK(deopt_data->length() == 2);
37 module_object = Handle<JSObject>::cast(handle(deopt_data->get(0), isolate)); 37 module_object = Handle<JSObject>::cast(handle(deopt_data->get(0), isolate));
38 RUNTIME_ASSERT(!module_object->IsNull(isolate)); 38 CHECK(!module_object->IsNull(isolate));
39 } 39 }
40 40
41 Address old_mem_start, new_mem_start; 41 Address old_mem_start, new_mem_start;
42 uint32_t old_size, new_size; 42 uint32_t old_size, new_size;
43 const int kWasmMemArrayBuffer = 2; 43 const int kWasmMemArrayBuffer = 2;
44 44
45 // Get mem buffer associated with module object 45 // Get mem buffer associated with module object
46 Handle<Object> obj(module_object->GetInternalField(kWasmMemArrayBuffer), 46 Handle<Object> obj(module_object->GetInternalField(kWasmMemArrayBuffer),
47 isolate); 47 isolate);
48 48
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 memset(new_mem_start + old_size, 0, new_size - old_size); 96 memset(new_mem_start + old_size, 0, new_size - old_size);
97 } 97 }
98 98
99 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); 99 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
100 JSArrayBuffer::Setup(buffer, isolate, false, new_mem_start, new_size); 100 JSArrayBuffer::Setup(buffer, isolate, false, new_mem_start, new_size);
101 buffer->set_is_neuterable(false); 101 buffer->set_is_neuterable(false);
102 102
103 // Set new buffer to be wasm memory 103 // Set new buffer to be wasm memory
104 module_object->SetInternalField(kWasmMemArrayBuffer, *buffer); 104 module_object->SetInternalField(kWasmMemArrayBuffer, *buffer);
105 105
106 RUNTIME_ASSERT(wasm::UpdateWasmModuleMemory( 106 CHECK(wasm::UpdateWasmModuleMemory(module_object, old_mem_start,
107 module_object, old_mem_start, new_mem_start, old_size, new_size)); 107 new_mem_start, old_size, new_size));
108 108
109 return *isolate->factory()->NewNumberFromUint(old_size / 109 return *isolate->factory()->NewNumberFromUint(old_size /
110 wasm::WasmModule::kPageSize); 110 wasm::WasmModule::kPageSize);
111 } 111 }
112 112
113 } // namespace internal 113 } // namespace internal
114 } // namespace v8 114 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698