| 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 uint8_t* target_data = reinterpret_cast<uint8_t*>(target->backing_store()); | 910 uint8_t* target_data = reinterpret_cast<uint8_t*>(target->backing_store()); |
| 911 CopyBytes(target_data, source_data + start, target_length); | 911 CopyBytes(target_data, source_data + start, target_length); |
| 912 return isolate->heap()->undefined_value(); | 912 return isolate->heap()->undefined_value(); |
| 913 } | 913 } |
| 914 | 914 |
| 915 | 915 |
| 916 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferIsView) { | 916 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferIsView) { |
| 917 HandleScope scope(isolate); | 917 HandleScope scope(isolate); |
| 918 ASSERT(args.length() == 1); | 918 ASSERT(args.length() == 1); |
| 919 CONVERT_ARG_CHECKED(Object, object, 0); | 919 CONVERT_ARG_CHECKED(Object, object, 0); |
| 920 return object->IsJSArrayBufferView() | 920 return isolate->heap()->ToBoolean(object->IsJSArrayBufferView()); |
| 921 ? isolate->heap()->true_value() | |
| 922 : isolate->heap()->false_value(); | |
| 923 } | 921 } |
| 924 | 922 |
| 925 | 923 |
| 926 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferNeuter) { | 924 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferNeuter) { |
| 927 HandleScope scope(isolate); | 925 HandleScope scope(isolate); |
| 928 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, array_buffer, 0); | 926 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, array_buffer, 0); |
| 929 if (array_buffer->backing_store() == NULL) { | 927 if (array_buffer->backing_store() == NULL) { |
| 930 CHECK(Smi::FromInt(0) == array_buffer->byte_length()); | 928 CHECK(Smi::FromInt(0) == array_buffer->byte_length()); |
| 931 return isolate->heap()->undefined_value(); | 929 return isolate->heap()->undefined_value(); |
| 932 } | 930 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 if (typed_array->type() == holder->type()) { | 1128 if (typed_array->type() == holder->type()) { |
| 1131 uint8_t* backing_store = | 1129 uint8_t* backing_store = |
| 1132 static_cast<uint8_t*>( | 1130 static_cast<uint8_t*>( |
| 1133 typed_array->GetBuffer()->backing_store()); | 1131 typed_array->GetBuffer()->backing_store()); |
| 1134 size_t source_byte_offset = | 1132 size_t source_byte_offset = |
| 1135 NumberToSize(isolate, typed_array->byte_offset()); | 1133 NumberToSize(isolate, typed_array->byte_offset()); |
| 1136 memcpy( | 1134 memcpy( |
| 1137 buffer->backing_store(), | 1135 buffer->backing_store(), |
| 1138 backing_store + source_byte_offset, | 1136 backing_store + source_byte_offset, |
| 1139 byte_length); | 1137 byte_length); |
| 1140 return *isolate->factory()->true_value(); | 1138 return isolate->heap()->true_value(); |
| 1141 } else { | |
| 1142 return *isolate->factory()->false_value(); | |
| 1143 } | 1139 } |
| 1144 } | 1140 } |
| 1145 | 1141 |
| 1146 return *isolate->factory()->false_value(); | 1142 return isolate->heap()->false_value(); |
| 1147 } | 1143 } |
| 1148 | 1144 |
| 1149 | 1145 |
| 1150 #define BUFFER_VIEW_GETTER(Type, getter, accessor) \ | 1146 #define BUFFER_VIEW_GETTER(Type, getter, accessor) \ |
| 1151 RUNTIME_FUNCTION(MaybeObject*, Runtime_##Type##Get##getter) { \ | 1147 RUNTIME_FUNCTION(MaybeObject*, Runtime_##Type##Get##getter) { \ |
| 1152 HandleScope scope(isolate); \ | 1148 HandleScope scope(isolate); \ |
| 1153 ASSERT(args.length() == 1); \ | 1149 ASSERT(args.length() == 1); \ |
| 1154 CONVERT_ARG_HANDLE_CHECKED(JS##Type, holder, 0); \ | 1150 CONVERT_ARG_HANDLE_CHECKED(JS##Type, holder, 0); \ |
| 1155 return holder->accessor(); \ | 1151 return holder->accessor(); \ |
| 1156 } | 1152 } |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); | 1711 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); |
| 1716 // We don't expect access checks to be needed on JSProxy objects. | 1712 // We don't expect access checks to be needed on JSProxy objects. |
| 1717 ASSERT(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); | 1713 ASSERT(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); |
| 1718 do { | 1714 do { |
| 1719 if (obj->IsAccessCheckNeeded() && | 1715 if (obj->IsAccessCheckNeeded() && |
| 1720 !isolate->MayNamedAccess(Handle<JSObject>::cast(obj), | 1716 !isolate->MayNamedAccess(Handle<JSObject>::cast(obj), |
| 1721 isolate->factory()->proto_string(), | 1717 isolate->factory()->proto_string(), |
| 1722 v8::ACCESS_GET)) { | 1718 v8::ACCESS_GET)) { |
| 1723 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj), | 1719 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj), |
| 1724 v8::ACCESS_GET); | 1720 v8::ACCESS_GET); |
| 1725 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1721 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 1726 return isolate->heap()->undefined_value(); | 1722 return isolate->heap()->undefined_value(); |
| 1727 } | 1723 } |
| 1728 obj = Object::GetPrototype(isolate, obj); | 1724 obj = Object::GetPrototype(isolate, obj); |
| 1729 } while (obj->IsJSObject() && | 1725 } while (obj->IsJSObject() && |
| 1730 JSObject::cast(*obj)->map()->is_hidden_prototype()); | 1726 JSObject::cast(*obj)->map()->is_hidden_prototype()); |
| 1731 return *obj; | 1727 return *obj; |
| 1732 } | 1728 } |
| 1733 | 1729 |
| 1734 | 1730 |
| 1735 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( | 1731 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( |
| 1736 Isolate* isolate, Handle<Object> receiver) { | 1732 Isolate* isolate, Handle<Object> receiver) { |
| 1737 Handle<Object> current = Object::GetPrototype(isolate, receiver); | 1733 Handle<Object> current = Object::GetPrototype(isolate, receiver); |
| 1738 while (current->IsJSObject() && | 1734 while (current->IsJSObject() && |
| 1739 JSObject::cast(*current)->map()->is_hidden_prototype()) { | 1735 JSObject::cast(*current)->map()->is_hidden_prototype()) { |
| 1740 current = Object::GetPrototype(isolate, current); | 1736 current = Object::GetPrototype(isolate, current); |
| 1741 } | 1737 } |
| 1742 return current; | 1738 return current; |
| 1743 } | 1739 } |
| 1744 | 1740 |
| 1745 | 1741 |
| 1746 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { | 1742 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { |
| 1747 HandleScope scope(isolate); | 1743 HandleScope scope(isolate); |
| 1748 ASSERT(args.length() == 2); | 1744 ASSERT(args.length() == 2); |
| 1749 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1745 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
| 1750 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 1746 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
| 1751 if (obj->IsAccessCheckNeeded() && | 1747 if (obj->IsAccessCheckNeeded() && |
| 1752 !isolate->MayNamedAccess( | 1748 !isolate->MayNamedAccess( |
| 1753 obj, isolate->factory()->proto_string(), v8::ACCESS_SET)) { | 1749 obj, isolate->factory()->proto_string(), v8::ACCESS_SET)) { |
| 1754 isolate->ReportFailedAccessCheck(obj, v8::ACCESS_SET); | 1750 isolate->ReportFailedAccessCheck(obj, v8::ACCESS_SET); |
| 1755 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1751 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 1756 return isolate->heap()->undefined_value(); | 1752 return isolate->heap()->undefined_value(); |
| 1757 } | 1753 } |
| 1758 if (obj->map()->is_observed()) { | 1754 if (obj->map()->is_observed()) { |
| 1759 Handle<Object> old_value = GetPrototypeSkipHiddenPrototypes(isolate, obj); | 1755 Handle<Object> old_value = GetPrototypeSkipHiddenPrototypes(isolate, obj); |
| 1760 | 1756 |
| 1761 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1757 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
| 1762 RETURN_IF_EMPTY_HANDLE(isolate, result); | 1758 RETURN_IF_EMPTY_HANDLE(isolate, result); |
| 1763 | 1759 |
| 1764 Handle<Object> new_value = GetPrototypeSkipHiddenPrototypes(isolate, obj); | 1760 Handle<Object> new_value = GetPrototypeSkipHiddenPrototypes(isolate, obj); |
| 1765 if (!new_value->SameValue(*old_value)) { | 1761 if (!new_value->SameValue(*old_value)) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1984 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1989 isolate, result, GetOwnProperty(isolate, obj, name)); | 1985 isolate, result, GetOwnProperty(isolate, obj, name)); |
| 1990 return *result; | 1986 return *result; |
| 1991 } | 1987 } |
| 1992 | 1988 |
| 1993 | 1989 |
| 1994 RUNTIME_FUNCTION(MaybeObject*, Runtime_PreventExtensions) { | 1990 RUNTIME_FUNCTION(MaybeObject*, Runtime_PreventExtensions) { |
| 1995 HandleScope scope(isolate); | 1991 HandleScope scope(isolate); |
| 1996 ASSERT(args.length() == 1); | 1992 ASSERT(args.length() == 1); |
| 1997 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1993 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
| 1998 Handle<Object> result = JSObject::PreventExtensions(obj); | 1994 Handle<Object> result; |
| 1999 RETURN_IF_EMPTY_HANDLE(isolate, result); | 1995 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1996 isolate, result, JSObject::PreventExtensions(obj)); |
| 2000 return *result; | 1997 return *result; |
| 2001 } | 1998 } |
| 2002 | 1999 |
| 2003 | 2000 |
| 2004 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsExtensible) { | 2001 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsExtensible) { |
| 2005 SealHandleScope shs(isolate); | 2002 SealHandleScope shs(isolate); |
| 2006 ASSERT(args.length() == 1); | 2003 ASSERT(args.length() == 1); |
| 2007 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 2004 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
| 2008 if (obj->IsJSGlobalProxy()) { | 2005 if (obj->IsJSGlobalProxy()) { |
| 2009 Object* proto = obj->GetPrototype(); | 2006 Object* proto = obj->GetPrototype(); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 // as required for function declarations. | 2210 // as required for function declarations. |
| 2214 if (lookup.IsFound() && lookup.IsDontDelete()) { | 2211 if (lookup.IsFound() && lookup.IsDontDelete()) { |
| 2215 if (lookup.IsReadOnly() || lookup.IsDontEnum() || | 2212 if (lookup.IsReadOnly() || lookup.IsDontEnum() || |
| 2216 lookup.IsPropertyCallbacks()) { | 2213 lookup.IsPropertyCallbacks()) { |
| 2217 return ThrowRedeclarationError(isolate, name); | 2214 return ThrowRedeclarationError(isolate, name); |
| 2218 } | 2215 } |
| 2219 // If the existing property is not configurable, keep its attributes. | 2216 // If the existing property is not configurable, keep its attributes. |
| 2220 attr = lookup.GetAttributes(); | 2217 attr = lookup.GetAttributes(); |
| 2221 } | 2218 } |
| 2222 // Define or redefine own property. | 2219 // Define or redefine own property. |
| 2223 RETURN_IF_EMPTY_HANDLE(isolate, | 2220 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 2224 JSObject::SetLocalPropertyIgnoreAttributes( | 2221 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2225 global, name, value, static_cast<PropertyAttributes>(attr))); | 2222 global, name, value, static_cast<PropertyAttributes>(attr))); |
| 2226 } else { | 2223 } else { |
| 2227 // Do a [[Put]] on the existing (own) property. | 2224 // Do a [[Put]] on the existing (own) property. |
| 2228 RETURN_FAILURE_ON_EXCEPTION( | 2225 RETURN_FAILURE_ON_EXCEPTION( |
| 2229 isolate, | 2226 isolate, |
| 2230 JSObject::SetProperty( | 2227 JSObject::SetProperty( |
| 2231 global, name, value, static_cast<PropertyAttributes>(attr), | 2228 global, name, value, static_cast<PropertyAttributes>(attr), |
| 2232 strict_mode)); | 2229 strict_mode)); |
| 2233 } | 2230 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2319 if (initial_value->IsTheHole() && | 2316 if (initial_value->IsTheHole() && |
| 2320 !object->IsJSContextExtensionObject()) { | 2317 !object->IsJSContextExtensionObject()) { |
| 2321 LookupResult lookup(isolate); | 2318 LookupResult lookup(isolate); |
| 2322 object->Lookup(*name, &lookup); | 2319 object->Lookup(*name, &lookup); |
| 2323 if (lookup.IsPropertyCallbacks()) { | 2320 if (lookup.IsPropertyCallbacks()) { |
| 2324 return ThrowRedeclarationError(isolate, name); | 2321 return ThrowRedeclarationError(isolate, name); |
| 2325 } | 2322 } |
| 2326 } | 2323 } |
| 2327 if (object->IsJSGlobalObject()) { | 2324 if (object->IsJSGlobalObject()) { |
| 2328 // Define own property on the global object. | 2325 // Define own property on the global object. |
| 2329 RETURN_IF_EMPTY_HANDLE(isolate, | 2326 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 2330 JSObject::SetLocalPropertyIgnoreAttributes(object, name, value, mode)); | 2327 JSObject::SetLocalPropertyIgnoreAttributes(object, name, value, mode)); |
| 2331 } else { | 2328 } else { |
| 2332 RETURN_FAILURE_ON_EXCEPTION(isolate, | 2329 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 2333 JSReceiver::SetProperty(object, name, value, mode, SLOPPY)); | 2330 JSReceiver::SetProperty(object, name, value, mode, SLOPPY)); |
| 2334 } | 2331 } |
| 2335 } | 2332 } |
| 2336 | 2333 |
| 2337 return isolate->heap()->undefined_value(); | 2334 return isolate->heap()->undefined_value(); |
| 2338 } | 2335 } |
| 2339 | 2336 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2419 // Lookup the property locally in the global object. If it isn't | 2416 // Lookup the property locally in the global object. If it isn't |
| 2420 // there, we add the property and take special precautions to always | 2417 // there, we add the property and take special precautions to always |
| 2421 // add it as a local property even in case of callbacks in the | 2418 // add it as a local property even in case of callbacks in the |
| 2422 // prototype chain (this rules out using SetProperty). | 2419 // prototype chain (this rules out using SetProperty). |
| 2423 // We use SetLocalPropertyIgnoreAttributes instead | 2420 // We use SetLocalPropertyIgnoreAttributes instead |
| 2424 LookupResult lookup(isolate); | 2421 LookupResult lookup(isolate); |
| 2425 global->LocalLookup(*name, &lookup); | 2422 global->LocalLookup(*name, &lookup); |
| 2426 if (!lookup.IsFound()) { | 2423 if (!lookup.IsFound()) { |
| 2427 HandleScope handle_scope(isolate); | 2424 HandleScope handle_scope(isolate); |
| 2428 Handle<GlobalObject> global(isolate->context()->global_object()); | 2425 Handle<GlobalObject> global(isolate->context()->global_object()); |
| 2429 RETURN_IF_EMPTY_HANDLE( | 2426 RETURN_FAILURE_ON_EXCEPTION( |
| 2430 isolate, | 2427 isolate, |
| 2431 JSObject::SetLocalPropertyIgnoreAttributes(global, name, value, | 2428 JSObject::SetLocalPropertyIgnoreAttributes(global, name, value, |
| 2432 attributes)); | 2429 attributes)); |
| 2433 return *value; | 2430 return *value; |
| 2434 } | 2431 } |
| 2435 | 2432 |
| 2436 if (!lookup.IsReadOnly()) { | 2433 if (!lookup.IsReadOnly()) { |
| 2437 // Restore global object from context (in case of GC) and continue | 2434 // Restore global object from context (in case of GC) and continue |
| 2438 // with setting the value. | 2435 // with setting the value. |
| 2439 HandleScope handle_scope(isolate); | 2436 HandleScope handle_scope(isolate); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2664 return *regexp; | 2661 return *regexp; |
| 2665 } | 2662 } |
| 2666 | 2663 |
| 2667 // Map has changed, so use generic, but slower, method. | 2664 // Map has changed, so use generic, but slower, method. |
| 2668 PropertyAttributes final = | 2665 PropertyAttributes final = |
| 2669 static_cast<PropertyAttributes>(READ_ONLY | DONT_ENUM | DONT_DELETE); | 2666 static_cast<PropertyAttributes>(READ_ONLY | DONT_ENUM | DONT_DELETE); |
| 2670 PropertyAttributes writable = | 2667 PropertyAttributes writable = |
| 2671 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 2668 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
| 2672 Handle<Object> zero(Smi::FromInt(0), isolate); | 2669 Handle<Object> zero(Smi::FromInt(0), isolate); |
| 2673 Factory* factory = isolate->factory(); | 2670 Factory* factory = isolate->factory(); |
| 2674 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( | 2671 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2675 regexp, factory->source_string(), source, final)); | 2672 regexp, factory->source_string(), source, final).Check(); |
| 2676 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( | 2673 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2677 regexp, factory->global_string(), global, final)); | 2674 regexp, factory->global_string(), global, final).Check(); |
| 2678 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( | 2675 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2679 regexp, factory->ignore_case_string(), ignoreCase, final)); | 2676 regexp, factory->ignore_case_string(), ignoreCase, final).Check(); |
| 2680 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( | 2677 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2681 regexp, factory->multiline_string(), multiline, final)); | 2678 regexp, factory->multiline_string(), multiline, final).Check(); |
| 2682 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( | 2679 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2683 regexp, factory->last_index_string(), zero, writable)); | 2680 regexp, factory->last_index_string(), zero, writable).Check(); |
| 2684 return *regexp; | 2681 return *regexp; |
| 2685 } | 2682 } |
| 2686 | 2683 |
| 2687 | 2684 |
| 2688 RUNTIME_FUNCTION(MaybeObject*, Runtime_FinishArrayPrototypeSetup) { | 2685 RUNTIME_FUNCTION(MaybeObject*, Runtime_FinishArrayPrototypeSetup) { |
| 2689 HandleScope scope(isolate); | 2686 HandleScope scope(isolate); |
| 2690 ASSERT(args.length() == 1); | 2687 ASSERT(args.length() == 1); |
| 2691 CONVERT_ARG_HANDLE_CHECKED(JSArray, prototype, 0); | 2688 CONVERT_ARG_HANDLE_CHECKED(JSArray, prototype, 0); |
| 2692 // This is necessary to enable fast checks for absence of elements | 2689 // This is necessary to enable fast checks for absence of elements |
| 2693 // on Array.prototype and below. | 2690 // on Array.prototype and below. |
| (...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4850 DeleteArray(str); | 4847 DeleteArray(str); |
| 4851 return *result; | 4848 return *result; |
| 4852 } | 4849 } |
| 4853 | 4850 |
| 4854 | 4851 |
| 4855 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsValidSmi) { | 4852 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsValidSmi) { |
| 4856 SealHandleScope shs(isolate); | 4853 SealHandleScope shs(isolate); |
| 4857 ASSERT(args.length() == 1); | 4854 ASSERT(args.length() == 1); |
| 4858 | 4855 |
| 4859 CONVERT_NUMBER_CHECKED(int32_t, number, Int32, args[0]); | 4856 CONVERT_NUMBER_CHECKED(int32_t, number, Int32, args[0]); |
| 4860 if (Smi::IsValid(number)) { | 4857 return isolate->heap()->ToBoolean(Smi::IsValid(number)); |
| 4861 return isolate->heap()->true_value(); | |
| 4862 } else { | |
| 4863 return isolate->heap()->false_value(); | |
| 4864 } | |
| 4865 } | 4858 } |
| 4866 | 4859 |
| 4867 | 4860 |
| 4868 // Returns a single character string where first character equals | 4861 // Returns a single character string where first character equals |
| 4869 // string->Get(index). | 4862 // string->Get(index). |
| 4870 static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) { | 4863 static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) { |
| 4871 if (index < static_cast<uint32_t>(string->length())) { | 4864 if (index < static_cast<uint32_t>(string->length())) { |
| 4872 Factory* factory = string->GetIsolate()->factory(); | 4865 Factory* factory = string->GetIsolate()->factory(); |
| 4873 return factory->LookupSingleCharacterStringFromCode( | 4866 return factory->LookupSingleCharacterStringFromCode( |
| 4874 String::Flatten(string)->Get(index)); | 4867 String::Flatten(string)->Get(index)); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5063 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || | 5056 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || |
| 5064 !IsFastElementsKind(elements_kind)); | 5057 !IsFastElementsKind(elements_kind)); |
| 5065 } | 5058 } |
| 5066 } | 5059 } |
| 5067 } else if (args[0]->IsString() && args[1]->IsSmi()) { | 5060 } else if (args[0]->IsString() && args[1]->IsSmi()) { |
| 5068 // Fast case for string indexing using [] with a smi index. | 5061 // Fast case for string indexing using [] with a smi index. |
| 5069 HandleScope scope(isolate); | 5062 HandleScope scope(isolate); |
| 5070 Handle<String> str = args.at<String>(0); | 5063 Handle<String> str = args.at<String>(0); |
| 5071 int index = args.smi_at(1); | 5064 int index = args.smi_at(1); |
| 5072 if (index >= 0 && index < str->length()) { | 5065 if (index >= 0 && index < str->length()) { |
| 5073 Handle<Object> result = GetCharAt(str, index); | 5066 return *GetCharAt(str, index); |
| 5074 return *result; | |
| 5075 } | 5067 } |
| 5076 } | 5068 } |
| 5077 | 5069 |
| 5078 // Fall back to GetObjectProperty. | 5070 // Fall back to GetObjectProperty. |
| 5079 HandleScope scope(isolate); | 5071 HandleScope scope(isolate); |
| 5080 Handle<Object> result; | 5072 Handle<Object> result; |
| 5081 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5073 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 5082 isolate, result, | 5074 isolate, result, |
| 5083 Runtime::GetObjectProperty( | 5075 Runtime::GetObjectProperty( |
| 5084 isolate, args.at<Object>(0), args.at<Object>(1))); | 5076 isolate, args.at<Object>(0), args.at<Object>(1))); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5106 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); | 5098 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); |
| 5107 RUNTIME_ASSERT(IsValidAccessor(getter)); | 5099 RUNTIME_ASSERT(IsValidAccessor(getter)); |
| 5108 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); | 5100 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); |
| 5109 RUNTIME_ASSERT(IsValidAccessor(setter)); | 5101 RUNTIME_ASSERT(IsValidAccessor(setter)); |
| 5110 CONVERT_SMI_ARG_CHECKED(unchecked, 4); | 5102 CONVERT_SMI_ARG_CHECKED(unchecked, 4); |
| 5111 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5103 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 5112 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 5104 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
| 5113 | 5105 |
| 5114 bool fast = obj->HasFastProperties(); | 5106 bool fast = obj->HasFastProperties(); |
| 5115 JSObject::DefineAccessor(obj, name, getter, setter, attr); | 5107 JSObject::DefineAccessor(obj, name, getter, setter, attr); |
| 5116 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5108 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5117 if (fast) JSObject::TransformToFastProperties(obj, 0); | 5109 if (fast) JSObject::TransformToFastProperties(obj, 0); |
| 5118 return isolate->heap()->undefined_value(); | 5110 return isolate->heap()->undefined_value(); |
| 5119 } | 5111 } |
| 5120 | 5112 |
| 5121 | 5113 |
| 5122 // Implements part of 8.12.9 DefineOwnProperty. | 5114 // Implements part of 8.12.9 DefineOwnProperty. |
| 5123 // There are 3 cases that lead here: | 5115 // There are 3 cases that lead here: |
| 5124 // Step 4a - define a new data property. | 5116 // Step 4a - define a new data property. |
| 5125 // Steps 9b & 12 - replace an existing accessor property with a data property. | 5117 // Steps 9b & 12 - replace an existing accessor property with a data property. |
| 5126 // Step 12 - update an existing data property with a data or generic | 5118 // Step 12 - update an existing data property with a data or generic |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5214 Handle<Object> value, | 5206 Handle<Object> value, |
| 5215 PropertyAttributes attr, | 5207 PropertyAttributes attr, |
| 5216 StrictMode strict_mode) { | 5208 StrictMode strict_mode) { |
| 5217 SetPropertyMode set_mode = attr == NONE ? SET_PROPERTY : DEFINE_PROPERTY; | 5209 SetPropertyMode set_mode = attr == NONE ? SET_PROPERTY : DEFINE_PROPERTY; |
| 5218 | 5210 |
| 5219 if (object->IsUndefined() || object->IsNull()) { | 5211 if (object->IsUndefined() || object->IsNull()) { |
| 5220 Handle<Object> args[2] = { key, object }; | 5212 Handle<Object> args[2] = { key, object }; |
| 5221 Handle<Object> error = | 5213 Handle<Object> error = |
| 5222 isolate->factory()->NewTypeError("non_object_property_store", | 5214 isolate->factory()->NewTypeError("non_object_property_store", |
| 5223 HandleVector(args, 2)); | 5215 HandleVector(args, 2)); |
| 5224 isolate->Throw(*error); | 5216 return isolate->Throw<Object>(error); |
| 5225 return Handle<Object>(); | |
| 5226 } | 5217 } |
| 5227 | 5218 |
| 5228 if (object->IsJSProxy()) { | 5219 if (object->IsJSProxy()) { |
| 5229 Handle<Object> name_object; | 5220 Handle<Object> name_object; |
| 5230 if (key->IsSymbol()) { | 5221 if (key->IsSymbol()) { |
| 5231 name_object = key; | 5222 name_object = key; |
| 5232 } else { | 5223 } else { |
| 5233 ASSIGN_RETURN_ON_EXCEPTION( | 5224 ASSIGN_RETURN_ON_EXCEPTION( |
| 5234 isolate, name_object, Execution::ToString(isolate, key), Object); | 5225 isolate, name_object, Execution::ToString(isolate, key), Object); |
| 5235 } | 5226 } |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5534 // Check whether debugger and is about to step into the callback that is passed | 5525 // Check whether debugger and is about to step into the callback that is passed |
| 5535 // to a built-in function such as Array.forEach. | 5526 // to a built-in function such as Array.forEach. |
| 5536 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugCallbackSupportsStepping) { | 5527 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugCallbackSupportsStepping) { |
| 5537 SealHandleScope shs(isolate); | 5528 SealHandleScope shs(isolate); |
| 5538 #ifdef ENABLE_DEBUGGER_SUPPORT | 5529 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 5539 if (!isolate->IsDebuggerActive() || !isolate->debug()->StepInActive()) { | 5530 if (!isolate->IsDebuggerActive() || !isolate->debug()->StepInActive()) { |
| 5540 return isolate->heap()->false_value(); | 5531 return isolate->heap()->false_value(); |
| 5541 } | 5532 } |
| 5542 CONVERT_ARG_CHECKED(Object, callback, 0); | 5533 CONVERT_ARG_CHECKED(Object, callback, 0); |
| 5543 // We do not step into the callback if it's a builtin or not even a function. | 5534 // We do not step into the callback if it's a builtin or not even a function. |
| 5544 if (!callback->IsJSFunction() || JSFunction::cast(callback)->IsBuiltin()) { | 5535 return isolate->heap()->ToBoolean( |
| 5545 return isolate->heap()->false_value(); | 5536 callback->IsJSFunction() && !JSFunction::cast(callback)->IsBuiltin()); |
| 5546 } | |
| 5547 return isolate->heap()->true_value(); | |
| 5548 #else | 5537 #else |
| 5549 return isolate->heap()->false_value(); | 5538 return isolate->heap()->false_value(); |
| 5550 #endif // ENABLE_DEBUGGER_SUPPORT | 5539 #endif // ENABLE_DEBUGGER_SUPPORT |
| 5551 } | 5540 } |
| 5552 | 5541 |
| 5553 | 5542 |
| 5554 // Set one shot breakpoints for the callback function that is passed to a | 5543 // Set one shot breakpoints for the callback function that is passed to a |
| 5555 // built-in function such as Array.forEach to enable stepping into the callback. | 5544 // built-in function such as Array.forEach to enable stepping into the callback. |
| 5556 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrepareStepInIfStepping) { | 5545 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrepareStepInIfStepping) { |
| 5557 SealHandleScope shs(isolate); | 5546 SealHandleScope shs(isolate); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5621 // Handle hidden prototypes. If there's a hidden prototype above this thing | 5610 // Handle hidden prototypes. If there's a hidden prototype above this thing |
| 5622 // then we have to check it for properties, because they are supposed to | 5611 // then we have to check it for properties, because they are supposed to |
| 5623 // look like they are on this object. | 5612 // look like they are on this object. |
| 5624 Handle<Object> proto(object->GetPrototype(), isolate); | 5613 Handle<Object> proto(object->GetPrototype(), isolate); |
| 5625 if (proto->IsJSObject() && | 5614 if (proto->IsJSObject() && |
| 5626 Handle<JSObject>::cast(proto)->map()->is_hidden_prototype()) { | 5615 Handle<JSObject>::cast(proto)->map()->is_hidden_prototype()) { |
| 5627 return HasLocalPropertyImplementation(isolate, | 5616 return HasLocalPropertyImplementation(isolate, |
| 5628 Handle<JSObject>::cast(proto), | 5617 Handle<JSObject>::cast(proto), |
| 5629 key); | 5618 key); |
| 5630 } | 5619 } |
| 5631 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5620 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5632 return isolate->heap()->false_value(); | 5621 return isolate->heap()->false_value(); |
| 5633 } | 5622 } |
| 5634 | 5623 |
| 5635 | 5624 |
| 5636 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) { | 5625 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) { |
| 5637 HandleScope scope(isolate); | 5626 HandleScope scope(isolate); |
| 5638 ASSERT(args.length() == 2); | 5627 ASSERT(args.length() == 2); |
| 5639 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); | 5628 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
| 5640 Handle<Object> object = args.at<Object>(0); | 5629 Handle<Object> object = args.at<Object>(0); |
| 5641 | 5630 |
| 5642 uint32_t index; | 5631 uint32_t index; |
| 5643 const bool key_is_array_index = key->AsArrayIndex(&index); | 5632 const bool key_is_array_index = key->AsArrayIndex(&index); |
| 5644 | 5633 |
| 5645 // Only JS objects can have properties. | 5634 // Only JS objects can have properties. |
| 5646 if (object->IsJSObject()) { | 5635 if (object->IsJSObject()) { |
| 5647 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); | 5636 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); |
| 5648 // Fast case: either the key is a real named property or it is not | 5637 // Fast case: either the key is a real named property or it is not |
| 5649 // an array index and there are no interceptors or hidden | 5638 // an array index and there are no interceptors or hidden |
| 5650 // prototypes. | 5639 // prototypes. |
| 5651 if (JSObject::HasRealNamedProperty(js_obj, key)) { | 5640 if (JSObject::HasRealNamedProperty(js_obj, key)) { |
| 5652 ASSERT(!isolate->has_scheduled_exception()); | 5641 ASSERT(!isolate->has_scheduled_exception()); |
| 5653 return isolate->heap()->true_value(); | 5642 return isolate->heap()->true_value(); |
| 5654 } else { | 5643 } else { |
| 5655 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5644 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5656 } | 5645 } |
| 5657 Map* map = js_obj->map(); | 5646 Map* map = js_obj->map(); |
| 5658 if (!key_is_array_index && | 5647 if (!key_is_array_index && |
| 5659 !map->has_named_interceptor() && | 5648 !map->has_named_interceptor() && |
| 5660 !HeapObject::cast(map->prototype())->map()->is_hidden_prototype()) { | 5649 !HeapObject::cast(map->prototype())->map()->is_hidden_prototype()) { |
| 5661 return isolate->heap()->false_value(); | 5650 return isolate->heap()->false_value(); |
| 5662 } | 5651 } |
| 5663 // Slow case. | 5652 // Slow case. |
| 5664 return HasLocalPropertyImplementation(isolate, | 5653 return HasLocalPropertyImplementation(isolate, |
| 5665 Handle<JSObject>(js_obj), | 5654 Handle<JSObject>(js_obj), |
| 5666 Handle<Name>(key)); | 5655 Handle<Name>(key)); |
| 5667 } else if (object->IsString() && key_is_array_index) { | 5656 } else if (object->IsString() && key_is_array_index) { |
| 5668 // Well, there is one exception: Handle [] on strings. | 5657 // Well, there is one exception: Handle [] on strings. |
| 5669 Handle<String> string = Handle<String>::cast(object); | 5658 Handle<String> string = Handle<String>::cast(object); |
| 5670 if (index < static_cast<uint32_t>(string->length())) { | 5659 if (index < static_cast<uint32_t>(string->length())) { |
| 5671 return isolate->heap()->true_value(); | 5660 return isolate->heap()->true_value(); |
| 5672 } | 5661 } |
| 5673 } | 5662 } |
| 5674 return isolate->heap()->false_value(); | 5663 return isolate->heap()->false_value(); |
| 5675 } | 5664 } |
| 5676 | 5665 |
| 5677 | 5666 |
| 5678 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) { | 5667 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) { |
| 5679 HandleScope scope(isolate); | 5668 HandleScope scope(isolate); |
| 5680 ASSERT(args.length() == 2); | 5669 ASSERT(args.length() == 2); |
| 5681 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); | 5670 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); |
| 5682 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); | 5671 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
| 5683 | 5672 |
| 5684 bool result = JSReceiver::HasProperty(receiver, key); | 5673 bool result = JSReceiver::HasProperty(receiver, key); |
| 5685 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5674 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5686 if (isolate->has_pending_exception()) return Failure::Exception(); | 5675 if (isolate->has_pending_exception()) return Failure::Exception(); |
| 5687 return isolate->heap()->ToBoolean(result); | 5676 return isolate->heap()->ToBoolean(result); |
| 5688 } | 5677 } |
| 5689 | 5678 |
| 5690 | 5679 |
| 5691 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) { | 5680 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) { |
| 5692 HandleScope scope(isolate); | 5681 HandleScope scope(isolate); |
| 5693 ASSERT(args.length() == 2); | 5682 ASSERT(args.length() == 2); |
| 5694 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); | 5683 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); |
| 5695 CONVERT_SMI_ARG_CHECKED(index, 1); | 5684 CONVERT_SMI_ARG_CHECKED(index, 1); |
| 5696 | 5685 |
| 5697 bool result = JSReceiver::HasElement(receiver, index); | 5686 bool result = JSReceiver::HasElement(receiver, index); |
| 5698 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5687 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5699 if (isolate->has_pending_exception()) return Failure::Exception(); | |
| 5700 return isolate->heap()->ToBoolean(result); | 5688 return isolate->heap()->ToBoolean(result); |
| 5701 } | 5689 } |
| 5702 | 5690 |
| 5703 | 5691 |
| 5704 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) { | 5692 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) { |
| 5705 HandleScope scope(isolate); | 5693 HandleScope scope(isolate); |
| 5706 ASSERT(args.length() == 2); | 5694 ASSERT(args.length() == 2); |
| 5707 | 5695 |
| 5708 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 5696 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 5709 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); | 5697 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
| 5710 | 5698 |
| 5711 PropertyAttributes att = JSReceiver::GetLocalPropertyAttribute(object, key); | 5699 PropertyAttributes att = JSReceiver::GetLocalPropertyAttribute(object, key); |
| 5712 if (att == ABSENT || (att & DONT_ENUM) != 0) { | 5700 if (att == ABSENT || (att & DONT_ENUM) != 0) { |
| 5713 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5701 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5714 return isolate->heap()->false_value(); | 5702 return isolate->heap()->false_value(); |
| 5715 } | 5703 } |
| 5716 ASSERT(!isolate->has_scheduled_exception()); | 5704 ASSERT(!isolate->has_scheduled_exception()); |
| 5717 return isolate->heap()->true_value(); | 5705 return isolate->heap()->true_value(); |
| 5718 } | 5706 } |
| 5719 | 5707 |
| 5720 | 5708 |
| 5721 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNames) { | 5709 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNames) { |
| 5722 HandleScope scope(isolate); | 5710 HandleScope scope(isolate); |
| 5723 ASSERT(args.length() == 1); | 5711 ASSERT(args.length() == 1); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5789 PropertyAttributes filter = static_cast<PropertyAttributes>(filter_value); | 5777 PropertyAttributes filter = static_cast<PropertyAttributes>(filter_value); |
| 5790 | 5778 |
| 5791 // Skip the global proxy as it has no properties and always delegates to the | 5779 // Skip the global proxy as it has no properties and always delegates to the |
| 5792 // real global object. | 5780 // real global object. |
| 5793 if (obj->IsJSGlobalProxy()) { | 5781 if (obj->IsJSGlobalProxy()) { |
| 5794 // Only collect names if access is permitted. | 5782 // Only collect names if access is permitted. |
| 5795 if (obj->IsAccessCheckNeeded() && | 5783 if (obj->IsAccessCheckNeeded() && |
| 5796 !isolate->MayNamedAccess( | 5784 !isolate->MayNamedAccess( |
| 5797 obj, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { | 5785 obj, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { |
| 5798 isolate->ReportFailedAccessCheck(obj, v8::ACCESS_KEYS); | 5786 isolate->ReportFailedAccessCheck(obj, v8::ACCESS_KEYS); |
| 5799 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5787 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5800 return *isolate->factory()->NewJSArray(0); | 5788 return *isolate->factory()->NewJSArray(0); |
| 5801 } | 5789 } |
| 5802 obj = Handle<JSObject>(JSObject::cast(obj->GetPrototype())); | 5790 obj = Handle<JSObject>(JSObject::cast(obj->GetPrototype())); |
| 5803 } | 5791 } |
| 5804 | 5792 |
| 5805 // Find the number of objects making up this. | 5793 // Find the number of objects making up this. |
| 5806 int length = LocalPrototypeChainLength(*obj); | 5794 int length = LocalPrototypeChainLength(*obj); |
| 5807 | 5795 |
| 5808 // Find the number of local properties for each of the objects. | 5796 // Find the number of local properties for each of the objects. |
| 5809 ScopedVector<int> local_property_count(length); | 5797 ScopedVector<int> local_property_count(length); |
| 5810 int total_property_count = 0; | 5798 int total_property_count = 0; |
| 5811 Handle<JSObject> jsproto = obj; | 5799 Handle<JSObject> jsproto = obj; |
| 5812 for (int i = 0; i < length; i++) { | 5800 for (int i = 0; i < length; i++) { |
| 5813 // Only collect names if access is permitted. | 5801 // Only collect names if access is permitted. |
| 5814 if (jsproto->IsAccessCheckNeeded() && | 5802 if (jsproto->IsAccessCheckNeeded() && |
| 5815 !isolate->MayNamedAccess( | 5803 !isolate->MayNamedAccess( |
| 5816 jsproto, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { | 5804 jsproto, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { |
| 5817 isolate->ReportFailedAccessCheck(jsproto, v8::ACCESS_KEYS); | 5805 isolate->ReportFailedAccessCheck(jsproto, v8::ACCESS_KEYS); |
| 5818 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5806 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5819 return *isolate->factory()->NewJSArray(0); | 5807 return *isolate->factory()->NewJSArray(0); |
| 5820 } | 5808 } |
| 5821 int n; | 5809 int n; |
| 5822 n = jsproto->NumberOfLocalProperties(filter); | 5810 n = jsproto->NumberOfLocalProperties(filter); |
| 5823 local_property_count[i] = n; | 5811 local_property_count[i] = n; |
| 5824 total_property_count += n; | 5812 total_property_count += n; |
| 5825 if (i < length - 1) { | 5813 if (i < length - 1) { |
| 5826 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); | 5814 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); |
| 5827 } | 5815 } |
| 5828 } | 5816 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5964 ASSERT_EQ(args.length(), 1); | 5952 ASSERT_EQ(args.length(), 1); |
| 5965 CONVERT_ARG_CHECKED(JSObject, raw_object, 0); | 5953 CONVERT_ARG_CHECKED(JSObject, raw_object, 0); |
| 5966 Handle<JSObject> object(raw_object); | 5954 Handle<JSObject> object(raw_object); |
| 5967 | 5955 |
| 5968 if (object->IsJSGlobalProxy()) { | 5956 if (object->IsJSGlobalProxy()) { |
| 5969 // Do access checks before going to the global object. | 5957 // Do access checks before going to the global object. |
| 5970 if (object->IsAccessCheckNeeded() && | 5958 if (object->IsAccessCheckNeeded() && |
| 5971 !isolate->MayNamedAccess( | 5959 !isolate->MayNamedAccess( |
| 5972 object, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { | 5960 object, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { |
| 5973 isolate->ReportFailedAccessCheck(object, v8::ACCESS_KEYS); | 5961 isolate->ReportFailedAccessCheck(object, v8::ACCESS_KEYS); |
| 5974 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5962 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 5975 return *isolate->factory()->NewJSArray(0); | 5963 return *isolate->factory()->NewJSArray(0); |
| 5976 } | 5964 } |
| 5977 | 5965 |
| 5978 Handle<Object> proto(object->GetPrototype(), isolate); | 5966 Handle<Object> proto(object->GetPrototype(), isolate); |
| 5979 // If proxy is detached we simply return an empty array. | 5967 // If proxy is detached we simply return an empty array. |
| 5980 if (proto->IsNull()) return *isolate->factory()->NewJSArray(0); | 5968 if (proto->IsNull()) return *isolate->factory()->NewJSArray(0); |
| 5981 object = Handle<JSObject>::cast(proto); | 5969 object = Handle<JSObject>::cast(proto); |
| 5982 } | 5970 } |
| 5983 | 5971 |
| 5984 Handle<FixedArray> contents; | 5972 Handle<FixedArray> contents; |
| (...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8283 // function is called as a constructor for the first time. | 8271 // function is called as a constructor for the first time. |
| 8284 shared->CompleteInobjectSlackTracking(); | 8272 shared->CompleteInobjectSlackTracking(); |
| 8285 } | 8273 } |
| 8286 | 8274 |
| 8287 Handle<JSObject> result; | 8275 Handle<JSObject> result; |
| 8288 if (site.is_null()) { | 8276 if (site.is_null()) { |
| 8289 result = isolate->factory()->NewJSObject(function); | 8277 result = isolate->factory()->NewJSObject(function); |
| 8290 } else { | 8278 } else { |
| 8291 result = isolate->factory()->NewJSObjectWithMemento(function, site); | 8279 result = isolate->factory()->NewJSObjectWithMemento(function, site); |
| 8292 } | 8280 } |
| 8293 RETURN_IF_EMPTY_HANDLE(isolate, result); | |
| 8294 | 8281 |
| 8295 isolate->counters()->constructed_objects()->Increment(); | 8282 isolate->counters()->constructed_objects()->Increment(); |
| 8296 isolate->counters()->constructed_objects_runtime()->Increment(); | 8283 isolate->counters()->constructed_objects_runtime()->Increment(); |
| 8297 | 8284 |
| 8298 return *result; | 8285 return *result; |
| 8299 } | 8286 } |
| 8300 | 8287 |
| 8301 | 8288 |
| 8302 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewObject) { | 8289 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewObject) { |
| 8303 HandleScope scope(isolate); | 8290 HandleScope scope(isolate); |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9057 int index = description->index(j); | 9044 int index = description->index(j); |
| 9058 switch (mode) { | 9045 switch (mode) { |
| 9059 case VAR: | 9046 case VAR: |
| 9060 case LET: | 9047 case LET: |
| 9061 case CONST: | 9048 case CONST: |
| 9062 case CONST_LEGACY: { | 9049 case CONST_LEGACY: { |
| 9063 PropertyAttributes attr = | 9050 PropertyAttributes attr = |
| 9064 IsImmutableVariableMode(mode) ? FROZEN : SEALED; | 9051 IsImmutableVariableMode(mode) ? FROZEN : SEALED; |
| 9065 Handle<AccessorInfo> info = | 9052 Handle<AccessorInfo> info = |
| 9066 Accessors::MakeModuleExport(name, index, attr); | 9053 Accessors::MakeModuleExport(name, index, attr); |
| 9067 Handle<Object> result = JSObject::SetAccessor(module, info); | 9054 Handle<Object> result = |
| 9068 ASSERT(!(result.is_null() || result->IsUndefined())); | 9055 JSObject::SetAccessor(module, info).ToHandleChecked(); |
| 9056 ASSERT(!result->IsUndefined()); |
| 9069 USE(result); | 9057 USE(result); |
| 9070 break; | 9058 break; |
| 9071 } | 9059 } |
| 9072 case MODULE: { | 9060 case MODULE: { |
| 9073 Object* referenced_context = Context::cast(host_context)->get(index); | 9061 Object* referenced_context = Context::cast(host_context)->get(index); |
| 9074 Handle<JSModule> value(Context::cast(referenced_context)->module()); | 9062 Handle<JSModule> value(Context::cast(referenced_context)->module()); |
| 9075 JSReceiver::SetProperty(module, name, value, FROZEN, STRICT).Assert(); | 9063 JSReceiver::SetProperty(module, name, value, FROZEN, STRICT).Assert(); |
| 9076 break; | 9064 break; |
| 9077 } | 9065 } |
| 9078 case INTERNAL: | 9066 case INTERNAL: |
| 9079 case TEMPORARY: | 9067 case TEMPORARY: |
| 9080 case DYNAMIC: | 9068 case DYNAMIC: |
| 9081 case DYNAMIC_GLOBAL: | 9069 case DYNAMIC_GLOBAL: |
| 9082 case DYNAMIC_LOCAL: | 9070 case DYNAMIC_LOCAL: |
| 9083 UNREACHABLE(); | 9071 UNREACHABLE(); |
| 9084 } | 9072 } |
| 9085 } | 9073 } |
| 9086 | 9074 |
| 9087 JSObject::PreventExtensions(module); | 9075 JSObject::PreventExtensions(module).Assert(); |
| 9088 } | 9076 } |
| 9089 | 9077 |
| 9090 ASSERT(!isolate->has_pending_exception()); | 9078 ASSERT(!isolate->has_pending_exception()); |
| 9091 return isolate->heap()->undefined_value(); | 9079 return isolate->heap()->undefined_value(); |
| 9092 } | 9080 } |
| 9093 | 9081 |
| 9094 | 9082 |
| 9095 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeleteContextSlot) { | 9083 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeleteContextSlot) { |
| 9096 HandleScope scope(isolate); | 9084 HandleScope scope(isolate); |
| 9097 ASSERT(args.length() == 2); | 9085 ASSERT(args.length() == 2); |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10634 | 10622 |
| 10635 | 10623 |
| 10636 RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) { | 10624 RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) { |
| 10637 HandleScope scope(isolate); | 10625 HandleScope scope(isolate); |
| 10638 ASSERT(args.length() == 3); | 10626 ASSERT(args.length() == 3); |
| 10639 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); | 10627 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); |
| 10640 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 10628 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
| 10641 CONVERT_SMI_ARG_CHECKED(flag, 2); | 10629 CONVERT_SMI_ARG_CHECKED(flag, 2); |
| 10642 AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER; | 10630 AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER; |
| 10643 if (!receiver->IsJSObject()) return isolate->heap()->undefined_value(); | 10631 if (!receiver->IsJSObject()) return isolate->heap()->undefined_value(); |
| 10644 Handle<Object> result = | 10632 Handle<Object> result; |
| 10645 JSObject::GetAccessor(Handle<JSObject>::cast(receiver), name, component); | 10633 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 10646 RETURN_IF_EMPTY_HANDLE(isolate, result); | 10634 isolate, result, |
| 10635 JSObject::GetAccessor(Handle<JSObject>::cast(receiver), name, component)); |
| 10647 return *result; | 10636 return *result; |
| 10648 } | 10637 } |
| 10649 | 10638 |
| 10650 | 10639 |
| 10651 #ifdef ENABLE_DEBUGGER_SUPPORT | 10640 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 10652 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugBreak) { | 10641 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugBreak) { |
| 10653 SealHandleScope shs(isolate); | 10642 SealHandleScope shs(isolate); |
| 10654 ASSERT(args.length() == 0); | 10643 ASSERT(args.length() == 0); |
| 10655 return Execution::DebugBreakHelper(isolate); | 10644 return Execution::DebugBreakHelper(isolate); |
| 10656 } | 10645 } |
| (...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12369 for (; !it.Done() && n < index; it.Next()) { | 12358 for (; !it.Done() && n < index; it.Next()) { |
| 12370 n++; | 12359 n++; |
| 12371 } | 12360 } |
| 12372 if (it.Done()) { | 12361 if (it.Done()) { |
| 12373 return isolate->heap()->undefined_value(); | 12362 return isolate->heap()->undefined_value(); |
| 12374 } | 12363 } |
| 12375 | 12364 |
| 12376 Handle<JSObject> details; | 12365 Handle<JSObject> details; |
| 12377 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 12366 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 12378 isolate, details, MaterializeScopeDetails(isolate, &it)); | 12367 isolate, details, MaterializeScopeDetails(isolate, &it)); |
| 12379 RETURN_IF_EMPTY_HANDLE(isolate, details); | |
| 12380 return *details; | 12368 return *details; |
| 12381 } | 12369 } |
| 12382 | 12370 |
| 12383 | 12371 |
| 12384 static bool SetScopeVariableValue(ScopeIterator* it, int index, | 12372 static bool SetScopeVariableValue(ScopeIterator* it, int index, |
| 12385 Handle<String> variable_name, | 12373 Handle<String> variable_name, |
| 12386 Handle<Object> new_value) { | 12374 Handle<Object> new_value) { |
| 12387 for (int n = 0; !it->Done() && n < index; it->Next()) { | 12375 for (int n = 0; !it->Done() && n < index; it->Next()) { |
| 12388 n++; | 12376 n++; |
| 12389 } | 12377 } |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13685 const char* icu_name = available_locales[i].getName(); | 13673 const char* icu_name = available_locales[i].getName(); |
| 13686 | 13674 |
| 13687 error = U_ZERO_ERROR; | 13675 error = U_ZERO_ERROR; |
| 13688 // No need to force strict BCP47 rules. | 13676 // No need to force strict BCP47 rules. |
| 13689 uloc_toLanguageTag(icu_name, result, ULOC_FULLNAME_CAPACITY, FALSE, &error); | 13677 uloc_toLanguageTag(icu_name, result, ULOC_FULLNAME_CAPACITY, FALSE, &error); |
| 13690 if (U_FAILURE(error)) { | 13678 if (U_FAILURE(error)) { |
| 13691 // This shouldn't happen, but lets not break the user. | 13679 // This shouldn't happen, but lets not break the user. |
| 13692 continue; | 13680 continue; |
| 13693 } | 13681 } |
| 13694 | 13682 |
| 13695 RETURN_IF_EMPTY_HANDLE(isolate, | 13683 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 13696 JSObject::SetLocalPropertyIgnoreAttributes( | 13684 JSObject::SetLocalPropertyIgnoreAttributes( |
| 13697 locales, | 13685 locales, |
| 13698 isolate->factory()->NewStringFromAscii(CStrVector(result)), | 13686 isolate->factory()->NewStringFromAscii(CStrVector(result)), |
| 13699 isolate->factory()->NewNumber(i), | 13687 isolate->factory()->NewNumber(i), |
| 13700 NONE)); | 13688 NONE)); |
| 13701 } | 13689 } |
| 13702 | 13690 |
| 13703 return *locales; | 13691 return *locales; |
| 13704 } | 13692 } |
| 13705 | 13693 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13789 char base_locale[ULOC_FULLNAME_CAPACITY]; | 13777 char base_locale[ULOC_FULLNAME_CAPACITY]; |
| 13790 uloc_toLanguageTag( | 13778 uloc_toLanguageTag( |
| 13791 icu_base_locale, base_locale, ULOC_FULLNAME_CAPACITY, FALSE, &error); | 13779 icu_base_locale, base_locale, ULOC_FULLNAME_CAPACITY, FALSE, &error); |
| 13792 | 13780 |
| 13793 if (U_FAILURE(error)) { | 13781 if (U_FAILURE(error)) { |
| 13794 return isolate->Throw(isolate->heap()->illegal_argument_string()); | 13782 return isolate->Throw(isolate->heap()->illegal_argument_string()); |
| 13795 } | 13783 } |
| 13796 | 13784 |
| 13797 Handle<JSObject> result = | 13785 Handle<JSObject> result = |
| 13798 isolate->factory()->NewJSObject(isolate->object_function()); | 13786 isolate->factory()->NewJSObject(isolate->object_function()); |
| 13799 RETURN_IF_EMPTY_HANDLE(isolate, | 13787 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 13800 JSObject::SetLocalPropertyIgnoreAttributes( | 13788 JSObject::SetLocalPropertyIgnoreAttributes( |
| 13801 result, | 13789 result, |
| 13802 maximized, | 13790 maximized, |
| 13803 isolate->factory()->NewStringFromAscii(CStrVector(base_max_locale)), | 13791 isolate->factory()->NewStringFromAscii(CStrVector(base_max_locale)), |
| 13804 NONE)); | 13792 NONE)); |
| 13805 RETURN_IF_EMPTY_HANDLE(isolate, | 13793 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 13806 JSObject::SetLocalPropertyIgnoreAttributes( | 13794 JSObject::SetLocalPropertyIgnoreAttributes( |
| 13807 result, | 13795 result, |
| 13808 base, | 13796 base, |
| 13809 isolate->factory()->NewStringFromAscii(CStrVector(base_locale)), | 13797 isolate->factory()->NewStringFromAscii(CStrVector(base_locale)), |
| 13810 NONE)); | 13798 NONE)); |
| 13811 output->set(i, *result); | 13799 output->set(i, *result); |
| 13812 } | 13800 } |
| 13813 | 13801 |
| 13814 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(output); | 13802 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(output); |
| 13815 result->set_length(Smi::FromInt(length)); | 13803 result->set_length(Smi::FromInt(length)); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13917 Execution::InstantiateObject(date_format_template)); | 13905 Execution::InstantiateObject(date_format_template)); |
| 13918 | 13906 |
| 13919 // Set date time formatter as internal field of the resulting JS object. | 13907 // Set date time formatter as internal field of the resulting JS object. |
| 13920 icu::SimpleDateFormat* date_format = DateFormat::InitializeDateTimeFormat( | 13908 icu::SimpleDateFormat* date_format = DateFormat::InitializeDateTimeFormat( |
| 13921 isolate, locale, options, resolved); | 13909 isolate, locale, options, resolved); |
| 13922 | 13910 |
| 13923 if (!date_format) return isolate->ThrowIllegalOperation(); | 13911 if (!date_format) return isolate->ThrowIllegalOperation(); |
| 13924 | 13912 |
| 13925 local_object->SetInternalField(0, reinterpret_cast<Smi*>(date_format)); | 13913 local_object->SetInternalField(0, reinterpret_cast<Smi*>(date_format)); |
| 13926 | 13914 |
| 13927 RETURN_IF_EMPTY_HANDLE(isolate, | 13915 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 13928 JSObject::SetLocalPropertyIgnoreAttributes( | 13916 JSObject::SetLocalPropertyIgnoreAttributes( |
| 13929 local_object, | 13917 local_object, |
| 13930 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), | 13918 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), |
| 13931 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13919 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
| 13932 NONE)); | 13920 NONE)); |
| 13933 | 13921 |
| 13934 // Make object handle weak so we can delete the data format once GC kicks in. | 13922 // Make object handle weak so we can delete the data format once GC kicks in. |
| 13935 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 13923 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
| 13936 GlobalHandles::MakeWeak(wrapper.location(), | 13924 GlobalHandles::MakeWeak(wrapper.location(), |
| 13937 reinterpret_cast<void*>(wrapper.location()), | 13925 reinterpret_cast<void*>(wrapper.location()), |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14012 Execution::InstantiateObject(number_format_template)); | 14000 Execution::InstantiateObject(number_format_template)); |
| 14013 | 14001 |
| 14014 // Set number formatter as internal field of the resulting JS object. | 14002 // Set number formatter as internal field of the resulting JS object. |
| 14015 icu::DecimalFormat* number_format = NumberFormat::InitializeNumberFormat( | 14003 icu::DecimalFormat* number_format = NumberFormat::InitializeNumberFormat( |
| 14016 isolate, locale, options, resolved); | 14004 isolate, locale, options, resolved); |
| 14017 | 14005 |
| 14018 if (!number_format) return isolate->ThrowIllegalOperation(); | 14006 if (!number_format) return isolate->ThrowIllegalOperation(); |
| 14019 | 14007 |
| 14020 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); | 14008 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); |
| 14021 | 14009 |
| 14022 RETURN_IF_EMPTY_HANDLE(isolate, | 14010 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 14023 JSObject::SetLocalPropertyIgnoreAttributes( | 14011 JSObject::SetLocalPropertyIgnoreAttributes( |
| 14024 local_object, | 14012 local_object, |
| 14025 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), | 14013 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), |
| 14026 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14014 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
| 14027 NONE)); | 14015 NONE)); |
| 14028 | 14016 |
| 14029 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14017 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
| 14030 GlobalHandles::MakeWeak(wrapper.location(), | 14018 GlobalHandles::MakeWeak(wrapper.location(), |
| 14031 reinterpret_cast<void*>(wrapper.location()), | 14019 reinterpret_cast<void*>(wrapper.location()), |
| 14032 NumberFormat::DeleteNumberFormat); | 14020 NumberFormat::DeleteNumberFormat); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14116 isolate, local_object, Execution::InstantiateObject(collator_template)); | 14104 isolate, local_object, Execution::InstantiateObject(collator_template)); |
| 14117 | 14105 |
| 14118 // Set collator as internal field of the resulting JS object. | 14106 // Set collator as internal field of the resulting JS object. |
| 14119 icu::Collator* collator = Collator::InitializeCollator( | 14107 icu::Collator* collator = Collator::InitializeCollator( |
| 14120 isolate, locale, options, resolved); | 14108 isolate, locale, options, resolved); |
| 14121 | 14109 |
| 14122 if (!collator) return isolate->ThrowIllegalOperation(); | 14110 if (!collator) return isolate->ThrowIllegalOperation(); |
| 14123 | 14111 |
| 14124 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); | 14112 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); |
| 14125 | 14113 |
| 14126 RETURN_IF_EMPTY_HANDLE(isolate, | 14114 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 14127 JSObject::SetLocalPropertyIgnoreAttributes( | 14115 JSObject::SetLocalPropertyIgnoreAttributes( |
| 14128 local_object, | 14116 local_object, |
| 14129 isolate->factory()->NewStringFromAscii(CStrVector("collator")), | 14117 isolate->factory()->NewStringFromAscii(CStrVector("collator")), |
| 14130 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14118 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
| 14131 NONE)); | 14119 NONE)); |
| 14132 | 14120 |
| 14133 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14121 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
| 14134 GlobalHandles::MakeWeak(wrapper.location(), | 14122 GlobalHandles::MakeWeak(wrapper.location(), |
| 14135 reinterpret_cast<void*>(wrapper.location()), | 14123 reinterpret_cast<void*>(wrapper.location()), |
| 14136 Collator::DeleteCollator); | 14124 Collator::DeleteCollator); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14216 // Set break iterator as internal field of the resulting JS object. | 14204 // Set break iterator as internal field of the resulting JS object. |
| 14217 icu::BreakIterator* break_iterator = BreakIterator::InitializeBreakIterator( | 14205 icu::BreakIterator* break_iterator = BreakIterator::InitializeBreakIterator( |
| 14218 isolate, locale, options, resolved); | 14206 isolate, locale, options, resolved); |
| 14219 | 14207 |
| 14220 if (!break_iterator) return isolate->ThrowIllegalOperation(); | 14208 if (!break_iterator) return isolate->ThrowIllegalOperation(); |
| 14221 | 14209 |
| 14222 local_object->SetInternalField(0, reinterpret_cast<Smi*>(break_iterator)); | 14210 local_object->SetInternalField(0, reinterpret_cast<Smi*>(break_iterator)); |
| 14223 // Make sure that the pointer to adopted text is NULL. | 14211 // Make sure that the pointer to adopted text is NULL. |
| 14224 local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL)); | 14212 local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL)); |
| 14225 | 14213 |
| 14226 RETURN_IF_EMPTY_HANDLE(isolate, | 14214 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 14227 JSObject::SetLocalPropertyIgnoreAttributes( | 14215 JSObject::SetLocalPropertyIgnoreAttributes( |
| 14228 local_object, | 14216 local_object, |
| 14229 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")), | 14217 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")), |
| 14230 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14218 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
| 14231 NONE)); | 14219 NONE)); |
| 14232 | 14220 |
| 14233 // Make object handle weak so we can delete the break iterator once GC kicks | 14221 // Make object handle weak so we can delete the break iterator once GC kicks |
| 14234 // in. | 14222 // in. |
| 14235 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14223 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
| 14236 GlobalHandles::MakeWeak(wrapper.location(), | 14224 GlobalHandles::MakeWeak(wrapper.location(), |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15097 } | 15085 } |
| 15098 } | 15086 } |
| 15099 | 15087 |
| 15100 | 15088 |
| 15101 void Runtime::OutOfMemory() { | 15089 void Runtime::OutOfMemory() { |
| 15102 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); | 15090 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); |
| 15103 UNREACHABLE(); | 15091 UNREACHABLE(); |
| 15104 } | 15092 } |
| 15105 | 15093 |
| 15106 } } // namespace v8::internal | 15094 } } // namespace v8::internal |
| OLD | NEW |