| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 Object* prototype = args[1]; | 596 Object* prototype = args[1]; |
| 597 Object* used_prototype = | 597 Object* used_prototype = |
| 598 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value(); | 598 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value(); |
| 599 return isolate->heap()->AllocateJSProxy(handler, used_prototype); | 599 return isolate->heap()->AllocateJSProxy(handler, used_prototype); |
| 600 } | 600 } |
| 601 | 601 |
| 602 | 602 |
| 603 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSProxy) { | 603 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsJSProxy) { |
| 604 ASSERT(args.length() == 1); | 604 ASSERT(args.length() == 1); |
| 605 Object* obj = args[0]; | 605 Object* obj = args[0]; |
| 606 return obj->IsJSProxy() | 606 return isolate->heap()->ToBoolean(obj->IsJSProxy()); |
| 607 ? isolate->heap()->true_value() : isolate->heap()->false_value(); | |
| 608 } | 607 } |
| 609 | 608 |
| 610 | 609 |
| 611 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) { | 610 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) { |
| 612 ASSERT(args.length() == 1); | 611 ASSERT(args.length() == 1); |
| 613 CONVERT_CHECKED(JSProxy, proxy, args[0]); | 612 CONVERT_CHECKED(JSProxy, proxy, args[0]); |
| 614 return proxy->handler(); | 613 return proxy->handler(); |
| 615 } | 614 } |
| 616 | 615 |
| 617 | 616 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 | 981 |
| 983 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsExtensible) { | 982 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsExtensible) { |
| 984 ASSERT(args.length() == 1); | 983 ASSERT(args.length() == 1); |
| 985 CONVERT_CHECKED(JSObject, obj, args[0]); | 984 CONVERT_CHECKED(JSObject, obj, args[0]); |
| 986 if (obj->IsJSGlobalProxy()) { | 985 if (obj->IsJSGlobalProxy()) { |
| 987 Object* proto = obj->GetPrototype(); | 986 Object* proto = obj->GetPrototype(); |
| 988 if (proto->IsNull()) return isolate->heap()->false_value(); | 987 if (proto->IsNull()) return isolate->heap()->false_value(); |
| 989 ASSERT(proto->IsJSGlobalObject()); | 988 ASSERT(proto->IsJSGlobalObject()); |
| 990 obj = JSObject::cast(proto); | 989 obj = JSObject::cast(proto); |
| 991 } | 990 } |
| 992 return obj->map()->is_extensible() ? isolate->heap()->true_value() | 991 return isolate->heap()->ToBoolean(obj->map()->is_extensible()); |
| 993 : isolate->heap()->false_value(); | |
| 994 } | 992 } |
| 995 | 993 |
| 996 | 994 |
| 997 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { | 995 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { |
| 998 HandleScope scope(isolate); | 996 HandleScope scope(isolate); |
| 999 ASSERT(args.length() == 3); | 997 ASSERT(args.length() == 3); |
| 1000 CONVERT_ARG_CHECKED(JSRegExp, re, 0); | 998 CONVERT_ARG_CHECKED(JSRegExp, re, 0); |
| 1001 CONVERT_ARG_CHECKED(String, pattern, 1); | 999 CONVERT_ARG_CHECKED(String, pattern, 1); |
| 1002 CONVERT_ARG_CHECKED(String, flags, 2); | 1000 CONVERT_ARG_CHECKED(String, flags, 2); |
| 1003 Handle<Object> result = RegExpImpl::Compile(re, pattern, flags); | 1001 Handle<Object> result = RegExpImpl::Compile(re, pattern, flags); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 if (needs_access_checks) { | 1047 if (needs_access_checks) { |
| 1050 // Copy map so it won't interfere constructor's initial map. | 1048 // Copy map so it won't interfere constructor's initial map. |
| 1051 Object* new_map; | 1049 Object* new_map; |
| 1052 { MaybeObject* maybe_new_map = old_map->CopyDropTransitions(); | 1050 { MaybeObject* maybe_new_map = old_map->CopyDropTransitions(); |
| 1053 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; | 1051 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; |
| 1054 } | 1052 } |
| 1055 | 1053 |
| 1056 Map::cast(new_map)->set_is_access_check_needed(false); | 1054 Map::cast(new_map)->set_is_access_check_needed(false); |
| 1057 object->set_map(Map::cast(new_map)); | 1055 object->set_map(Map::cast(new_map)); |
| 1058 } | 1056 } |
| 1059 return needs_access_checks ? isolate->heap()->true_value() | 1057 return isolate->heap()->ToBoolean(needs_access_checks); |
| 1060 : isolate->heap()->false_value(); | |
| 1061 } | 1058 } |
| 1062 | 1059 |
| 1063 | 1060 |
| 1064 RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { | 1061 RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { |
| 1065 ASSERT(args.length() == 1); | 1062 ASSERT(args.length() == 1); |
| 1066 CONVERT_CHECKED(HeapObject, object, args[0]); | 1063 CONVERT_CHECKED(HeapObject, object, args[0]); |
| 1067 Map* old_map = object->map(); | 1064 Map* old_map = object->map(); |
| 1068 if (!old_map->is_access_check_needed()) { | 1065 if (!old_map->is_access_check_needed()) { |
| 1069 // Copy map so it won't interfere constructor's initial map. | 1066 // Copy map so it won't interfere constructor's initial map. |
| 1070 Object* new_map; | 1067 Object* new_map; |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 NoHandleAllocation ha; | 1856 NoHandleAllocation ha; |
| 1860 ASSERT(args.length() == 2); | 1857 ASSERT(args.length() == 2); |
| 1861 | 1858 |
| 1862 CONVERT_CHECKED(JSFunction, f, args[0]); | 1859 CONVERT_CHECKED(JSFunction, f, args[0]); |
| 1863 CONVERT_CHECKED(String, name, args[1]); | 1860 CONVERT_CHECKED(String, name, args[1]); |
| 1864 f->shared()->set_name(name); | 1861 f->shared()->set_name(name); |
| 1865 return isolate->heap()->undefined_value(); | 1862 return isolate->heap()->undefined_value(); |
| 1866 } | 1863 } |
| 1867 | 1864 |
| 1868 | 1865 |
| 1866 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionNameShouldPrintAsAnonymous) { |
| 1867 NoHandleAllocation ha; |
| 1868 ASSERT(args.length() == 1); |
| 1869 CONVERT_CHECKED(JSFunction, f, args[0]); |
| 1870 return isolate->heap()->ToBoolean( |
| 1871 f->shared()->name_should_print_as_anonymous()); |
| 1872 } |
| 1873 |
| 1874 |
| 1875 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionMarkNameShouldPrintAsAnonymous) { |
| 1876 NoHandleAllocation ha; |
| 1877 ASSERT(args.length() == 1); |
| 1878 CONVERT_CHECKED(JSFunction, f, args[0]); |
| 1879 f->shared()->set_name_should_print_as_anonymous(true); |
| 1880 return isolate->heap()->undefined_value(); |
| 1881 } |
| 1882 |
| 1883 |
| 1869 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetBound) { | 1884 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetBound) { |
| 1870 HandleScope scope(isolate); | 1885 HandleScope scope(isolate); |
| 1871 ASSERT(args.length() == 1); | 1886 ASSERT(args.length() == 1); |
| 1872 | 1887 |
| 1873 CONVERT_CHECKED(JSFunction, fun, args[0]); | 1888 CONVERT_CHECKED(JSFunction, fun, args[0]); |
| 1874 fun->shared()->set_bound(true); | 1889 fun->shared()->set_bound(true); |
| 1875 return isolate->heap()->undefined_value(); | 1890 return isolate->heap()->undefined_value(); |
| 1876 } | 1891 } |
| 1877 | 1892 |
| 1878 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionRemovePrototype) { | 1893 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionRemovePrototype) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1966 } | 1981 } |
| 1967 return args[0]; // return TOS | 1982 return args[0]; // return TOS |
| 1968 } | 1983 } |
| 1969 | 1984 |
| 1970 | 1985 |
| 1971 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) { | 1986 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) { |
| 1972 NoHandleAllocation ha; | 1987 NoHandleAllocation ha; |
| 1973 ASSERT(args.length() == 1); | 1988 ASSERT(args.length() == 1); |
| 1974 | 1989 |
| 1975 CONVERT_CHECKED(JSFunction, f, args[0]); | 1990 CONVERT_CHECKED(JSFunction, f, args[0]); |
| 1976 return f->shared()->IsApiFunction() ? isolate->heap()->true_value() | 1991 return isolate->heap()->ToBoolean(f->shared()->IsApiFunction()); |
| 1977 : isolate->heap()->false_value(); | |
| 1978 } | 1992 } |
| 1979 | 1993 |
| 1980 | 1994 |
| 1981 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsBuiltin) { | 1995 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsBuiltin) { |
| 1982 NoHandleAllocation ha; | 1996 NoHandleAllocation ha; |
| 1983 ASSERT(args.length() == 1); | 1997 ASSERT(args.length() == 1); |
| 1984 | 1998 |
| 1985 CONVERT_CHECKED(JSFunction, f, args[0]); | 1999 CONVERT_CHECKED(JSFunction, f, args[0]); |
| 1986 return f->IsBuiltin() ? isolate->heap()->true_value() : | 2000 return isolate->heap()->ToBoolean(f->IsBuiltin()); |
| 1987 isolate->heap()->false_value(); | |
| 1988 } | 2001 } |
| 1989 | 2002 |
| 1990 | 2003 |
| 1991 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) { | 2004 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) { |
| 1992 HandleScope scope(isolate); | 2005 HandleScope scope(isolate); |
| 1993 ASSERT(args.length() == 2); | 2006 ASSERT(args.length() == 2); |
| 1994 | 2007 |
| 1995 CONVERT_ARG_CHECKED(JSFunction, target, 0); | 2008 CONVERT_ARG_CHECKED(JSFunction, target, 0); |
| 1996 Handle<Object> code = args.at<Object>(1); | 2009 Handle<Object> code = args.at<Object>(1); |
| 1997 | 2010 |
| (...skipping 7847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9845 | 9858 |
| 9846 // If the callback object is a fixed array then it contains JavaScript | 9859 // If the callback object is a fixed array then it contains JavaScript |
| 9847 // getter and/or setter. | 9860 // getter and/or setter. |
| 9848 bool hasJavaScriptAccessors = result_type == CALLBACKS && | 9861 bool hasJavaScriptAccessors = result_type == CALLBACKS && |
| 9849 result_callback_obj->IsFixedArray(); | 9862 result_callback_obj->IsFixedArray(); |
| 9850 Handle<FixedArray> details = | 9863 Handle<FixedArray> details = |
| 9851 isolate->factory()->NewFixedArray(hasJavaScriptAccessors ? 5 : 2); | 9864 isolate->factory()->NewFixedArray(hasJavaScriptAccessors ? 5 : 2); |
| 9852 details->set(0, *value); | 9865 details->set(0, *value); |
| 9853 details->set(1, property_details); | 9866 details->set(1, property_details); |
| 9854 if (hasJavaScriptAccessors) { | 9867 if (hasJavaScriptAccessors) { |
| 9855 details->set(2, | 9868 details->set(2, isolate->heap()->ToBoolean(caught_exception)); |
| 9856 caught_exception ? isolate->heap()->true_value() | |
| 9857 : isolate->heap()->false_value()); | |
| 9858 details->set(3, FixedArray::cast(*result_callback_obj)->get(0)); | 9869 details->set(3, FixedArray::cast(*result_callback_obj)->get(0)); |
| 9859 details->set(4, FixedArray::cast(*result_callback_obj)->get(1)); | 9870 details->set(4, FixedArray::cast(*result_callback_obj)->get(1)); |
| 9860 } | 9871 } |
| 9861 | 9872 |
| 9862 return *isolate->factory()->NewJSArrayWithElements(details); | 9873 return *isolate->factory()->NewJSArrayWithElements(details); |
| 9863 } | 9874 } |
| 9864 if (i < length - 1) { | 9875 if (i < length - 1) { |
| 9865 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); | 9876 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); |
| 9866 } | 9877 } |
| 9867 } | 9878 } |
| (...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12030 return isolate->heap()->undefined_value(); | 12041 return isolate->heap()->undefined_value(); |
| 12031 #endif | 12042 #endif |
| 12032 } | 12043 } |
| 12033 | 12044 |
| 12034 | 12045 |
| 12035 // Deletes the specified live object list. | 12046 // Deletes the specified live object list. |
| 12036 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteLOL) { | 12047 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteLOL) { |
| 12037 #ifdef LIVE_OBJECT_LIST | 12048 #ifdef LIVE_OBJECT_LIST |
| 12038 CONVERT_SMI_ARG_CHECKED(id, 0); | 12049 CONVERT_SMI_ARG_CHECKED(id, 0); |
| 12039 bool success = LiveObjectList::Delete(id); | 12050 bool success = LiveObjectList::Delete(id); |
| 12040 return success ? isolate->heap()->true_value() : | 12051 return isolate->heap()->ToBoolean(success); |
| 12041 isolate->heap()->false_value(); | |
| 12042 #else | 12052 #else |
| 12043 return isolate->heap()->undefined_value(); | 12053 return isolate->heap()->undefined_value(); |
| 12044 #endif | 12054 #endif |
| 12045 } | 12055 } |
| 12046 | 12056 |
| 12047 | 12057 |
| 12048 // Generates the response to a debugger request for a dump of the objects | 12058 // Generates the response to a debugger request for a dump of the objects |
| 12049 // contained in the difference between the captured live object lists | 12059 // contained in the difference between the captured live object lists |
| 12050 // specified by id1 and id2. | 12060 // specified by id1 and id2. |
| 12051 // If id1 is 0 (i.e. not a valid lol), then the whole of lol id2 will be | 12061 // If id1 is 0 (i.e. not a valid lol), then the whole of lol id2 will be |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12695 } else { | 12705 } else { |
| 12696 // Handle last resort GC and make sure to allow future allocations | 12706 // Handle last resort GC and make sure to allow future allocations |
| 12697 // to grow the heap without causing GCs (if possible). | 12707 // to grow the heap without causing GCs (if possible). |
| 12698 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12708 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12699 isolate->heap()->CollectAllGarbage(false); | 12709 isolate->heap()->CollectAllGarbage(false); |
| 12700 } | 12710 } |
| 12701 } | 12711 } |
| 12702 | 12712 |
| 12703 | 12713 |
| 12704 } } // namespace v8::internal | 12714 } } // namespace v8::internal |
| OLD | NEW |