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

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

Issue 2780783003: Separate function byte size counter for asm.js/wasm. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/counters.h ('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/wasm/module-decoder.h" 5 #include "src/wasm/module-decoder.h"
6 #include "src/wasm/function-body-decoder-impl.h" 6 #include "src/wasm/function-body-decoder-impl.h"
7 7
8 #include "src/base/functional.h" 8 #include "src/base/functional.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/counters.h" 10 #include "src/counters.h"
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 AccountingAllocator allocator; 1188 AccountingAllocator allocator;
1189 Zone zone(&allocator, ZONE_NAME); 1189 Zone zone(&allocator, ZONE_NAME);
1190 ModuleDecoder decoder(&zone, start, end, kWasmOrigin); 1190 ModuleDecoder decoder(&zone, start, end, kWasmOrigin);
1191 return decoder.DecodeInitExpr(start); 1191 return decoder.DecodeInitExpr(start);
1192 } 1192 }
1193 1193
1194 FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone, 1194 FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
1195 ModuleBytesEnv* module_env, 1195 ModuleBytesEnv* module_env,
1196 const byte* function_start, 1196 const byte* function_start,
1197 const byte* function_end) { 1197 const byte* function_end) {
1198 bool is_wasm = module_env->module_env.is_wasm();
1198 HistogramTimerScope wasm_decode_function_time_scope( 1199 HistogramTimerScope wasm_decode_function_time_scope(
1199 module_env->module_env.is_wasm() 1200 is_wasm ? isolate->counters()->wasm_decode_wasm_function_time()
1200 ? isolate->counters()->wasm_decode_wasm_function_time() 1201 : isolate->counters()->wasm_decode_asm_function_time());
1201 : isolate->counters()->wasm_decode_asm_function_time());
1202 size_t size = function_end - function_start; 1202 size_t size = function_end - function_start;
1203 if (function_start > function_end) return FunctionError("start > end"); 1203 if (function_start > function_end) return FunctionError("start > end");
1204 if (size > kV8MaxWasmFunctionSize) 1204 if (size > kV8MaxWasmFunctionSize)
1205 return FunctionError("size > maximum function size"); 1205 return FunctionError("size > maximum function size");
1206 isolate->counters()->wasm_function_size_bytes()->AddSample( 1206 (is_wasm ? isolate->counters()->wasm_wasm_function_size_bytes()
1207 static_cast<int>(size)); 1207 : isolate->counters()->wasm_asm_function_size_bytes())
1208 ->AddSample(static_cast<int>(size));
1208 WasmFunction* function = new WasmFunction(); 1209 WasmFunction* function = new WasmFunction();
1209 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); 1210 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin);
1210 return decoder.DecodeSingleFunction(module_env, function); 1211 return decoder.DecodeSingleFunction(module_env, function);
1211 } 1212 }
1212 1213
1213 AsmJsOffsetsResult DecodeAsmJsOffsets(const byte* tables_start, 1214 AsmJsOffsetsResult DecodeAsmJsOffsets(const byte* tables_start,
1214 const byte* tables_end) { 1215 const byte* tables_end) {
1215 AsmJsOffsets table; 1216 AsmJsOffsets table;
1216 1217
1217 Decoder decoder(tables_start, tables_end); 1218 Decoder decoder(tables_start, tables_end);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 result.push_back({section_start, name_offset, name_length, payload_offset, 1287 result.push_back({section_start, name_offset, name_length, payload_offset,
1287 payload_length, section_length}); 1288 payload_length, section_length});
1288 } 1289 }
1289 1290
1290 return result; 1291 return result;
1291 } 1292 }
1292 1293
1293 } // namespace wasm 1294 } // namespace wasm
1294 } // namespace internal 1295 } // namespace internal
1295 } // namespace v8 1296 } // namespace v8
OLDNEW
« no previous file with comments | « src/counters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698