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

Side by Side Diff: src/asmjs/asm-js.cc

Issue 2629043002: [wasm][asm.js] Do same work even when not printing asm info. (Closed)
Patch Set: Created 3 years, 11 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 | 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/asmjs/asm-js.h" 5 #include "src/asmjs/asm-js.h"
6 6
7 #include "src/api-natives.h" 7 #include "src/api-natives.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/asmjs/asm-typer.h" 9 #include "src/asmjs/asm-typer.h"
10 #include "src/asmjs/asm-wasm-builder.h" 10 #include "src/asmjs/asm-wasm-builder.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 Handle<FixedArray> result = 203 Handle<FixedArray> result =
204 info->isolate()->factory()->NewFixedArray(kWasmDataEntryCount); 204 info->isolate()->factory()->NewFixedArray(kWasmDataEntryCount);
205 result->set(kWasmDataCompiledModule, *compiled.ToHandleChecked()); 205 result->set(kWasmDataCompiledModule, *compiled.ToHandleChecked());
206 result->set(kWasmDataForeignGlobals, *foreign_globals); 206 result->set(kWasmDataForeignGlobals, *foreign_globals);
207 result->set(kWasmDataUsesArray, *uses_array); 207 result->set(kWasmDataUsesArray, *uses_array);
208 result->set(kWasmDataScript, *info->script()); 208 result->set(kWasmDataScript, *info->script());
209 result->set(kWasmDataScriptPosition, 209 result->set(kWasmDataScriptPosition,
210 Smi::FromInt(info->literal()->position())); 210 Smi::FromInt(info->literal()->position()));
211 211
212 if (FLAG_trace_asm_time) { 212 MessageLocation location(info->script(), info->literal()->position(),
213 MessageLocation location(info->script(), info->literal()->position(), 213 info->literal()->position());
214 info->literal()->position()); 214 char text[100];
215 char text[100]; 215 int length = base::OS::SNPrintF(
216 int length = 216 text, arraysize(text), "success, asm->wasm: %0.3f ms, compile: %0.3f ms",
217 base::OS::SNPrintF(text, arraysize(text), 217 asm_wasm_time, compile_time);
218 "success, asm->wasm: %0.3f ms, compile: %0.3f ms", 218 DCHECK_NE(-1, length);
219 asm_wasm_time, compile_time); 219 USE(length);
220 DCHECK_NE(-1, length); 220 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text));
221 USE(length); 221 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject(
222 Handle<String> stext( 222 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext,
223 info->isolate()->factory()->InternalizeUtf8String(text)); 223 Handle<JSArray>::null());
224 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( 224 message->set_error_level(v8::Isolate::kMessageInfo);
225 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext, 225 if (FLAG_trace_asm_time && !FLAG_suppress_asm_messages) {
226 Handle<JSArray>::null()); 226 MessageHandler::ReportMessage(info->isolate(), &location, message);
227 message->set_error_level(v8::Isolate::kMessageInfo);
228 if (!FLAG_suppress_asm_messages) {
229 MessageHandler::ReportMessage(info->isolate(), &location, message);
230 }
231 } 227 }
232 228
233 return result; 229 return result;
234 } 230 }
235 231
236 bool AsmJs::IsStdlibValid(i::Isolate* isolate, Handle<FixedArray> wasm_data, 232 bool AsmJs::IsStdlibValid(i::Isolate* isolate, Handle<FixedArray> wasm_data,
237 Handle<JSReceiver> stdlib) { 233 Handle<JSReceiver> stdlib) {
238 i::Handle<i::FixedArray> uses( 234 i::Handle<i::FixedArray> uses(
239 i::FixedArray::cast(wasm_data->get(kWasmDataUsesArray))); 235 i::FixedArray::cast(wasm_data->get(kWasmDataUsesArray)));
240 for (int i = 0; i < uses->length(); ++i) { 236 for (int i = 0; i < uses->length(); ++i) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 i::Handle<i::Name> single_function_name( 307 i::Handle<i::Name> single_function_name(
312 isolate->factory()->InternalizeUtf8String( 308 isolate->factory()->InternalizeUtf8String(
313 wasm::AsmWasmBuilder::single_function_name)); 309 wasm::AsmWasmBuilder::single_function_name));
314 i::MaybeHandle<i::Object> single_function = 310 i::MaybeHandle<i::Object> single_function =
315 i::Object::GetProperty(module_object, single_function_name); 311 i::Object::GetProperty(module_object, single_function_name);
316 if (!single_function.is_null() && 312 if (!single_function.is_null() &&
317 !single_function.ToHandleChecked()->IsUndefined(isolate)) { 313 !single_function.ToHandleChecked()->IsUndefined(isolate)) {
318 return single_function; 314 return single_function;
319 } 315 }
320 316
321 if (FLAG_trace_asm_time) { 317 i::Handle<i::Script> script(i::Script::cast(wasm_data->get(kWasmDataScript)));
322 i::Handle<i::Script> script( 318 int32_t position = 0;
323 i::Script::cast(wasm_data->get(kWasmDataScript))); 319 if (!wasm_data->get(kWasmDataScriptPosition)->ToInt32(&position)) {
324 int32_t position = 0; 320 UNREACHABLE();
325 if (!wasm_data->get(kWasmDataScriptPosition)->ToInt32(&position)) { 321 }
326 UNREACHABLE(); 322 MessageLocation location(script, position, position);
327 } 323 char text[50];
328 MessageLocation location(script, position, position); 324 int length =
329 char text[50]; 325 base::OS::SNPrintF(text, arraysize(text), "success, %0.3f ms",
330 int length = 326 instantiate_timer.Elapsed().InMillisecondsF());
331 base::OS::SNPrintF(text, arraysize(text), "success, %0.3f ms", 327 DCHECK_NE(-1, length);
332 instantiate_timer.Elapsed().InMillisecondsF()); 328 USE(length);
333 DCHECK_NE(-1, length); 329 Handle<String> stext(isolate->factory()->InternalizeUtf8String(text));
334 USE(length); 330 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject(
335 Handle<String> stext(isolate->factory()->InternalizeUtf8String(text)); 331 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext,
336 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( 332 Handle<JSArray>::null());
337 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, 333 message->set_error_level(v8::Isolate::kMessageInfo);
338 Handle<JSArray>::null()); 334 if (FLAG_trace_asm_time && !FLAG_suppress_asm_messages) {
339 message->set_error_level(v8::Isolate::kMessageInfo); 335 MessageHandler::ReportMessage(isolate, &location, message);
340 if (!FLAG_suppress_asm_messages) {
341 MessageHandler::ReportMessage(isolate, &location, message);
342 }
343 } 336 }
344 337
345 return module_object; 338 return module_object;
346 } 339 }
347 340
348 } // namespace internal 341 } // namespace internal
349 } // namespace v8 342 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698