Chromium Code Reviews| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 start = | 144 start = |
| 145 reinterpret_cast<const byte*>(contents.Data()) + array->ByteOffset(); | 145 reinterpret_cast<const byte*>(contents.Data()) + array->ByteOffset(); |
| 146 end = start + array->ByteLength(); | 146 end = start + array->ByteLength(); |
| 147 | 147 |
| 148 } else { | 148 } else { |
| 149 thrower->TypeError("Argument 0 must be a buffer source"); | 149 thrower->TypeError("Argument 0 must be a buffer source"); |
| 150 } | 150 } |
| 151 if (start == nullptr || end == start) { | 151 if (start == nullptr || end == start) { |
| 152 thrower->CompileError("BufferSource argument is empty"); | 152 thrower->CompileError("BufferSource argument is empty"); |
| 153 } | 153 } |
| 154 if (end - start > static_cast<ssize_t>(i::wasm::kV8MaxWasmModuleSize)) { | |
| 155 thrower->RangeError("buffer source exceeds maximum size of %" PRId64 | |
| 156 " (is %" PRId64 ")", | |
| 157 static_cast<int64_t>(i::wasm::kV8MaxWasmModuleSize), | |
|
titzer
2017/02/21 15:10:22
for size_t you can use %zu as the format string.
Clemens Hammacher
2017/02/21 17:48:16
Done.
| |
| 158 static_cast<int64_t>(end - start)); | |
| 159 } | |
| 160 if (thrower->error()) return i::wasm::ModuleWireBytes(nullptr, nullptr); | |
| 154 // TODO(titzer): use the handle as well? | 161 // TODO(titzer): use the handle as well? |
| 155 return i::wasm::ModuleWireBytes(start, end); | 162 return i::wasm::ModuleWireBytes(start, end); |
| 156 } | 163 } |
| 157 | 164 |
| 158 i::MaybeHandle<i::JSReceiver> GetSecondArgumentAsImports( | 165 i::MaybeHandle<i::JSReceiver> GetSecondArgumentAsImports( |
| 159 const v8::FunctionCallbackInfo<v8::Value>& args, ErrorThrower* thrower) { | 166 const v8::FunctionCallbackInfo<v8::Value>& args, ErrorThrower* thrower) { |
| 160 if (args.Length() < 2) return {}; | 167 if (args.Length() < 2) return {}; |
| 161 if (args[1]->IsUndefined()) return {}; | 168 if (args[1]->IsUndefined()) return {}; |
| 162 | 169 |
| 163 if (!args[1]->IsObject()) { | 170 if (!args[1]->IsObject()) { |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 912 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); | 919 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); |
| 913 return HasBrand(value, symbol); | 920 return HasBrand(value, symbol); |
| 914 } | 921 } |
| 915 | 922 |
| 916 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { | 923 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { |
| 917 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); | 924 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); |
| 918 return HasBrand(value, symbol); | 925 return HasBrand(value, symbol); |
| 919 } | 926 } |
| 920 } // namespace internal | 927 } // namespace internal |
| 921 } // namespace v8 | 928 } // namespace v8 |
| OLD | NEW |