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

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

Issue 2103983003: Revert "[wasm] Complete separation of compilation and instantiation" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/signature.h ('k') | 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/assert-scope.h" 7 #include "src/assert-scope.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/execution.h" 10 #include "src/execution.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 ffi = i::Handle<i::JSReceiver>::cast(v8::Utils::OpenHandle(*obj)); 185 ffi = i::Handle<i::JSReceiver>::cast(v8::Utils::OpenHandle(*obj));
186 } 186 }
187 187
188 i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null(); 188 i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null();
189 if (args.Length() > 2 && args[2]->IsArrayBuffer()) { 189 if (args.Length() > 2 && args[2]->IsArrayBuffer()) {
190 Local<Object> obj = Local<Object>::Cast(args[2]); 190 Local<Object> obj = Local<Object>::Cast(args[2]);
191 i::Handle<i::Object> mem_obj = v8::Utils::OpenHandle(*obj); 191 i::Handle<i::Object> mem_obj = v8::Utils::OpenHandle(*obj);
192 memory = i::Handle<i::JSArrayBuffer>(i::JSArrayBuffer::cast(*mem_obj)); 192 memory = i::Handle<i::JSArrayBuffer>(i::JSArrayBuffer::cast(*mem_obj));
193 } 193 }
194 194
195 i::MaybeHandle<i::FixedArray> compiled_module = 195 object = result.val->Instantiate(isolate, ffi, memory);
196 result.val->CompileFunctions(isolate); 196 if (!object.is_null()) {
197 if (!compiled_module.is_null()) { 197 args.GetReturnValue().Set(v8::Utils::ToLocal(object.ToHandleChecked()));
198 object = i::wasm::WasmModule::Instantiate(
199 isolate, compiled_module.ToHandleChecked(), ffi, memory);
200 if (!object.is_null()) {
201 args.GetReturnValue().Set(v8::Utils::ToLocal(object.ToHandleChecked()));
202 }
203 } 198 }
204 } 199 }
205 200
206 if (result.val) delete result.val; 201 if (result.val) delete result.val;
207 return object; 202 return object;
208 } 203 }
209 204
210 void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) { 205 void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) {
211 HandleScope scope(args.GetIsolate()); 206 HandleScope scope(args.GetIsolate());
212 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); 207 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 int unused_property_fields = in_object_properties - pre_allocated; 487 int unused_property_fields = in_object_properties - pre_allocated;
493 Handle<Map> map = Map::CopyInitialMap( 488 Handle<Map> map = Map::CopyInitialMap(
494 prev_map, instance_size, in_object_properties, unused_property_fields); 489 prev_map, instance_size, in_object_properties, unused_property_fields);
495 490
496 context->set_wasm_function_map(*map); 491 context->set_wasm_function_map(*map);
497 } 492 }
498 } 493 }
499 494
500 } // namespace internal 495 } // namespace internal
501 } // namespace v8 496 } // namespace v8
OLDNEW
« no previous file with comments | « src/signature.h ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698