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 // Ensure handler table is generated. |
39 Handle<FixedArray> interpreter_table = | 39 isolate->interpreter()->Initialize(); |
40 isolate->factory()->interpreter_table(); | |
41 if (interpreter_table.is_identical_to(empty_array)) { | |
42 // Ensure handler table is generated. | |
43 isolate->interpreter()->Initialize(true); | |
44 } | |
45 } | 40 } |
46 virtual ~InterpreterTester() {} | 41 virtual ~InterpreterTester() {} |
47 | 42 |
48 InterpreterCallable GetCallable() { | 43 InterpreterCallable GetCallable() { |
49 return InterpreterCallable(isolate_, function_); | 44 return InterpreterCallable(isolate_, function_); |
50 } | 45 } |
51 | 46 |
52 private: | 47 private: |
53 Isolate* isolate_; | 48 Isolate* isolate_; |
54 Handle<JSFunction> function_; | 49 Handle<JSFunction> function_; |
(...skipping 26 matching lines...) Expand all Loading... |
81 // register file. | 76 // register file. |
82 builder.set_locals_count(1); | 77 builder.set_locals_count(1); |
83 builder.Return(); | 78 builder.Return(); |
84 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); | 79 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
85 | 80 |
86 InterpreterTester tester(handles.main_isolate(), bytecode_array); | 81 InterpreterTester tester(handles.main_isolate(), bytecode_array); |
87 InterpreterCallable callable(tester.GetCallable()); | 82 InterpreterCallable callable(tester.GetCallable()); |
88 Handle<Object> return_val = callable().ToHandleChecked(); | 83 Handle<Object> return_val = callable().ToHandleChecked(); |
89 CHECK(return_val.is_identical_to(undefined_value)); | 84 CHECK(return_val.is_identical_to(undefined_value)); |
90 } | 85 } |
OLD | NEW |