| 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-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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 MaybeHandle<FixedArray> AsmJs::CompileAsmViaWasm(CompilationInfo* info) { | 164 MaybeHandle<FixedArray> AsmJs::CompileAsmViaWasm(CompilationInfo* info) { |
| 165 ErrorThrower thrower(info->isolate(), "Asm.js -> WebAssembly conversion"); | 165 ErrorThrower thrower(info->isolate(), "Asm.js -> WebAssembly conversion"); |
| 166 base::ElapsedTimer asm_wasm_timer; | 166 base::ElapsedTimer asm_wasm_timer; |
| 167 asm_wasm_timer.Start(); | 167 asm_wasm_timer.Start(); |
| 168 wasm::AsmWasmBuilder builder(info); | 168 wasm::AsmWasmBuilder builder(info); |
| 169 Handle<FixedArray> foreign_globals; | 169 Handle<FixedArray> foreign_globals; |
| 170 auto asm_wasm_result = builder.Run(&foreign_globals); | 170 auto asm_wasm_result = builder.Run(&foreign_globals); |
| 171 if (!asm_wasm_result.success) { | 171 if (!asm_wasm_result.success) { |
| 172 DCHECK(!info->isolate()->has_pending_exception()); | 172 DCHECK(!info->isolate()->has_pending_exception()); |
| 173 MessageHandler::ReportMessage(info->isolate(), | 173 if (!FLAG_suppress_asm_messages) { |
| 174 builder.typer()->message_location(), | 174 MessageHandler::ReportMessage(info->isolate(), |
| 175 builder.typer()->error_message()); | 175 builder.typer()->message_location(), |
| 176 builder.typer()->error_message()); |
| 177 } |
| 176 return MaybeHandle<FixedArray>(); | 178 return MaybeHandle<FixedArray>(); |
| 177 } | 179 } |
| 178 double asm_wasm_time = asm_wasm_timer.Elapsed().InMillisecondsF(); | 180 double asm_wasm_time = asm_wasm_timer.Elapsed().InMillisecondsF(); |
| 179 | 181 |
| 180 wasm::ZoneBuffer* module = asm_wasm_result.module_bytes; | 182 wasm::ZoneBuffer* module = asm_wasm_result.module_bytes; |
| 181 wasm::ZoneBuffer* asm_offsets = asm_wasm_result.asm_offset_table; | 183 wasm::ZoneBuffer* asm_offsets = asm_wasm_result.asm_offset_table; |
| 182 Vector<const byte> asm_offsets_vec(asm_offsets->begin(), | 184 Vector<const byte> asm_offsets_vec(asm_offsets->begin(), |
| 183 static_cast<int>(asm_offsets->size())); | 185 static_cast<int>(asm_offsets->size())); |
| 184 | 186 |
| 185 base::ElapsedTimer compile_timer; | 187 base::ElapsedTimer compile_timer; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } else { | 221 } else { |
| 220 length = base::OS::SNPrintF(text, arraysize(text), "success"); | 222 length = base::OS::SNPrintF(text, arraysize(text), "success"); |
| 221 } | 223 } |
| 222 DCHECK_NE(-1, length); | 224 DCHECK_NE(-1, length); |
| 223 USE(length); | 225 USE(length); |
| 224 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text)); | 226 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text)); |
| 225 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( | 227 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( |
| 226 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext, | 228 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext, |
| 227 Handle<JSArray>::null()); | 229 Handle<JSArray>::null()); |
| 228 message->set_error_level(v8::Isolate::kMessageInfo); | 230 message->set_error_level(v8::Isolate::kMessageInfo); |
| 229 MessageHandler::ReportMessage(info->isolate(), &location, message); | 231 if (!FLAG_suppress_asm_messages) { |
| 232 MessageHandler::ReportMessage(info->isolate(), &location, message); |
| 233 } |
| 230 | 234 |
| 231 return result; | 235 return result; |
| 232 } | 236 } |
| 233 | 237 |
| 234 bool AsmJs::IsStdlibValid(i::Isolate* isolate, Handle<FixedArray> wasm_data, | 238 bool AsmJs::IsStdlibValid(i::Isolate* isolate, Handle<FixedArray> wasm_data, |
| 235 Handle<JSReceiver> stdlib) { | 239 Handle<JSReceiver> stdlib) { |
| 236 i::Handle<i::FixedArray> uses( | 240 i::Handle<i::FixedArray> uses( |
| 237 i::FixedArray::cast(wasm_data->get(kWasmDataUsesArray))); | 241 i::FixedArray::cast(wasm_data->get(kWasmDataUsesArray))); |
| 238 for (int i = 0; i < uses->length(); ++i) { | 242 for (int i = 0; i < uses->length(); ++i) { |
| 239 if (!IsStdlibMemberValid(isolate, stdlib, | 243 if (!IsStdlibMemberValid(isolate, stdlib, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, | 341 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, |
| 338 Handle<JSArray>::null()); | 342 Handle<JSArray>::null()); |
| 339 message->set_error_level(v8::Isolate::kMessageInfo); | 343 message->set_error_level(v8::Isolate::kMessageInfo); |
| 340 MessageHandler::ReportMessage(isolate, &location, message); | 344 MessageHandler::ReportMessage(isolate, &location, message); |
| 341 | 345 |
| 342 return module_object; | 346 return module_object; |
| 343 } | 347 } |
| 344 | 348 |
| 345 } // namespace internal | 349 } // namespace internal |
| 346 } // namespace v8 | 350 } // namespace v8 |
| OLD | NEW |