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

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

Issue 1895223004: Reduce bucket count and range for wasm function count, and add "module" to some names. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add "module" Created 4 years, 8 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
« src/counters.h ('K') | « src/wasm/module-decoder.cc ('k') | no next file » | 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/macro-assembler.h" 5 #include "src/macro-assembler.h"
6 #include "src/objects.h" 6 #include "src/objects.h"
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/simulator.h" 9 #include "src/simulator.h"
10 10
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 376
377 // Instantiates a wasm module as a JSObject. 377 // Instantiates a wasm module as a JSObject.
378 // * allocates a backing store of {mem_size} bytes. 378 // * allocates a backing store of {mem_size} bytes.
379 // * installs a named property "memory" for that buffer if exported 379 // * installs a named property "memory" for that buffer if exported
380 // * installs named properties on the object for exported functions 380 // * installs named properties on the object for exported functions
381 // * compiles wasm code to machine code 381 // * compiles wasm code to machine code
382 MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate, 382 MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
383 Handle<JSObject> ffi, 383 Handle<JSObject> ffi,
384 Handle<JSArrayBuffer> memory) { 384 Handle<JSArrayBuffer> memory) {
385 HistogramTimerScope wasm_instantiate_time_scope( 385 HistogramTimerScope wasm_instantiate_module_time_scope(
386 isolate->counters()->wasm_instantiate_time()); 386 isolate->counters()->wasm_instantiate_module_time());
387 this->shared_isolate = isolate; // TODO(titzer): have a real shared isolate. 387 this->shared_isolate = isolate; // TODO(titzer): have a real shared isolate.
388 ErrorThrower thrower(isolate, "WasmModule::Instantiate()"); 388 ErrorThrower thrower(isolate, "WasmModule::Instantiate()");
389 Factory* factory = isolate->factory(); 389 Factory* factory = isolate->factory();
390 390
391 //------------------------------------------------------------------------- 391 //-------------------------------------------------------------------------
392 // Allocate the instance and its JS counterpart. 392 // Allocate the instance and its JS counterpart.
393 //------------------------------------------------------------------------- 393 //-------------------------------------------------------------------------
394 Handle<Map> map = factory->NewMap( 394 Handle<Map> map = factory->NewMap(
395 JS_OBJECT_TYPE, 395 JS_OBJECT_TYPE,
396 JSObject::kHeaderSize + kWasmModuleInternalFieldCount * kPointerSize); 396 JSObject::kHeaderSize + kWasmModuleInternalFieldCount * kPointerSize);
(...skipping 26 matching lines...) Expand all
423 // Allocate the globals area if necessary. 423 // Allocate the globals area if necessary.
424 //------------------------------------------------------------------------- 424 //-------------------------------------------------------------------------
425 if (!AllocateGlobals(&thrower, isolate, &instance)) { 425 if (!AllocateGlobals(&thrower, isolate, &instance)) {
426 return MaybeHandle<JSObject>(); 426 return MaybeHandle<JSObject>();
427 } 427 }
428 if (!instance.globals_buffer.is_null()) { 428 if (!instance.globals_buffer.is_null()) {
429 instance.js_object->SetInternalField(kWasmGlobalsArrayBuffer, 429 instance.js_object->SetInternalField(kWasmGlobalsArrayBuffer,
430 *instance.globals_buffer); 430 *instance.globals_buffer);
431 } 431 }
432 432
433 HistogramTimerScope wasm_compile_time_scope( 433 HistogramTimerScope wasm_compile_module_time_scope(
434 isolate->counters()->wasm_compile_time()); 434 isolate->counters()->wasm_compile_module_time());
435 435
436 //------------------------------------------------------------------------- 436 //-------------------------------------------------------------------------
437 // Compile wrappers to imported functions. 437 // Compile wrappers to imported functions.
438 //------------------------------------------------------------------------- 438 //-------------------------------------------------------------------------
439 uint32_t index = 0; 439 uint32_t index = 0;
440 instance.function_table = BuildFunctionTable(isolate, this); 440 instance.function_table = BuildFunctionTable(isolate, this);
441 WasmLinker linker(isolate, functions.size()); 441 WasmLinker linker(isolate, functions.size());
442 ModuleEnv module_env; 442 ModuleEnv module_env;
443 module_env.module = this; 443 module_env.module = this;
444 module_env.instance = &instance; 444 module_env.instance = &instance;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 705 }
706 if (result->IsHeapNumber()) { 706 if (result->IsHeapNumber()) {
707 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); 707 return static_cast<int32_t>(HeapNumber::cast(*result)->value());
708 } 708 }
709 thrower.Error("WASM.compileRun() failed: Return value should be number"); 709 thrower.Error("WASM.compileRun() failed: Return value should be number");
710 return -1; 710 return -1;
711 } 711 }
712 } // namespace wasm 712 } // namespace wasm
713 } // namespace internal 713 } // namespace internal
714 } // namespace v8 714 } // namespace v8
OLDNEW
« src/counters.h ('K') | « src/wasm/module-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698