| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 14 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <stdlib.h> | 28 #include <stdlib.h> |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 | 31 |
| 32 #include "accessors.h" | 32 #include "accessors.h" |
| 33 #include "api.h" | 33 #include "api.h" |
| 34 #include "arguments.h" | 34 #include "arguments.h" |
| 35 #include "codegen.h" |
| 35 #include "compiler.h" | 36 #include "compiler.h" |
| 36 #include "cpu.h" | 37 #include "cpu.h" |
| 37 #include "dateparser-inl.h" | 38 #include "dateparser-inl.h" |
| 38 #include "debug.h" | 39 #include "debug.h" |
| 39 #include "execution.h" | 40 #include "execution.h" |
| 40 #include "jsregexp.h" | 41 #include "jsregexp.h" |
| 41 #include "liveedit.h" | 42 #include "liveedit.h" |
| 42 #include "parser.h" | 43 #include "parser.h" |
| 43 #include "platform.h" | 44 #include "platform.h" |
| 44 #include "runtime.h" | 45 #include "runtime.h" |
| (...skipping 8623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8668 | 8669 |
| 8669 | 8670 |
| 8670 #ifdef DEBUG | 8671 #ifdef DEBUG |
| 8671 // ListNatives is ONLY used by the fuzz-natives.js in debug mode | 8672 // ListNatives is ONLY used by the fuzz-natives.js in debug mode |
| 8672 // Exclude the code in release mode. | 8673 // Exclude the code in release mode. |
| 8673 static Object* Runtime_ListNatives(Arguments args) { | 8674 static Object* Runtime_ListNatives(Arguments args) { |
| 8674 ASSERT(args.length() == 0); | 8675 ASSERT(args.length() == 0); |
| 8675 HandleScope scope; | 8676 HandleScope scope; |
| 8676 Handle<JSArray> result = Factory::NewJSArray(0); | 8677 Handle<JSArray> result = Factory::NewJSArray(0); |
| 8677 int index = 0; | 8678 int index = 0; |
| 8679 bool inline_runtime_functions = false; |
| 8678 #define ADD_ENTRY(Name, argc, ressize) \ | 8680 #define ADD_ENTRY(Name, argc, ressize) \ |
| 8679 { \ | 8681 { \ |
| 8680 HandleScope inner; \ | 8682 HandleScope inner; \ |
| 8681 Handle<String> name = \ | 8683 Handle<String> name; \ |
| 8682 Factory::NewStringFromAscii( \ | 8684 /* Inline runtime functions have an underscore in front of the name. */ \ |
| 8683 Vector<const char>(#Name, StrLength(#Name))); \ | 8685 if (inline_runtime_functions) { \ |
| 8686 name = Factory::NewStringFromAscii( \ |
| 8687 Vector<const char>("_" #Name, StrLength("_" #Name))); \ |
| 8688 } else { \ |
| 8689 name = Factory::NewStringFromAscii( \ |
| 8690 Vector<const char>(#Name, StrLength(#Name))); \ |
| 8691 } \ |
| 8684 Handle<JSArray> pair = Factory::NewJSArray(0); \ | 8692 Handle<JSArray> pair = Factory::NewJSArray(0); \ |
| 8685 SetElement(pair, 0, name); \ | 8693 SetElement(pair, 0, name); \ |
| 8686 SetElement(pair, 1, Handle<Smi>(Smi::FromInt(argc))); \ | 8694 SetElement(pair, 1, Handle<Smi>(Smi::FromInt(argc))); \ |
| 8687 SetElement(result, index++, pair); \ | 8695 SetElement(result, index++, pair); \ |
| 8688 } | 8696 } |
| 8697 inline_runtime_functions = false; |
| 8689 RUNTIME_FUNCTION_LIST(ADD_ENTRY) | 8698 RUNTIME_FUNCTION_LIST(ADD_ENTRY) |
| 8699 inline_runtime_functions = true; |
| 8700 INLINE_RUNTIME_FUNCTION_LIST(ADD_ENTRY) |
| 8690 #undef ADD_ENTRY | 8701 #undef ADD_ENTRY |
| 8691 return *result; | 8702 return *result; |
| 8692 } | 8703 } |
| 8693 #endif | 8704 #endif |
| 8694 | 8705 |
| 8695 | 8706 |
| 8696 static Object* Runtime_Log(Arguments args) { | 8707 static Object* Runtime_Log(Arguments args) { |
| 8697 ASSERT(args.length() == 2); | 8708 ASSERT(args.length() == 2); |
| 8698 CONVERT_CHECKED(String, format, args[0]); | 8709 CONVERT_CHECKED(String, format, args[0]); |
| 8699 CONVERT_CHECKED(JSArray, elms, args[1]); | 8710 CONVERT_CHECKED(JSArray, elms, args[1]); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8749 } else { | 8760 } else { |
| 8750 // Handle last resort GC and make sure to allow future allocations | 8761 // Handle last resort GC and make sure to allow future allocations |
| 8751 // to grow the heap without causing GCs (if possible). | 8762 // to grow the heap without causing GCs (if possible). |
| 8752 Counters::gc_last_resort_from_js.Increment(); | 8763 Counters::gc_last_resort_from_js.Increment(); |
| 8753 Heap::CollectAllGarbage(false); | 8764 Heap::CollectAllGarbage(false); |
| 8754 } | 8765 } |
| 8755 } | 8766 } |
| 8756 | 8767 |
| 8757 | 8768 |
| 8758 } } // namespace v8::internal | 8769 } } // namespace v8::internal |
| OLD | NEW |