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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 DCHECK(!info->isolate()->has_pending_exception()); | 172 DCHECK(!info->isolate()->has_pending_exception()); |
173 MessageHandler::ReportMessage(info->isolate(), | 173 MessageHandler::ReportMessage(info->isolate(), |
174 builder.typer()->message_location(), | 174 builder.typer()->message_location(), |
175 builder.typer()->error_message()); | 175 builder.typer()->error_message()); |
176 return MaybeHandle<FixedArray>(); | 176 return MaybeHandle<FixedArray>(); |
177 } | 177 } |
178 double asm_wasm_time = asm_wasm_timer.Elapsed().InMillisecondsF(); | 178 double asm_wasm_time = asm_wasm_timer.Elapsed().InMillisecondsF(); |
179 | 179 |
180 wasm::ZoneBuffer* module = asm_wasm_result.module_bytes; | 180 wasm::ZoneBuffer* module = asm_wasm_result.module_bytes; |
181 wasm::ZoneBuffer* asm_offsets = asm_wasm_result.asm_offset_table; | 181 wasm::ZoneBuffer* asm_offsets = asm_wasm_result.asm_offset_table; |
| 182 Vector<const byte> asm_offsets_vec(asm_offsets->begin(), |
| 183 static_cast<int>(asm_offsets->size())); |
182 | 184 |
183 base::ElapsedTimer compile_timer; | 185 base::ElapsedTimer compile_timer; |
184 compile_timer.Start(); | 186 compile_timer.Start(); |
185 MaybeHandle<JSObject> compiled = wasm::CreateModuleObjectFromBytes( | 187 MaybeHandle<JSObject> compiled = wasm::CreateModuleObjectFromBytes( |
186 info->isolate(), module->begin(), module->end(), &thrower, | 188 info->isolate(), module->begin(), module->end(), &thrower, |
187 internal::wasm::kAsmJsOrigin, info->script(), asm_offsets->begin(), | 189 internal::wasm::kAsmJsOrigin, info->script(), asm_offsets_vec); |
188 asm_offsets->end()); | |
189 DCHECK(!compiled.is_null()); | 190 DCHECK(!compiled.is_null()); |
190 double compile_time = compile_timer.Elapsed().InMillisecondsF(); | 191 double compile_time = compile_timer.Elapsed().InMillisecondsF(); |
191 | 192 |
192 wasm::AsmTyper::StdlibSet uses = builder.typer()->StdlibUses(); | 193 wasm::AsmTyper::StdlibSet uses = builder.typer()->StdlibUses(); |
193 Handle<FixedArray> uses_array = | 194 Handle<FixedArray> uses_array = |
194 info->isolate()->factory()->NewFixedArray(static_cast<int>(uses.size())); | 195 info->isolate()->factory()->NewFixedArray(static_cast<int>(uses.size())); |
195 int count = 0; | 196 int count = 0; |
196 for (auto i : uses) { | 197 for (auto i : uses) { |
197 uses_array->set(count++, Smi::FromInt(i)); | 198 uses_array->set(count++, Smi::FromInt(i)); |
198 } | 199 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, | 327 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, |
327 Handle<JSArray>::null()); | 328 Handle<JSArray>::null()); |
328 message->set_error_level(v8::Isolate::kMessageInfo); | 329 message->set_error_level(v8::Isolate::kMessageInfo); |
329 MessageHandler::ReportMessage(isolate, &location, message); | 330 MessageHandler::ReportMessage(isolate, &location, message); |
330 | 331 |
331 return module_object; | 332 return module_object; |
332 } | 333 } |
333 | 334 |
334 } // namespace internal | 335 } // namespace internal |
335 } // namespace v8 | 336 } // namespace v8 |
OLD | NEW |