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/api-natives.h" | 5 #include "src/api-natives.h" |
6 #include "src/api.h" | 6 #include "src/api.h" |
7 #include "src/asmjs/asm-js.h" | 7 #include "src/asmjs/asm-js.h" |
8 #include "src/asmjs/asm-typer.h" | 8 #include "src/asmjs/asm-typer.h" |
9 #include "src/asmjs/asm-wasm-builder.h" | 9 #include "src/asmjs/asm-wasm-builder.h" |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 Handle<JSArrayBuffer> buffer) { | 903 Handle<JSArrayBuffer> buffer) { |
904 DCHECK(IsWasmMemoryObject(isolate, value)); | 904 DCHECK(IsWasmMemoryObject(isolate, value)); |
905 JSObject::cast(*value)->SetInternalField(kWasmMemoryBuffer, *buffer); | 905 JSObject::cast(*value)->SetInternalField(kWasmMemoryBuffer, *buffer); |
906 } | 906 } |
907 | 907 |
908 uint32_t WasmJs::GetWasmMemoryMaximumSize(Isolate* isolate, | 908 uint32_t WasmJs::GetWasmMemoryMaximumSize(Isolate* isolate, |
909 Handle<Object> value) { | 909 Handle<Object> value) { |
910 DCHECK(IsWasmMemoryObject(isolate, value)); | 910 DCHECK(IsWasmMemoryObject(isolate, value)); |
911 Object* max_mem = | 911 Object* max_mem = |
912 JSObject::cast(*value)->GetInternalField(kWasmMemoryMaximum); | 912 JSObject::cast(*value)->GetInternalField(kWasmMemoryMaximum); |
913 if (max_mem->IsUndefined(isolate)) return wasm::WasmModule::kV8MaxPages; | 913 if (max_mem->IsUndefined(isolate)) return 0; |
914 uint32_t max_pages = Smi::cast(max_mem)->value(); | 914 uint32_t max_pages = Smi::cast(max_mem)->value(); |
915 return max_pages; | 915 return max_pages; |
916 } | 916 } |
917 | 917 |
918 void WasmJs::SetWasmMemoryInstance(Isolate* isolate, | 918 void WasmJs::SetWasmMemoryInstance(Isolate* isolate, |
919 Handle<Object> memory_object, | 919 Handle<Object> memory_object, |
920 Handle<JSObject> instance) { | 920 Handle<JSObject> instance) { |
921 if (!memory_object->IsUndefined(isolate)) { | 921 if (!memory_object->IsUndefined(isolate)) { |
922 DCHECK(IsWasmMemoryObject(isolate, memory_object)); | 922 DCHECK(IsWasmMemoryObject(isolate, memory_object)); |
923 // TODO(gdeepti): This should be a weak list of instance objects | 923 // TODO(gdeepti): This should be a weak list of instance objects |
924 // for instances that share memory. | 924 // for instances that share memory. |
925 JSObject::cast(*memory_object) | 925 JSObject::cast(*memory_object) |
926 ->SetInternalField(kWasmMemoryInstanceObject, *instance); | 926 ->SetInternalField(kWasmMemoryInstanceObject, *instance); |
927 } | 927 } |
928 } | 928 } |
929 } // namespace internal | 929 } // namespace internal |
930 } // namespace v8 | 930 } // namespace v8 |
OLD | NEW |