OLD | NEW |
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-parser.h" | 9 #include "src/asmjs/asm-parser.h" |
10 #include "src/asmjs/asm-typer.h" | 10 #include "src/asmjs/asm-typer.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 MessageLocation location(info->script(), parser.failure_location(), | 182 MessageLocation location(info->script(), parser.failure_location(), |
183 parser.failure_location()); | 183 parser.failure_location()); |
184 Handle<String> message = | 184 Handle<String> message = |
185 info->isolate() | 185 info->isolate() |
186 ->factory() | 186 ->factory() |
187 ->NewStringFromUtf8(CStrVector(parser.failure_message())) | 187 ->NewStringFromUtf8(CStrVector(parser.failure_message())) |
188 .ToHandleChecked(); | 188 .ToHandleChecked(); |
189 Handle<JSMessageObject> error_message = | 189 Handle<JSMessageObject> error_message = |
190 MessageHandler::MakeMessageObject( | 190 MessageHandler::MakeMessageObject( |
191 info->isolate(), MessageTemplate::kAsmJsInvalid, &location, | 191 info->isolate(), MessageTemplate::kAsmJsInvalid, &location, |
192 message, Handle<JSArray>::null()); | 192 message, Handle<FixedArray>::null()); |
193 error_message->set_error_level(v8::Isolate::kMessageWarning); | 193 error_message->set_error_level(v8::Isolate::kMessageWarning); |
194 MessageHandler::ReportMessage(info->isolate(), &location, | 194 MessageHandler::ReportMessage(info->isolate(), &location, |
195 error_message); | 195 error_message); |
196 } | 196 } |
197 return MaybeHandle<FixedArray>(); | 197 return MaybeHandle<FixedArray>(); |
198 } | 198 } |
199 Zone* zone = info->zone(); | 199 Zone* zone = info->zone(); |
200 module = new (zone) wasm::ZoneBuffer(zone); | 200 module = new (zone) wasm::ZoneBuffer(zone); |
201 parser.module_builder()->WriteTo(*module); | 201 parser.module_builder()->WriteTo(*module); |
202 asm_offsets = new (zone) wasm::ZoneBuffer(zone); | 202 asm_offsets = new (zone) wasm::ZoneBuffer(zone); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 length = base::OS::SNPrintF( | 268 length = base::OS::SNPrintF( |
269 text, arraysize(text), | 269 text, arraysize(text), |
270 "success, asm->wasm: %0.3f ms, compile: %0.3f ms, %" PRIuPTR " bytes", | 270 "success, asm->wasm: %0.3f ms, compile: %0.3f ms, %" PRIuPTR " bytes", |
271 asm_wasm_time, compile_time, wasm_size); | 271 asm_wasm_time, compile_time, wasm_size); |
272 } | 272 } |
273 DCHECK_NE(-1, length); | 273 DCHECK_NE(-1, length); |
274 USE(length); | 274 USE(length); |
275 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text)); | 275 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text)); |
276 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( | 276 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( |
277 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext, | 277 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext, |
278 Handle<JSArray>::null()); | 278 Handle<FixedArray>::null()); |
279 message->set_error_level(v8::Isolate::kMessageInfo); | 279 message->set_error_level(v8::Isolate::kMessageInfo); |
280 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { | 280 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { |
281 MessageHandler::ReportMessage(info->isolate(), &location, message); | 281 MessageHandler::ReportMessage(info->isolate(), &location, message); |
282 } | 282 } |
283 | 283 |
284 return result; | 284 return result; |
285 } | 285 } |
286 | 286 |
287 bool AsmJs::IsStdlibValid(i::Isolate* isolate, Handle<FixedArray> wasm_data, | 287 bool AsmJs::IsStdlibValid(i::Isolate* isolate, Handle<FixedArray> wasm_data, |
288 Handle<JSReceiver> stdlib) { | 288 Handle<JSReceiver> stdlib) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 length = base::OS::SNPrintF(text, arraysize(text), "success"); | 381 length = base::OS::SNPrintF(text, arraysize(text), "success"); |
382 } else { | 382 } else { |
383 length = base::OS::SNPrintF(text, arraysize(text), "success, %0.3f ms", | 383 length = base::OS::SNPrintF(text, arraysize(text), "success, %0.3f ms", |
384 instantiate_timer.Elapsed().InMillisecondsF()); | 384 instantiate_timer.Elapsed().InMillisecondsF()); |
385 } | 385 } |
386 DCHECK_NE(-1, length); | 386 DCHECK_NE(-1, length); |
387 USE(length); | 387 USE(length); |
388 Handle<String> stext(isolate->factory()->InternalizeUtf8String(text)); | 388 Handle<String> stext(isolate->factory()->InternalizeUtf8String(text)); |
389 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( | 389 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( |
390 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, | 390 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, |
391 Handle<JSArray>::null()); | 391 Handle<FixedArray>::null()); |
392 message->set_error_level(v8::Isolate::kMessageInfo); | 392 message->set_error_level(v8::Isolate::kMessageInfo); |
393 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { | 393 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { |
394 MessageHandler::ReportMessage(isolate, &location, message); | 394 MessageHandler::ReportMessage(isolate, &location, message); |
395 } | 395 } |
396 | 396 |
397 Handle<String> exports_name = | 397 Handle<String> exports_name = |
398 isolate->factory()->InternalizeUtf8String("exports"); | 398 isolate->factory()->InternalizeUtf8String("exports"); |
399 return i::Object::GetProperty(module_object, exports_name); | 399 return i::Object::GetProperty(module_object, exports_name); |
400 } | 400 } |
401 | 401 |
402 } // namespace internal | 402 } // namespace internal |
403 } // namespace v8 | 403 } // namespace v8 |
OLD | NEW |