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

Side by Side Diff: src/api.cc

Issue 2397303002: Fix build error due to conflicting changes. (Closed)
Patch Set: remove bytes check from validation of wasm module object Created 4 years, 2 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.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 7171 matching lines...) Expand 10 before | Expand all | Expand 10 after
7182 !ToLocal<Proxy>(i::JSProxy::New(isolate, target, handler), &result); 7182 !ToLocal<Proxy>(i::JSProxy::New(isolate, target, handler), &result);
7183 RETURN_ON_FAILED_EXECUTION(Proxy); 7183 RETURN_ON_FAILED_EXECUTION(Proxy);
7184 RETURN_ESCAPED(result); 7184 RETURN_ESCAPED(result);
7185 } 7185 }
7186 7186
7187 Local<String> WasmCompiledModule::GetUncompiledBytes() { 7187 Local<String> WasmCompiledModule::GetUncompiledBytes() {
7188 i::Handle<i::JSObject> obj = 7188 i::Handle<i::JSObject> obj =
7189 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); 7189 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
7190 i::Handle<i::wasm::WasmCompiledModule> compiled_part = 7190 i::Handle<i::wasm::WasmCompiledModule> compiled_part =
7191 i::handle(i::wasm::WasmCompiledModule::cast(obj->GetInternalField(0))); 7191 i::handle(i::wasm::WasmCompiledModule::cast(obj->GetInternalField(0)));
7192 return Local<String>::Cast(Utils::ToLocal(compiled_part->module_bytes())); 7192 i::Handle<i::String> module_bytes = compiled_part->module_bytes();
7193 return Local<String>::Cast(Utils::ToLocal(module_bytes));
7193 } 7194 }
7194 7195
7195 WasmCompiledModule::SerializedModule WasmCompiledModule::Serialize() { 7196 WasmCompiledModule::SerializedModule WasmCompiledModule::Serialize() {
7196 i::Handle<i::JSObject> obj = 7197 i::Handle<i::JSObject> obj =
7197 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); 7198 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
7198 i::Handle<i::wasm::WasmCompiledModule> compiled_part = 7199 i::Handle<i::wasm::WasmCompiledModule> compiled_part =
7199 i::handle(i::wasm::WasmCompiledModule::cast(obj->GetInternalField(0))); 7200 i::handle(i::wasm::WasmCompiledModule::cast(obj->GetInternalField(0)));
7200 7201
7201 i::Handle<i::String> uncompiled_bytes = compiled_part->module_bytes(); 7202 i::Handle<i::SeqOneByteString> uncompiled_bytes =
7203 compiled_part->module_bytes();
7202 compiled_part->reset_module_bytes(); 7204 compiled_part->reset_module_bytes();
7203 std::unique_ptr<i::ScriptData> script_data = 7205 std::unique_ptr<i::ScriptData> script_data =
7204 i::WasmCompiledModuleSerializer::SerializeWasmModule(obj->GetIsolate(), 7206 i::WasmCompiledModuleSerializer::SerializeWasmModule(obj->GetIsolate(),
7205 compiled_part); 7207 compiled_part);
7206 compiled_part->set_module_bytes(uncompiled_bytes); 7208 compiled_part->set_module_bytes(uncompiled_bytes);
7207 script_data->ReleaseDataOwnership(); 7209 script_data->ReleaseDataOwnership();
7208 7210
7209 size_t size = static_cast<size_t>(script_data->length()); 7211 size_t size = static_cast<size_t>(script_data->length());
7210 return {std::unique_ptr<const uint8_t[]>(script_data->data()), size}; 7212 return {std::unique_ptr<const uint8_t[]>(script_data->data()), size};
7211 } 7213 }
(...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after
9415 Address callback_address = 9417 Address callback_address =
9416 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9418 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9417 VMState<EXTERNAL> state(isolate); 9419 VMState<EXTERNAL> state(isolate);
9418 ExternalCallbackScope call_scope(isolate, callback_address); 9420 ExternalCallbackScope call_scope(isolate, callback_address);
9419 callback(info); 9421 callback(info);
9420 } 9422 }
9421 9423
9422 9424
9423 } // namespace internal 9425 } // namespace internal
9424 } // namespace v8 9426 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698