| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 MaybeHandle<FixedArray> AsmJs::ConvertAsmToWasm(ParseInfo* info) { | 154 MaybeHandle<FixedArray> AsmJs::ConvertAsmToWasm(ParseInfo* info) { |
| 155 ErrorThrower thrower(info->isolate(), "Asm.js -> WebAssembly conversion"); | 155 ErrorThrower thrower(info->isolate(), "Asm.js -> WebAssembly conversion"); |
| 156 wasm::AsmWasmBuilder builder(info->isolate(), info->zone(), | 156 wasm::AsmWasmBuilder builder(info->isolate(), info->zone(), |
| 157 info->ast_value_factory(), info->script(), | 157 info->ast_value_factory(), info->script(), |
| 158 info->literal()); | 158 info->literal()); |
| 159 Handle<FixedArray> foreign_globals; | 159 Handle<FixedArray> foreign_globals; |
| 160 auto asm_wasm_result = builder.Run(&foreign_globals); | 160 auto asm_wasm_result = builder.Run(&foreign_globals); |
| 161 if (!asm_wasm_result.success) { | 161 if (!asm_wasm_result.success) { |
| 162 DCHECK(!info->isolate()->has_pending_exception()); | 162 DCHECK(!info->isolate()->has_pending_exception()); |
| 163 PrintF("Validation of asm.js module failed: %s\n", | 163 MessageHandler::ReportMessage(info->isolate(), |
| 164 builder.typer()->error_message()); | 164 builder.typer()->message_location(), |
| 165 builder.typer()->error_message()); |
| 165 return MaybeHandle<FixedArray>(); | 166 return MaybeHandle<FixedArray>(); |
| 166 } | 167 } |
| 167 wasm::ZoneBuffer* module = asm_wasm_result.module_bytes; | 168 wasm::ZoneBuffer* module = asm_wasm_result.module_bytes; |
| 168 wasm::ZoneBuffer* asm_offsets = asm_wasm_result.asm_offset_table; | 169 wasm::ZoneBuffer* asm_offsets = asm_wasm_result.asm_offset_table; |
| 169 | 170 |
| 170 MaybeHandle<JSObject> compiled = wasm::CreateModuleObjectFromBytes( | 171 MaybeHandle<JSObject> compiled = wasm::CreateModuleObjectFromBytes( |
| 171 info->isolate(), module->begin(), module->end(), &thrower, | 172 info->isolate(), module->begin(), module->end(), &thrower, |
| 172 internal::wasm::kAsmJsOrigin, info->script(), asm_offsets->begin(), | 173 internal::wasm::kAsmJsOrigin, info->script(), asm_offsets->begin(), |
| 173 asm_offsets->end()); | 174 asm_offsets->end()); |
| 174 DCHECK(!compiled.is_null()); | 175 DCHECK(!compiled.is_null()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 i::Object::GetProperty(module_object, single_function_name); | 257 i::Object::GetProperty(module_object, single_function_name); |
| 257 if (!single_function.is_null() && | 258 if (!single_function.is_null() && |
| 258 !single_function.ToHandleChecked()->IsUndefined(isolate)) { | 259 !single_function.ToHandleChecked()->IsUndefined(isolate)) { |
| 259 return single_function; | 260 return single_function; |
| 260 } | 261 } |
| 261 return module_object; | 262 return module_object; |
| 262 } | 263 } |
| 263 | 264 |
| 264 } // namespace internal | 265 } // namespace internal |
| 265 } // namespace v8 | 266 } // namespace v8 |
| OLD | NEW |