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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // There has been an exception, just return. | 361 // There has been an exception, just return. |
362 return; | 362 return; |
363 } | 363 } |
364 if (has_maximum.FromJust()) { | 364 if (has_maximum.FromJust()) { |
365 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, maximum_key, | 365 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, maximum_key, |
366 &maximum, initial, 65536)) { | 366 &maximum, initial, 65536)) { |
367 return; | 367 return; |
368 } | 368 } |
369 } | 369 } |
370 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 370 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
371 i::Handle<i::JSArrayBuffer> buffer = | |
372 i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kNotShared); | |
373 size_t size = static_cast<size_t>(i::wasm::WasmModule::kPageSize) * | 371 size_t size = static_cast<size_t>(i::wasm::WasmModule::kPageSize) * |
374 static_cast<size_t>(initial); | 372 static_cast<size_t>(initial); |
375 i::JSArrayBuffer::SetupAllocatingData(buffer, i_isolate, size); | 373 i::Handle<i::JSArrayBuffer> buffer = |
| 374 i::wasm::NewArrayBuffer(i_isolate, size, i::FLAG_wasm_guard_pages); |
376 | 375 |
377 i::Handle<i::JSObject> memory_obj = i::WasmJs::CreateWasmMemoryObject( | 376 i::Handle<i::JSObject> memory_obj = i::WasmJs::CreateWasmMemoryObject( |
378 i_isolate, buffer, has_maximum.FromJust(), maximum); | 377 i_isolate, buffer, has_maximum.FromJust(), maximum); |
379 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); | 378 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); |
380 return_value.Set(Utils::ToLocal(memory_obj)); | 379 return_value.Set(Utils::ToLocal(memory_obj)); |
381 } | 380 } |
382 | 381 |
383 void WebAssemblyTableGetLength( | 382 void WebAssemblyTableGetLength( |
384 const v8::FunctionCallbackInfo<v8::Value>& args) { | 383 const v8::FunctionCallbackInfo<v8::Value>& args) { |
385 v8::Isolate* isolate = args.GetIsolate(); | 384 v8::Isolate* isolate = args.GetIsolate(); |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 if (!memory_object->IsUndefined(isolate)) { | 920 if (!memory_object->IsUndefined(isolate)) { |
922 DCHECK(IsWasmMemoryObject(isolate, memory_object)); | 921 DCHECK(IsWasmMemoryObject(isolate, memory_object)); |
923 // TODO(gdeepti): This should be a weak list of instance objects | 922 // TODO(gdeepti): This should be a weak list of instance objects |
924 // for instances that share memory. | 923 // for instances that share memory. |
925 JSObject::cast(*memory_object) | 924 JSObject::cast(*memory_object) |
926 ->SetInternalField(kWasmMemoryInstanceObject, *instance); | 925 ->SetInternalField(kWasmMemoryInstanceObject, *instance); |
927 } | 926 } |
928 } | 927 } |
929 } // namespace internal | 928 } // namespace internal |
930 } // namespace v8 | 929 } // namespace v8 |
OLD | NEW |