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

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

Issue 2381843002: Add Smi::Zero and replace all Smi::FromInt(0) calls (Closed)
Patch Set: Mark Smi::kZero as V8_EXPORT_PRIVATE 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 | « src/type-feedback-vector.cc ('k') | src/x64/code-stubs-x64.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 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 <memory> 5 #include <memory>
6 6
7 #include "src/base/atomic-utils.h" 7 #include "src/base/atomic-utils.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 9
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 origin(kWasmOrigin), 875 origin(kWasmOrigin),
876 globals_size(0), 876 globals_size(0),
877 num_imported_functions(0), 877 num_imported_functions(0),
878 num_declared_functions(0), 878 num_declared_functions(0),
879 num_exported_functions(0), 879 num_exported_functions(0),
880 pending_tasks(new base::Semaphore(0)) {} 880 pending_tasks(new base::Semaphore(0)) {}
881 881
882 void EncodeInit(const WasmModule* module, Factory* factory, 882 void EncodeInit(const WasmModule* module, Factory* factory,
883 Handle<FixedArray> entry, int kind_index, int value_index, 883 Handle<FixedArray> entry, int kind_index, int value_index,
884 const WasmInitExpr& expr) { 884 const WasmInitExpr& expr) {
885 entry->set(kind_index, Smi::FromInt(0)); 885 entry->set(kind_index, Smi::kZero);
886 886
887 Handle<Object> value; 887 Handle<Object> value;
888 switch (expr.kind) { 888 switch (expr.kind) {
889 case WasmInitExpr::kGlobalIndex: { 889 case WasmInitExpr::kGlobalIndex: {
890 TRACE(" kind = 1, global index %u\n", expr.val.global_index); 890 TRACE(" kind = 1, global index %u\n", expr.val.global_index);
891 entry->set(kind_index, Smi::FromInt(1)); 891 entry->set(kind_index, Smi::FromInt(1));
892 uint32_t offset = module->globals[expr.val.global_index].offset; 892 uint32_t offset = module->globals[expr.val.global_index].offset;
893 entry->set(value_index, Smi::FromInt(offset)); 893 entry->set(value_index, Smi::FromInt(offset));
894 return; 894 return;
895 } 895 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 } 1112 }
1113 inits->Shrink(index); 1113 inits->Shrink(index);
1114 ret->set_inits(inits); 1114 ret->set_inits(inits);
1115 } 1115 }
1116 1116
1117 // Record data for startup function. 1117 // Record data for startup function.
1118 if (start_function_index >= 0) { 1118 if (start_function_index >= 0) {
1119 HandleScope scope(isolate); 1119 HandleScope scope(isolate);
1120 Handle<FixedArray> startup_data = 1120 Handle<FixedArray> startup_data =
1121 factory->NewFixedArray(kWasmExportDataSize, TENURED); 1121 factory->NewFixedArray(kWasmExportDataSize, TENURED);
1122 startup_data->set(kExportArity, Smi::FromInt(0)); 1122 startup_data->set(kExportArity, Smi::kZero);
1123 startup_data->set(kExportIndex, Smi::FromInt(start_function_index)); 1123 startup_data->set(kExportIndex, Smi::FromInt(start_function_index));
1124 ret->set_startup_function(startup_data); 1124 ret->set_startup_function(startup_data);
1125 } 1125 }
1126 1126
1127 // TODO(wasm): saving the module bytes for debugging is wasteful. We should 1127 // TODO(wasm): saving the module bytes for debugging is wasteful. We should
1128 // consider downloading this on-demand. 1128 // consider downloading this on-demand.
1129 { 1129 {
1130 size_t module_bytes_len = module_end - module_start; 1130 size_t module_bytes_len = module_end - module_start;
1131 DCHECK_LE(module_bytes_len, static_cast<size_t>(kMaxInt)); 1131 DCHECK_LE(module_bytes_len, static_cast<size_t>(kMaxInt));
1132 Vector<const uint8_t> module_bytes_vec(module_start, 1132 Vector<const uint8_t> module_bytes_vec(module_start,
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 WasmCompiledModule* compiled_module = 2251 WasmCompiledModule* compiled_module =
2252 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); 2252 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule));
2253 CHECK(compiled_module->has_weak_module_object()); 2253 CHECK(compiled_module->has_weak_module_object());
2254 CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); 2254 CHECK(compiled_module->ptr_to_weak_module_object()->cleared());
2255 } 2255 }
2256 2256
2257 } // namespace testing 2257 } // namespace testing
2258 } // namespace wasm 2258 } // namespace wasm
2259 } // namespace internal 2259 } // namespace internal
2260 } // namespace v8 2260 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-feedback-vector.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698