OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
6 #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler/instruction-selector.h" | 10 #include "src/compiler/instruction-selector.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 void CheckString(const char* expected, Object* string) { | 47 void CheckString(const char* expected, Object* string) { |
48 CHECK( | 48 CHECK( |
49 this->isolate()->factory()->InternalizeUtf8String(expected)->SameValue( | 49 this->isolate()->factory()->InternalizeUtf8String(expected)->SameValue( |
50 string)); | 50 string)); |
51 } | 51 } |
52 | 52 |
53 void GenerateCode() { Generate(); } | 53 void GenerateCode() { Generate(); } |
54 | 54 |
| 55 Handle<Code> GetCode() { |
| 56 Generate(); |
| 57 return code_.ToHandleChecked(); |
| 58 } |
| 59 |
55 protected: | 60 protected: |
56 virtual byte* Generate() { | 61 virtual byte* Generate() { |
57 if (code_.is_null()) { | 62 if (code_.is_null()) { |
58 Schedule* schedule = this->Export(); | 63 Schedule* schedule = this->Export(); |
59 CallDescriptor* call_descriptor = this->call_descriptor(); | 64 CallDescriptor* call_descriptor = this->call_descriptor(); |
60 Graph* graph = this->graph(); | 65 Graph* graph = this->graph(); |
61 CompilationInfo info("testing", main_isolate(), main_zone()); | 66 CompilationInfo info("testing", main_isolate(), main_zone()); |
62 code_ = Pipeline::GenerateCodeForTesting(&info, call_descriptor, graph, | 67 code_ = Pipeline::GenerateCodeForTesting(&info, call_descriptor, graph, |
63 schedule); | 68 schedule); |
64 } | 69 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } else { | 320 } else { |
316 CHECK_EQ(x, y); | 321 CHECK_EQ(x, y); |
317 } | 322 } |
318 } | 323 } |
319 | 324 |
320 } // namespace compiler | 325 } // namespace compiler |
321 } // namespace internal | 326 } // namespace internal |
322 } // namespace v8 | 327 } // namespace v8 |
323 | 328 |
324 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 329 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
OLD | NEW |