OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "accessors.h" | 10 #include "accessors.h" |
(...skipping 14685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14696 #ifdef DEBUG | 14696 #ifdef DEBUG |
14697 // ListNatives is ONLY used by the fuzz-natives.js in debug mode | 14697 // ListNatives is ONLY used by the fuzz-natives.js in debug mode |
14698 // Exclude the code in release mode. | 14698 // Exclude the code in release mode. |
14699 RUNTIME_FUNCTION(Runtime_ListNatives) { | 14699 RUNTIME_FUNCTION(Runtime_ListNatives) { |
14700 HandleScope scope(isolate); | 14700 HandleScope scope(isolate); |
14701 ASSERT(args.length() == 0); | 14701 ASSERT(args.length() == 0); |
14702 #define COUNT_ENTRY(Name, argc, ressize) + 1 | 14702 #define COUNT_ENTRY(Name, argc, ressize) + 1 |
14703 int entry_count = 0 | 14703 int entry_count = 0 |
14704 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) | 14704 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) |
14705 RUNTIME_HIDDEN_FUNCTION_LIST(COUNT_ENTRY) | 14705 RUNTIME_HIDDEN_FUNCTION_LIST(COUNT_ENTRY) |
14706 INLINE_FUNCTION_LIST(COUNT_ENTRY); | 14706 INLINE_FUNCTION_LIST(COUNT_ENTRY) |
| 14707 INLINE_OPTIMIZED_FUNCTION_LIST(COUNT_ENTRY); |
14707 #undef COUNT_ENTRY | 14708 #undef COUNT_ENTRY |
14708 Factory* factory = isolate->factory(); | 14709 Factory* factory = isolate->factory(); |
14709 Handle<FixedArray> elements = factory->NewFixedArray(entry_count); | 14710 Handle<FixedArray> elements = factory->NewFixedArray(entry_count); |
14710 int index = 0; | 14711 int index = 0; |
14711 bool inline_runtime_functions = false; | 14712 bool inline_runtime_functions = false; |
14712 #define ADD_ENTRY(Name, argc, ressize) \ | 14713 #define ADD_ENTRY(Name, argc, ressize) \ |
14713 { \ | 14714 { \ |
14714 HandleScope inner(isolate); \ | 14715 HandleScope inner(isolate); \ |
14715 Handle<String> name; \ | 14716 Handle<String> name; \ |
14716 /* Inline runtime functions have an underscore in front of the name. */ \ | 14717 /* Inline runtime functions have an underscore in front of the name. */ \ |
14717 if (inline_runtime_functions) { \ | 14718 if (inline_runtime_functions) { \ |
14718 name = factory->NewStringFromStaticAscii("_" #Name); \ | 14719 name = factory->NewStringFromStaticAscii("_" #Name); \ |
14719 } else { \ | 14720 } else { \ |
14720 name = factory->NewStringFromStaticAscii(#Name); \ | 14721 name = factory->NewStringFromStaticAscii(#Name); \ |
14721 } \ | 14722 } \ |
14722 Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \ | 14723 Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \ |
14723 pair_elements->set(0, *name); \ | 14724 pair_elements->set(0, *name); \ |
14724 pair_elements->set(1, Smi::FromInt(argc)); \ | 14725 pair_elements->set(1, Smi::FromInt(argc)); \ |
14725 Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \ | 14726 Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \ |
14726 elements->set(index++, *pair); \ | 14727 elements->set(index++, *pair); \ |
14727 } | 14728 } |
14728 inline_runtime_functions = false; | 14729 inline_runtime_functions = false; |
14729 RUNTIME_FUNCTION_LIST(ADD_ENTRY) | 14730 RUNTIME_FUNCTION_LIST(ADD_ENTRY) |
| 14731 INLINE_OPTIMIZED_FUNCTION_LIST(ADD_ENTRY) |
14730 // Calling hidden runtime functions should just throw. | 14732 // Calling hidden runtime functions should just throw. |
14731 RUNTIME_HIDDEN_FUNCTION_LIST(ADD_ENTRY) | 14733 RUNTIME_HIDDEN_FUNCTION_LIST(ADD_ENTRY) |
14732 inline_runtime_functions = true; | 14734 inline_runtime_functions = true; |
14733 INLINE_FUNCTION_LIST(ADD_ENTRY) | 14735 INLINE_FUNCTION_LIST(ADD_ENTRY) |
14734 #undef ADD_ENTRY | 14736 #undef ADD_ENTRY |
14735 ASSERT_EQ(index, entry_count); | 14737 ASSERT_EQ(index, entry_count); |
14736 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); | 14738 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); |
14737 return *result; | 14739 return *result; |
14738 } | 14740 } |
14739 #endif | 14741 #endif |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15125 "_" #name, NULL, number_of_args, result_size }, | 15127 "_" #name, NULL, number_of_args, result_size }, |
15126 | 15128 |
15127 | 15129 |
15128 #define IO(name, number_of_args, result_size) \ | 15130 #define IO(name, number_of_args, result_size) \ |
15129 { Runtime::kInlineOptimized##name, Runtime::INLINE_OPTIMIZED, \ | 15131 { Runtime::kInlineOptimized##name, Runtime::INLINE_OPTIMIZED, \ |
15130 "_" #name, FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, | 15132 "_" #name, FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, |
15131 | 15133 |
15132 | 15134 |
15133 static const Runtime::Function kIntrinsicFunctions[] = { | 15135 static const Runtime::Function kIntrinsicFunctions[] = { |
15134 RUNTIME_FUNCTION_LIST(F) | 15136 RUNTIME_FUNCTION_LIST(F) |
| 15137 INLINE_OPTIMIZED_FUNCTION_LIST(F) |
15135 RUNTIME_HIDDEN_FUNCTION_LIST(FH) | 15138 RUNTIME_HIDDEN_FUNCTION_LIST(FH) |
15136 INLINE_FUNCTION_LIST(I) | 15139 INLINE_FUNCTION_LIST(I) |
15137 INLINE_OPTIMIZED_FUNCTION_LIST(IO) | 15140 INLINE_OPTIMIZED_FUNCTION_LIST(IO) |
15138 }; | 15141 }; |
15139 | 15142 |
15140 #undef IO | 15143 #undef IO |
15141 #undef I | 15144 #undef I |
15142 #undef FH | 15145 #undef FH |
15143 #undef F | 15146 #undef F |
15144 | 15147 |
(...skipping 26 matching lines...) Expand all Loading... |
15171 } | 15174 } |
15172 return NULL; | 15175 return NULL; |
15173 } | 15176 } |
15174 | 15177 |
15175 | 15178 |
15176 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15179 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15177 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15180 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15178 } | 15181 } |
15179 | 15182 |
15180 } } // namespace v8::internal | 15183 } } // namespace v8::internal |
OLD | NEW |