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

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

Issue 2574273002: [wasm][asm.js] Print a deterministic success result by default. (Closed)
Patch Set: fix Created 4 years 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 | src/flag-definitions.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/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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 result->set(kWasmDataCompiledModule, *compiled.ToHandleChecked()); 203 result->set(kWasmDataCompiledModule, *compiled.ToHandleChecked());
204 result->set(kWasmDataForeignGlobals, *foreign_globals); 204 result->set(kWasmDataForeignGlobals, *foreign_globals);
205 result->set(kWasmDataUsesArray, *uses_array); 205 result->set(kWasmDataUsesArray, *uses_array);
206 result->set(kWasmDataScript, *info->script()); 206 result->set(kWasmDataScript, *info->script());
207 result->set(kWasmDataScriptPosition, 207 result->set(kWasmDataScriptPosition,
208 Smi::FromInt(info->literal()->position())); 208 Smi::FromInt(info->literal()->position()));
209 209
210 MessageLocation location(info->script(), info->literal()->position(), 210 MessageLocation location(info->script(), info->literal()->position(),
211 info->literal()->position()); 211 info->literal()->position());
212 char text[100]; 212 char text[100];
213 int length = base::OS::SNPrintF(text, arraysize(text), 213 int length;
214 "asm->wasm: %0.3f ms, compile: %0.3f ms", 214 if (FLAG_trace_asm_time) {
215 asm_wasm_time, compile_time); 215 length =
216 base::OS::SNPrintF(text, arraysize(text),
217 "success, asm->wasm: %0.3f ms, compile: %0.3f ms",
218 asm_wasm_time, compile_time);
219 } else {
220 length = base::OS::SNPrintF(text, arraysize(text), "success");
221 }
216 DCHECK_NE(-1, length); 222 DCHECK_NE(-1, length);
217 USE(length); 223 USE(length);
218 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text)); 224 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text));
219 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( 225 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject(
220 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext, 226 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext,
221 Handle<JSArray>::null()); 227 Handle<JSArray>::null());
222 message->set_error_level(v8::Isolate::kMessageInfo); 228 message->set_error_level(v8::Isolate::kMessageInfo);
223 MessageHandler::ReportMessage(info->isolate(), &location, message); 229 MessageHandler::ReportMessage(info->isolate(), &location, message);
224 230
225 return result; 231 return result;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 return single_function; 306 return single_function;
301 } 307 }
302 308
303 i::Handle<i::Script> script(i::Script::cast(wasm_data->get(kWasmDataScript))); 309 i::Handle<i::Script> script(i::Script::cast(wasm_data->get(kWasmDataScript)));
304 int32_t position = 0; 310 int32_t position = 0;
305 if (!wasm_data->get(kWasmDataScriptPosition)->ToInt32(&position)) { 311 if (!wasm_data->get(kWasmDataScriptPosition)->ToInt32(&position)) {
306 UNREACHABLE(); 312 UNREACHABLE();
307 } 313 }
308 MessageLocation location(script, position, position); 314 MessageLocation location(script, position, position);
309 char text[50]; 315 char text[50];
310 int length = 316 int length;
311 base::OS::SNPrintF(text, arraysize(text), "%0.3f ms", 317 if (FLAG_trace_asm_time) {
312 instantiate_timer.Elapsed().InMillisecondsF()); 318 length = base::OS::SNPrintF(text, arraysize(text), "success, %0.3f ms",
319 instantiate_timer.Elapsed().InMillisecondsF());
320 } else {
321 length = base::OS::SNPrintF(text, arraysize(text), "success");
322 }
313 DCHECK_NE(-1, length); 323 DCHECK_NE(-1, length);
314 USE(length); 324 USE(length);
315 Handle<String> stext(isolate->factory()->InternalizeUtf8String(text)); 325 Handle<String> stext(isolate->factory()->InternalizeUtf8String(text));
316 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( 326 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject(
317 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, 327 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext,
318 Handle<JSArray>::null()); 328 Handle<JSArray>::null());
319 message->set_error_level(v8::Isolate::kMessageInfo); 329 message->set_error_level(v8::Isolate::kMessageInfo);
320 MessageHandler::ReportMessage(isolate, &location, message); 330 MessageHandler::ReportMessage(isolate, &location, message);
321 331
322 return module_object; 332 return module_object;
323 } 333 }
324 334
325 } // namespace internal 335 } // namespace internal
326 } // namespace v8 336 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698