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

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

Issue 2844163006: [wasm] Move Table.Grow implementation to wasm-objects.cc, cleanup (Closed)
Patch Set: Cleanup 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/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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 max_size64 = i::FLAG_wasm_max_table_size; 602 max_size64 = i::FLAG_wasm_max_table_size;
603 } 603 }
604 604
605 if (new_size64 < old_size || new_size64 > max_size64) { 605 if (new_size64 < old_size || new_size64 > max_size64) {
606 thrower.RangeError(new_size64 < old_size ? "trying to shrink table" 606 thrower.RangeError(new_size64 < old_size ? "trying to shrink table"
607 : "maximum table size exceeded"); 607 : "maximum table size exceeded");
608 return; 608 return;
609 } 609 }
610 610
611 int new_size = static_cast<int>(new_size64); 611 int new_size = static_cast<int>(new_size64);
612 i::WasmTableObject::Grow(i_isolate, receiver, 612 receiver->grow(i_isolate, static_cast<uint32_t>(new_size - old_size));
613 static_cast<uint32_t>(new_size - old_size));
614 613
615 if (new_size != old_size) { 614 if (new_size != old_size) {
616 i::Handle<i::FixedArray> new_array = 615 i::Handle<i::FixedArray> new_array =
617 i_isolate->factory()->NewFixedArray(new_size); 616 i_isolate->factory()->NewFixedArray(new_size);
618 for (int i = 0; i < old_size; ++i) new_array->set(i, old_array->get(i)); 617 for (int i = 0; i < old_size; ++i) new_array->set(i, old_array->get(i));
619 i::Object* null = i_isolate->heap()->null_value(); 618 i::Object* null = i_isolate->heap()->null_value();
620 for (int i = old_size; i < new_size; ++i) new_array->set(i, null); 619 for (int i = old_size; i < new_size; ++i) new_array->set(i, null);
621 receiver->set_functions(*new_array); 620 receiver->set_functions(*new_array);
622 } 621 }
623 622
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); 969 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate);
971 return HasBrand(value, symbol); 970 return HasBrand(value, symbol);
972 } 971 }
973 972
974 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { 973 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) {
975 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); 974 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate);
976 return HasBrand(value, symbol); 975 return HasBrand(value, symbol);
977 } 976 }
978 } // namespace internal 977 } // namespace internal
979 } // namespace v8 978 } // 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