OLD | NEW |
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/wasm/wasm-objects.h" | 5 #include "src/wasm/wasm-objects.h" |
6 #include "src/utils.h" | 6 #include "src/utils.h" |
7 | 7 |
8 #include "src/debug/debug-interface.h" | 8 #include "src/debug/debug-interface.h" |
9 #include "src/wasm/module-decoder.h" | 9 #include "src/wasm/module-decoder.h" |
10 #include "src/wasm/wasm-module.h" | 10 #include "src/wasm/wasm-module.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 uint32_t WasmTableObject::maximum_length() { | 179 uint32_t WasmTableObject::maximum_length() { |
180 return SafeUint32(GetInternalField(kMaximum)); | 180 return SafeUint32(GetInternalField(kMaximum)); |
181 } | 181 } |
182 | 182 |
183 WasmTableObject* WasmTableObject::cast(Object* object) { | 183 WasmTableObject* WasmTableObject::cast(Object* object) { |
184 DCHECK(object && object->IsJSObject()); | 184 DCHECK(object && object->IsJSObject()); |
185 // TODO(titzer): brand check for WasmTableObject. | 185 // TODO(titzer): brand check for WasmTableObject. |
186 return reinterpret_cast<WasmTableObject*>(object); | 186 return reinterpret_cast<WasmTableObject*>(object); |
187 } | 187 } |
188 | 188 |
| 189 void WasmTableObject::Grow(Isolate* isolate, Handle<WasmTableObject> table, |
| 190 uint32_t count) { |
| 191 Handle<FixedArray> dispatch_tables(table->dispatch_tables()); |
| 192 wasm::GrowDispatchTables(isolate, dispatch_tables, |
| 193 table->functions()->length(), count); |
| 194 } |
| 195 |
189 Handle<WasmMemoryObject> WasmMemoryObject::New(Isolate* isolate, | 196 Handle<WasmMemoryObject> WasmMemoryObject::New(Isolate* isolate, |
190 Handle<JSArrayBuffer> buffer, | 197 Handle<JSArrayBuffer> buffer, |
191 int maximum) { | 198 int maximum) { |
192 Handle<JSFunction> memory_ctor( | 199 Handle<JSFunction> memory_ctor( |
193 isolate->native_context()->wasm_memory_constructor()); | 200 isolate->native_context()->wasm_memory_constructor()); |
194 Handle<JSObject> memory_obj = | 201 Handle<JSObject> memory_obj = |
195 isolate->factory()->NewJSObject(memory_ctor, TENURED); | 202 isolate->factory()->NewJSObject(memory_ctor, TENURED); |
196 memory_obj->SetInternalField(kArrayBuffer, *buffer); | 203 memory_obj->SetInternalField(kArrayBuffer, *buffer); |
197 memory_obj->SetInternalField(kMaximum, | 204 memory_obj->SetInternalField(kMaximum, |
198 static_cast<Object*>(Smi::FromInt(maximum))); | 205 static_cast<Object*>(Smi::FromInt(maximum))); |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) | 847 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) |
841 return false; | 848 return false; |
842 return true; | 849 return true; |
843 } | 850 } |
844 | 851 |
845 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, | 852 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, |
846 Isolate* isolate) { | 853 Isolate* isolate) { |
847 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); | 854 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); |
848 set(kWrapperInstanceObject, *cell); | 855 set(kWrapperInstanceObject, *cell); |
849 } | 856 } |
OLD | NEW |