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/macro-assembler.h" | 5 #include "src/macro-assembler.h" |
6 #include "src/objects.h" | 6 #include "src/objects.h" |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/simulator.h" | 9 #include "src/simulator.h" |
10 | 10 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 509 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
510 const byte* module_end, bool asm_js) { | 510 const byte* module_end, bool asm_js) { |
511 HandleScope scope(isolate); | 511 HandleScope scope(isolate); |
512 Zone zone; | 512 Zone zone; |
513 // Decode the module, but don't verify function bodies, since we'll | 513 // Decode the module, but don't verify function bodies, since we'll |
514 // be compiling them anyway. | 514 // be compiling them anyway. |
515 ModuleResult result = DecodeWasmModule(isolate, &zone, module_start, | 515 ModuleResult result = DecodeWasmModule(isolate, &zone, module_start, |
516 module_end, false, kWasmOrigin); | 516 module_end, false, kWasmOrigin); |
517 if (result.failed()) { | 517 if (result.failed()) { |
| 518 if (result.val) { |
| 519 delete result.val; |
| 520 } |
518 // Module verification failed. throw. | 521 // Module verification failed. throw. |
519 std::ostringstream str; | 522 std::ostringstream str; |
520 str << "WASM.compileRun() failed: " << result; | 523 str << "WASM.compileRun() failed: " << result; |
521 isolate->Throw( | 524 isolate->Throw( |
522 *isolate->factory()->NewStringFromAsciiChecked(str.str().c_str())); | 525 *isolate->factory()->NewStringFromAsciiChecked(str.str().c_str())); |
523 return -1; | 526 return -1; |
524 } | 527 } |
525 | 528 |
526 int32_t retval = CompileAndRunWasmModule(isolate, result.val); | 529 int32_t retval = CompileAndRunWasmModule(isolate, result.val); |
527 delete result.val; | 530 delete result.val; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } | 609 } |
607 if (result->IsHeapNumber()) { | 610 if (result->IsHeapNumber()) { |
608 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); | 611 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); |
609 } | 612 } |
610 thrower.Error("WASM.compileRun() failed: Return value should be number"); | 613 thrower.Error("WASM.compileRun() failed: Return value should be number"); |
611 return -1; | 614 return -1; |
612 } | 615 } |
613 } // namespace wasm | 616 } // namespace wasm |
614 } // namespace internal | 617 } // namespace internal |
615 } // namespace v8 | 618 } // namespace v8 |
OLD | NEW |