| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 14511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14522 | 14522 |
| 14523 #ifdef DEBUG | 14523 #ifdef DEBUG |
| 14524 // ListNatives is ONLY used by the fuzz-natives.js in debug mode | 14524 // ListNatives is ONLY used by the fuzz-natives.js in debug mode |
| 14525 // Exclude the code in release mode. | 14525 // Exclude the code in release mode. |
| 14526 RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) { | 14526 RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) { |
| 14527 HandleScope scope(isolate); | 14527 HandleScope scope(isolate); |
| 14528 ASSERT(args.length() == 0); | 14528 ASSERT(args.length() == 0); |
| 14529 #define COUNT_ENTRY(Name, argc, ressize) + 1 | 14529 #define COUNT_ENTRY(Name, argc, ressize) + 1 |
| 14530 int entry_count = 0 | 14530 int entry_count = 0 |
| 14531 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) | 14531 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) |
| 14532 INLINE_FUNCTION_LIST(COUNT_ENTRY) | 14532 INLINE_FUNCTION_LIST(COUNT_ENTRY); |
| 14533 INLINE_RUNTIME_FUNCTION_LIST(COUNT_ENTRY); | |
| 14534 #undef COUNT_ENTRY | 14533 #undef COUNT_ENTRY |
| 14535 Factory* factory = isolate->factory(); | 14534 Factory* factory = isolate->factory(); |
| 14536 Handle<FixedArray> elements = factory->NewFixedArray(entry_count); | 14535 Handle<FixedArray> elements = factory->NewFixedArray(entry_count); |
| 14537 int index = 0; | 14536 int index = 0; |
| 14538 bool inline_runtime_functions = false; | 14537 bool inline_runtime_functions = false; |
| 14539 #define ADD_ENTRY(Name, argc, ressize) \ | 14538 #define ADD_ENTRY(Name, argc, ressize) \ |
| 14540 { \ | 14539 { \ |
| 14541 HandleScope inner(isolate); \ | 14540 HandleScope inner(isolate); \ |
| 14542 Handle<String> name; \ | 14541 Handle<String> name; \ |
| 14543 /* Inline runtime functions have an underscore in front of the name. */ \ | 14542 /* Inline runtime functions have an underscore in front of the name. */ \ |
| 14544 if (inline_runtime_functions) { \ | 14543 if (inline_runtime_functions) { \ |
| 14545 name = factory->NewStringFromAscii( \ | 14544 name = factory->NewStringFromAscii( \ |
| 14546 Vector<const char>("_" #Name, StrLength("_" #Name))); \ | 14545 Vector<const char>("_" #Name, StrLength("_" #Name))); \ |
| 14547 } else { \ | 14546 } else { \ |
| 14548 name = factory->NewStringFromAscii( \ | 14547 name = factory->NewStringFromAscii( \ |
| 14549 Vector<const char>(#Name, StrLength(#Name))); \ | 14548 Vector<const char>(#Name, StrLength(#Name))); \ |
| 14550 } \ | 14549 } \ |
| 14551 Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \ | 14550 Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \ |
| 14552 pair_elements->set(0, *name); \ | 14551 pair_elements->set(0, *name); \ |
| 14553 pair_elements->set(1, Smi::FromInt(argc)); \ | 14552 pair_elements->set(1, Smi::FromInt(argc)); \ |
| 14554 Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \ | 14553 Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \ |
| 14555 elements->set(index++, *pair); \ | 14554 elements->set(index++, *pair); \ |
| 14556 } | 14555 } |
| 14557 inline_runtime_functions = false; | 14556 inline_runtime_functions = false; |
| 14558 RUNTIME_FUNCTION_LIST(ADD_ENTRY) | 14557 RUNTIME_FUNCTION_LIST(ADD_ENTRY) |
| 14559 inline_runtime_functions = true; | 14558 inline_runtime_functions = true; |
| 14560 INLINE_FUNCTION_LIST(ADD_ENTRY) | 14559 INLINE_FUNCTION_LIST(ADD_ENTRY) |
| 14561 INLINE_RUNTIME_FUNCTION_LIST(ADD_ENTRY) | |
| 14562 #undef ADD_ENTRY | 14560 #undef ADD_ENTRY |
| 14563 ASSERT_EQ(index, entry_count); | 14561 ASSERT_EQ(index, entry_count); |
| 14564 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); | 14562 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); |
| 14565 return *result; | 14563 return *result; |
| 14566 } | 14564 } |
| 14567 #endif | 14565 #endif |
| 14568 | 14566 |
| 14569 | 14567 |
| 14570 RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) { | 14568 RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) { |
| 14571 SealHandleScope shs(isolate); | 14569 SealHandleScope shs(isolate); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14896 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, | 14894 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, |
| 14897 | 14895 |
| 14898 | 14896 |
| 14899 #define I(name, number_of_args, result_size) \ | 14897 #define I(name, number_of_args, result_size) \ |
| 14900 { Runtime::kInline##name, Runtime::INLINE, \ | 14898 { Runtime::kInline##name, Runtime::INLINE, \ |
| 14901 "_" #name, NULL, number_of_args, result_size }, | 14899 "_" #name, NULL, number_of_args, result_size }, |
| 14902 | 14900 |
| 14903 static const Runtime::Function kIntrinsicFunctions[] = { | 14901 static const Runtime::Function kIntrinsicFunctions[] = { |
| 14904 RUNTIME_FUNCTION_LIST(F) | 14902 RUNTIME_FUNCTION_LIST(F) |
| 14905 INLINE_FUNCTION_LIST(I) | 14903 INLINE_FUNCTION_LIST(I) |
| 14906 INLINE_RUNTIME_FUNCTION_LIST(I) | |
| 14907 }; | 14904 }; |
| 14908 | 14905 |
| 14906 #undef I |
| 14907 #undef F |
| 14908 |
| 14909 | 14909 |
| 14910 MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap, | 14910 MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap, |
| 14911 Object* dictionary) { | 14911 Object* dictionary) { |
| 14912 ASSERT(dictionary != NULL); | 14912 ASSERT(dictionary != NULL); |
| 14913 ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0); | 14913 ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0); |
| 14914 for (int i = 0; i < kNumFunctions; ++i) { | 14914 for (int i = 0; i < kNumFunctions; ++i) { |
| 14915 Object* name_string; | 14915 Object* name_string; |
| 14916 { MaybeObject* maybe_name_string = | 14916 { MaybeObject* maybe_name_string = |
| 14917 heap->InternalizeUtf8String(kIntrinsicFunctions[i].name); | 14917 heap->InternalizeUtf8String(kIntrinsicFunctions[i].name); |
| 14918 if (!maybe_name_string->ToObject(&name_string)) return maybe_name_string; | 14918 if (!maybe_name_string->ToObject(&name_string)) return maybe_name_string; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14965 // Handle last resort GC and make sure to allow future allocations | 14965 // Handle last resort GC and make sure to allow future allocations |
| 14966 // to grow the heap without causing GCs (if possible). | 14966 // to grow the heap without causing GCs (if possible). |
| 14967 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14967 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14969 "Runtime::PerformGC"); | 14969 "Runtime::PerformGC"); |
| 14970 } | 14970 } |
| 14971 } | 14971 } |
| 14972 | 14972 |
| 14973 | 14973 |
| 14974 } } // namespace v8::internal | 14974 } } // namespace v8::internal |
| OLD | NEW |