| 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/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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 if (!string->Equals(context, v8_str(isolate, "anyfunc")).To(&equal)) return; | 453 if (!string->Equals(context, v8_str(isolate, "anyfunc")).To(&equal)) return; |
| 454 if (!equal) { | 454 if (!equal) { |
| 455 thrower.TypeError("Descriptor property 'element' must be 'anyfunc'"); | 455 thrower.TypeError("Descriptor property 'element' must be 'anyfunc'"); |
| 456 return; | 456 return; |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 // The descriptor's 'initial'. | 459 // The descriptor's 'initial'. |
| 460 int initial = 0; | 460 int initial = 0; |
| 461 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, | 461 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, |
| 462 v8_str(isolate, "initial"), &initial, 0, | 462 v8_str(isolate, "initial"), &initial, 0, |
| 463 i::wasm::kV8MaxWasmTableSize)) { | 463 i::FLAG_wasm_max_table_size)) { |
| 464 return; | 464 return; |
| 465 } | 465 } |
| 466 // The descriptor's 'maximum'. | 466 // The descriptor's 'maximum'. |
| 467 int maximum = -1; | 467 int maximum = -1; |
| 468 Local<String> maximum_key = v8_str(isolate, "maximum"); | 468 Local<String> maximum_key = v8_str(isolate, "maximum"); |
| 469 Maybe<bool> has_maximum = descriptor->Has(context, maximum_key); | 469 Maybe<bool> has_maximum = descriptor->Has(context, maximum_key); |
| 470 | 470 |
| 471 if (!has_maximum.IsNothing() && has_maximum.FromJust()) { | 471 if (!has_maximum.IsNothing() && has_maximum.FromJust()) { |
| 472 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, maximum_key, | 472 if (!GetIntegerProperty(isolate, &thrower, context, descriptor, maximum_key, |
| 473 &maximum, initial, | 473 &maximum, initial, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 i::Handle<i::FixedArray> old_array(receiver->functions(), i_isolate); | 560 i::Handle<i::FixedArray> old_array(receiver->functions(), i_isolate); |
| 561 int old_size = old_array->length(); | 561 int old_size = old_array->length(); |
| 562 int64_t new_size64 = 0; | 562 int64_t new_size64 = 0; |
| 563 if (args.Length() > 0 && !args[0]->IntegerValue(context).To(&new_size64)) { | 563 if (args.Length() > 0 && !args[0]->IntegerValue(context).To(&new_size64)) { |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 new_size64 += old_size; | 566 new_size64 += old_size; |
| 567 | 567 |
| 568 int64_t max_size64 = receiver->maximum_length(); | 568 int64_t max_size64 = receiver->maximum_length(); |
| 569 if (max_size64 < 0 || | 569 if (max_size64 < 0 || |
| 570 max_size64 > static_cast<int64_t>(i::wasm::kV8MaxWasmTableSize)) { | 570 max_size64 > static_cast<int64_t>(i::FLAG_wasm_max_table_size)) { |
| 571 max_size64 = i::wasm::kV8MaxWasmTableSize; | 571 max_size64 = i::FLAG_wasm_max_table_size; |
| 572 } | 572 } |
| 573 | 573 |
| 574 if (new_size64 < old_size || new_size64 > max_size64) { | 574 if (new_size64 < old_size || new_size64 > max_size64) { |
| 575 v8::Local<v8::Value> e = v8::Exception::RangeError( | 575 v8::Local<v8::Value> e = v8::Exception::RangeError( |
| 576 v8_str(isolate, new_size64 < old_size ? "trying to shrink table" | 576 v8_str(isolate, new_size64 < old_size ? "trying to shrink table" |
| 577 : "maximum table size exceeded")); | 577 : "maximum table size exceeded")); |
| 578 isolate->ThrowException(e); | 578 isolate->ThrowException(e); |
| 579 return; | 579 return; |
| 580 } | 580 } |
| 581 | 581 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |