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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // There has been an exception, just return. | 357 // There has been an exception, just return. |
358 return; | 358 return; |
359 } | 359 } |
360 if (has_maximum.FromJust()) { | 360 if (has_maximum.FromJust()) { |
361 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, maximum_key, | 361 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, maximum_key, |
362 &maximum, initial, 65536)) { | 362 &maximum, initial, 65536)) { |
363 return; | 363 return; |
364 } | 364 } |
365 } | 365 } |
366 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 366 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
367 i::Handle<i::JSArrayBuffer> buffer = | |
368 i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kNotShared); | |
369 size_t size = static_cast<size_t>(i::wasm::WasmModule::kPageSize) * | 367 size_t size = static_cast<size_t>(i::wasm::WasmModule::kPageSize) * |
370 static_cast<size_t>(initial); | 368 static_cast<size_t>(initial); |
371 i::JSArrayBuffer::SetupAllocatingData(buffer, i_isolate, size); | 369 i::Handle<i::JSArrayBuffer> buffer = |
| 370 i::wasm::NewArrayBuffer(i_isolate, size, i::FLAG_wasm_guard_pages); |
372 | 371 |
373 i::Handle<i::JSObject> memory_obj = i::WasmMemoryObject::New( | 372 i::Handle<i::JSObject> memory_obj = i::WasmMemoryObject::New( |
374 i_isolate, buffer, has_maximum.FromJust() ? maximum : -1); | 373 i_isolate, buffer, has_maximum.FromJust() ? maximum : -1); |
375 args.GetReturnValue().Set(Utils::ToLocal(memory_obj)); | 374 args.GetReturnValue().Set(Utils::ToLocal(memory_obj)); |
376 } | 375 } |
377 | 376 |
378 void WebAssemblyTableGetLength( | 377 void WebAssemblyTableGetLength( |
379 const v8::FunctionCallbackInfo<v8::Value>& args) { | 378 const v8::FunctionCallbackInfo<v8::Value>& args) { |
380 v8::Isolate* isolate = args.GetIsolate(); | 379 v8::Isolate* isolate = args.GetIsolate(); |
381 Local<Context> context = isolate->GetCurrentContext(); | 380 Local<Context> context = isolate->GetCurrentContext(); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); | 780 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); |
782 return HasBrand(value, symbol); | 781 return HasBrand(value, symbol); |
783 } | 782 } |
784 | 783 |
785 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { | 784 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { |
786 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); | 785 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); |
787 return HasBrand(value, symbol); | 786 return HasBrand(value, symbol); |
788 } | 787 } |
789 } // namespace internal | 788 } // namespace internal |
790 } // namespace v8 | 789 } // namespace v8 |
OLD | NEW |