| 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/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 CHECK(!code.is_null()); | 199 CHECK(!code.is_null()); |
| 200 info.dependencies()->Commit(code); | 200 info.dependencies()->Commit(code); |
| 201 info.context()->native_context()->AddOptimizedCode(*code); | 201 info.context()->native_context()->AddOptimizedCode(*code); |
| 202 function->ReplaceCode(*code); | 202 function->ReplaceCode(*code); |
| 203 return function; | 203 return function; |
| 204 } | 204 } |
| 205 | 205 |
| 206 std::string BuildFunction(int param_count) { | 206 std::string BuildFunction(int param_count) { |
| 207 std::string function_string = "(function("; | 207 std::string function_string = "(function("; |
| 208 if (param_count > 0) { | 208 if (param_count > 0) { |
| 209 char next = 'a'; | 209 function_string += 'a'; |
| 210 function_string += next; | 210 for (int i = 1; i < param_count; i++) { |
| 211 while (param_count-- > 0) { | |
| 212 function_string += ','; | 211 function_string += ','; |
| 213 function_string += ++next; | 212 function_string += static_cast<char>('a' + i); |
| 214 } | 213 } |
| 215 } | 214 } |
| 216 function_string += "){})"; | 215 function_string += "){})"; |
| 217 return function_string; | 216 return function_string; |
| 218 } | 217 } |
| 219 | 218 |
| 220 std::string BuildFunctionFromDescriptor( | 219 std::string BuildFunctionFromDescriptor( |
| 221 const CallInterfaceDescriptor& descriptor) { | 220 const CallInterfaceDescriptor& descriptor) { |
| 222 return BuildFunction(descriptor.GetParameterCount()); | 221 return BuildFunction(descriptor.GetParameterCount()); |
| 223 } | 222 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 238 CHECK(!code.is_null()); | 237 CHECK(!code.is_null()); |
| 239 function->ReplaceCode(*code); | 238 function->ReplaceCode(*code); |
| 240 return function; | 239 return function; |
| 241 } | 240 } |
| 242 }; | 241 }; |
| 243 } // namespace compiler | 242 } // namespace compiler |
| 244 } // namespace internal | 243 } // namespace internal |
| 245 } // namespace v8 | 244 } // namespace v8 |
| 246 | 245 |
| 247 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 246 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| OLD | NEW |