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

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

Issue 2867233002: [wasm] Do not unregister an ArrayBuffer if it is already external (Closed)
Patch Set: Eric's review Created 3 years, 7 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/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
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
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
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