Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Side by Side Diff: src/wasm/wasm-js.cc

Issue 2772973002: [wasm] Detach memory buffer only when GrowMemory is called from the JS API (Closed)
Patch Set: Add comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 thrower.RangeError(new_size64 < old_size ? "trying to shrink memory" 691 thrower.RangeError(new_size64 < old_size ? "trying to shrink memory"
692 : "maximum memory size exceeded"); 692 : "maximum memory size exceeded");
693 return; 693 return;
694 } 694 }
695 int32_t ret = i::wasm::GrowWebAssemblyMemory( 695 int32_t ret = i::wasm::GrowWebAssemblyMemory(
696 i_isolate, receiver, static_cast<uint32_t>(delta_size)); 696 i_isolate, receiver, static_cast<uint32_t>(delta_size));
697 if (ret == -1) { 697 if (ret == -1) {
698 thrower.RangeError("Unable to grow instance memory."); 698 thrower.RangeError("Unable to grow instance memory.");
699 return; 699 return;
700 } 700 }
701 i::wasm::DetachWebAssemblyMemoryBuffer(i_isolate, old_buffer);
701 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); 702 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue();
702 return_value.Set(ret); 703 return_value.Set(ret);
703 } 704 }
704 705
705 // WebAssembly.Memory.buffer -> ArrayBuffer 706 // WebAssembly.Memory.buffer -> ArrayBuffer
706 void WebAssemblyMemoryGetBuffer( 707 void WebAssemblyMemoryGetBuffer(
707 const v8::FunctionCallbackInfo<v8::Value>& args) { 708 const v8::FunctionCallbackInfo<v8::Value>& args) {
708 v8::Isolate* isolate = args.GetIsolate(); 709 v8::Isolate* isolate = args.GetIsolate();
709 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 710 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
710 HandleScope scope(isolate); 711 HandleScope scope(isolate);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); 925 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate);
925 return HasBrand(value, symbol); 926 return HasBrand(value, symbol);
926 } 927 }
927 928
928 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { 929 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) {
929 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); 930 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate);
930 return HasBrand(value, symbol); 931 return HasBrand(value, symbol);
931 } 932 }
932 } // namespace internal 933 } // namespace internal
933 } // namespace v8 934 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698