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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 if (args.Length() < 1 || !args[0]->IntegerValue(context).To(&delta_size)) { | 690 if (args.Length() < 1 || !args[0]->IntegerValue(context).To(&delta_size)) { |
691 v8::Local<v8::Value> e = v8::Exception::TypeError( | 691 v8::Local<v8::Value> e = v8::Exception::TypeError( |
692 v8_str(isolate, "Argument 0 required, must be numeric value of pages")); | 692 v8_str(isolate, "Argument 0 required, must be numeric value of pages")); |
693 isolate->ThrowException(e); | 693 isolate->ThrowException(e); |
694 return; | 694 return; |
695 } | 695 } |
696 i::Handle<i::WasmMemoryObject> receiver = | 696 i::Handle<i::WasmMemoryObject> receiver = |
697 i::Handle<i::WasmMemoryObject>::cast(Utils::OpenHandle(*args.This())); | 697 i::Handle<i::WasmMemoryObject>::cast(Utils::OpenHandle(*args.This())); |
698 int64_t max_size64 = receiver->maximum_pages(); | 698 int64_t max_size64 = receiver->maximum_pages(); |
699 if (max_size64 < 0 || | 699 if (max_size64 < 0 || |
700 max_size64 > static_cast<int64_t>(i::wasm::kV8MaxWasmTableSize)) { | 700 max_size64 > static_cast<int64_t>(i::wasm::kV8MaxWasmMemoryPages)) { |
701 max_size64 = i::wasm::kV8MaxWasmMemoryPages; | 701 max_size64 = i::wasm::kV8MaxWasmMemoryPages; |
702 } | 702 } |
703 i::Handle<i::JSArrayBuffer> old_buffer(receiver->buffer()); | 703 i::Handle<i::JSArrayBuffer> old_buffer(receiver->buffer()); |
704 uint32_t old_size = | 704 uint32_t old_size = |
705 old_buffer->byte_length()->Number() / i::wasm::kSpecMaxWasmMemoryPages; | 705 old_buffer->byte_length()->Number() / i::wasm::kSpecMaxWasmMemoryPages; |
706 int64_t new_size64 = old_size + delta_size; | 706 int64_t new_size64 = old_size + delta_size; |
707 if (delta_size < 0 || max_size64 < new_size64 || new_size64 < old_size) { | 707 if (delta_size < 0 || max_size64 < new_size64 || new_size64 < old_size) { |
708 v8::Local<v8::Value> e = v8::Exception::RangeError(v8_str( | 708 v8::Local<v8::Value> e = v8::Exception::RangeError(v8_str( |
709 isolate, new_size64 < old_size ? "trying to shrink memory" | 709 isolate, new_size64 < old_size ? "trying to shrink memory" |
710 : "maximum memory size exceeded")); | 710 : "maximum memory size exceeded")); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); | 951 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); |
952 return HasBrand(value, symbol); | 952 return HasBrand(value, symbol); |
953 } | 953 } |
954 | 954 |
955 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { | 955 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { |
956 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); | 956 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); |
957 return HasBrand(value, symbol); | 957 return HasBrand(value, symbol); |
958 } | 958 } |
959 } // namespace internal | 959 } // namespace internal |
960 } // namespace v8 | 960 } // namespace v8 |
OLD | NEW |