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_FUNCTION_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 #include "test/cctest/cctest.h" | 9 #include "test/cctest/cctest.h" |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 void CheckFalse(Handle<Object> a) { | 115 void CheckFalse(Handle<Object> a) { |
116 CheckCall(false_value(), a, undefined()); | 116 CheckCall(false_value(), a, undefined()); |
117 } | 117 } |
118 | 118 |
119 void CheckFalse(double a, double b) { | 119 void CheckFalse(double a, double b) { |
120 CheckCall(false_value(), Val(a), Val(b)); | 120 CheckCall(false_value(), Val(a), Val(b)); |
121 } | 121 } |
122 | 122 |
123 Handle<JSFunction> NewFunction(const char* source) { | 123 Handle<JSFunction> NewFunction(const char* source) { |
124 return v8::Utils::OpenHandle( | 124 return Handle<JSFunction>::cast(v8::Utils::OpenHandle( |
125 *v8::Local<v8::Function>::Cast(CompileRun(source))); | 125 *v8::Local<v8::Function>::Cast(CompileRun(source)))); |
126 } | 126 } |
127 | 127 |
128 Handle<JSObject> NewObject(const char* source) { | 128 Handle<JSObject> NewObject(const char* source) { |
129 return v8::Utils::OpenHandle( | 129 return v8::Utils::OpenHandle( |
130 *v8::Local<v8::Object>::Cast(CompileRun(source))); | 130 *v8::Local<v8::Object>::Cast(CompileRun(source))); |
131 } | 131 } |
132 | 132 |
133 Handle<String> Val(const char* string) { | 133 Handle<String> Val(const char* string) { |
134 return isolate->factory()->InternalizeUtf8String(string); | 134 return isolate->factory()->InternalizeUtf8String(string); |
135 } | 135 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 CHECK(!code.is_null()); | 210 CHECK(!code.is_null()); |
211 function->ReplaceCode(*code); | 211 function->ReplaceCode(*code); |
212 return function; | 212 return function; |
213 } | 213 } |
214 }; | 214 }; |
215 } // namespace compiler | 215 } // namespace compiler |
216 } // namespace internal | 216 } // namespace internal |
217 } // namespace v8 | 217 } // namespace v8 |
218 | 218 |
219 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 219 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
OLD | NEW |