| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/execution.h" | 7 #include "src/execution.h" |
| 8 #include "src/handles.h" | 8 #include "src/handles.h" |
| 9 #include "src/interpreter/bytecode-array-builder.h" | 9 #include "src/interpreter/bytecode-array-builder.h" |
| 10 #include "src/interpreter/interpreter.h" | 10 #include "src/interpreter/interpreter.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 private: | 28 private: |
| 29 Isolate* isolate_; | 29 Isolate* isolate_; |
| 30 Handle<JSFunction> function_; | 30 Handle<JSFunction> function_; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 class InterpreterTester { | 33 class InterpreterTester { |
| 34 public: | 34 public: |
| 35 InterpreterTester(Isolate* isolate, Handle<BytecodeArray> bytecode) | 35 InterpreterTester(Isolate* isolate, Handle<BytecodeArray> bytecode) |
| 36 : isolate_(isolate), function_(GetBytecodeFunction(isolate, bytecode)) { | 36 : isolate_(isolate), function_(GetBytecodeFunction(isolate, bytecode)) { |
| 37 i::FLAG_ignition = true; | 37 i::FLAG_ignition = true; |
| 38 Handle<FixedArray> empty_array = isolate->factory()->empty_fixed_array(); | 38 if (!isolate->interpreter()->initialized()) { |
| 39 Handle<FixedArray> interpreter_table = | |
| 40 isolate->factory()->interpreter_table(); | |
| 41 if (interpreter_table.is_identical_to(empty_array)) { | |
| 42 // Ensure handler table is generated. | 39 // Ensure handler table is generated. |
| 43 isolate->interpreter()->Initialize(true); | 40 isolate->interpreter()->Initialize(false); |
| 44 } | 41 } |
| 45 } | 42 } |
| 46 virtual ~InterpreterTester() {} | 43 virtual ~InterpreterTester() {} |
| 47 | 44 |
| 48 InterpreterCallable GetCallable() { | 45 InterpreterCallable GetCallable() { |
| 49 return InterpreterCallable(isolate_, function_); | 46 return InterpreterCallable(isolate_, function_); |
| 50 } | 47 } |
| 51 | 48 |
| 52 private: | 49 private: |
| 53 Isolate* isolate_; | 50 Isolate* isolate_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 81 // register file. | 78 // register file. |
| 82 builder.set_locals_count(1); | 79 builder.set_locals_count(1); |
| 83 builder.Return(); | 80 builder.Return(); |
| 84 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); | 81 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
| 85 | 82 |
| 86 InterpreterTester tester(handles.main_isolate(), bytecode_array); | 83 InterpreterTester tester(handles.main_isolate(), bytecode_array); |
| 87 InterpreterCallable callable(tester.GetCallable()); | 84 InterpreterCallable callable(tester.GetCallable()); |
| 88 Handle<Object> return_val = callable().ToHandleChecked(); | 85 Handle<Object> return_val = callable().ToHandleChecked(); |
| 89 CHECK(return_val.is_identical_to(undefined_value)); | 86 CHECK(return_val.is_identical_to(undefined_value)); |
| 90 } | 87 } |
| OLD | NEW |