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/assert-scope.h" | 7 #include "src/assert-scope.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/execution.h" | 9 #include "src/execution.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 thrower.RangeError(new_size64 < old_size ? "trying to shrink memory" | 733 thrower.RangeError(new_size64 < old_size ? "trying to shrink memory" |
734 : "maximum memory size exceeded"); | 734 : "maximum memory size exceeded"); |
735 return; | 735 return; |
736 } | 736 } |
737 int32_t ret = i::WasmMemoryObject::Grow(i_isolate, receiver, | 737 int32_t ret = i::WasmMemoryObject::Grow(i_isolate, receiver, |
738 static_cast<uint32_t>(delta_size)); | 738 static_cast<uint32_t>(delta_size)); |
739 if (ret == -1) { | 739 if (ret == -1) { |
740 thrower.RangeError("Unable to grow instance memory."); | 740 thrower.RangeError("Unable to grow instance memory."); |
741 return; | 741 return; |
742 } | 742 } |
743 i::wasm::DetachWebAssemblyMemoryBuffer(i_isolate, old_buffer); | 743 bool free_memory = (delta_size != 0); |
| 744 i::wasm::DetachWebAssemblyMemoryBuffer(i_isolate, old_buffer, free_memory); |
744 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); | 745 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); |
745 return_value.Set(ret); | 746 return_value.Set(ret); |
746 } | 747 } |
747 | 748 |
748 // WebAssembly.Memory.buffer -> ArrayBuffer | 749 // WebAssembly.Memory.buffer -> ArrayBuffer |
749 void WebAssemblyMemoryGetBuffer( | 750 void WebAssemblyMemoryGetBuffer( |
750 const v8::FunctionCallbackInfo<v8::Value>& args) { | 751 const v8::FunctionCallbackInfo<v8::Value>& args) { |
751 v8::Isolate* isolate = args.GetIsolate(); | 752 v8::Isolate* isolate = args.GetIsolate(); |
752 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 753 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
753 HandleScope scope(isolate); | 754 HandleScope scope(isolate); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); | 967 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); |
967 return HasBrand(value, symbol); | 968 return HasBrand(value, symbol); |
968 } | 969 } |
969 | 970 |
970 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { | 971 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { |
971 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); | 972 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); |
972 return HasBrand(value, symbol); | 973 return HasBrand(value, symbol); |
973 } | 974 } |
974 } // namespace internal | 975 } // namespace internal |
975 } // namespace v8 | 976 } // namespace v8 |
OLD | NEW |