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

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

Issue 2626313003: [wasm] Change the constant kV8MaxWasmMemoryPages to a command line flag. (Closed)
Patch Set: Rebase Created 3 years, 11 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 | « src/wasm/wasm-interpreter.cc ('k') | src/wasm/wasm-limits.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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 if (args.Length() < 1 || !args[0]->IsObject()) { 492 if (args.Length() < 1 || !args[0]->IsObject()) {
493 thrower.TypeError("Argument 0 must be a memory descriptor"); 493 thrower.TypeError("Argument 0 must be a memory descriptor");
494 return; 494 return;
495 } 495 }
496 Local<Context> context = isolate->GetCurrentContext(); 496 Local<Context> context = isolate->GetCurrentContext();
497 Local<v8::Object> descriptor = args[0]->ToObject(context).ToLocalChecked(); 497 Local<v8::Object> descriptor = args[0]->ToObject(context).ToLocalChecked();
498 // The descriptor's 'initial'. 498 // The descriptor's 'initial'.
499 int initial = 0; 499 int initial = 0;
500 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, 500 if (!GetIntegerProperty(isolate, &thrower, context, descriptor,
501 v8_str(isolate, "initial"), &initial, 0, 501 v8_str(isolate, "initial"), &initial, 0,
502 i::wasm::kV8MaxWasmMemoryPages)) { 502 i::FLAG_wasm_max_mem_pages)) {
503 return; 503 return;
504 } 504 }
505 // The descriptor's 'maximum'. 505 // The descriptor's 'maximum'.
506 int maximum = -1; 506 int maximum = -1;
507 Local<String> maximum_key = v8_str(isolate, "maximum"); 507 Local<String> maximum_key = v8_str(isolate, "maximum");
508 Maybe<bool> has_maximum = descriptor->Has(context, maximum_key); 508 Maybe<bool> has_maximum = descriptor->Has(context, maximum_key);
509 509
510 if (!has_maximum.IsNothing() && has_maximum.FromJust()) { 510 if (!has_maximum.IsNothing() && has_maximum.FromJust()) {
511 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, maximum_key, 511 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, maximum_key,
512 &maximum, initial, 512 &maximum, initial,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::kV8MaxWasmMemoryPages)) { 700 max_size64 > static_cast<int64_t>(i::FLAG_wasm_max_mem_pages)) {
701 max_size64 = i::wasm::kV8MaxWasmMemoryPages; 701 max_size64 = i::FLAG_wasm_max_mem_pages;
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"));
711 isolate->ThrowException(e); 711 isolate->ThrowException(e);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | src/wasm/wasm-limits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698