OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 // If the constructor is not present, return "Object". | 1817 // If the constructor is not present, return "Object". |
1818 return GetHeap()->Object_string(); | 1818 return GetHeap()->Object_string(); |
1819 } | 1819 } |
1820 | 1820 |
1821 | 1821 |
1822 String* JSReceiver::constructor_name() { | 1822 String* JSReceiver::constructor_name() { |
1823 return map()->constructor_name(); | 1823 return map()->constructor_name(); |
1824 } | 1824 } |
1825 | 1825 |
1826 | 1826 |
1827 // TODO(mstarzinger): Temporary wrapper until handlified. | |
1828 static Handle<Object> NewStorageFor(Isolate* isolate, | |
1829 Handle<Object> object, | |
1830 Representation representation) { | |
1831 Heap* heap = isolate->heap(); | |
1832 CALL_HEAP_FUNCTION(isolate, | |
1833 object->AllocateNewStorageFor(heap, representation), | |
1834 Object); | |
1835 } | |
1836 | |
1837 | |
1838 void JSObject::AddFastProperty(Handle<JSObject> object, | 1827 void JSObject::AddFastProperty(Handle<JSObject> object, |
1839 Handle<Name> name, | 1828 Handle<Name> name, |
1840 Handle<Object> value, | 1829 Handle<Object> value, |
1841 PropertyAttributes attributes, | 1830 PropertyAttributes attributes, |
1842 StoreFromKeyed store_mode, | 1831 StoreFromKeyed store_mode, |
1843 ValueType value_type, | 1832 ValueType value_type, |
1844 TransitionFlag flag) { | 1833 TransitionFlag flag) { |
1845 ASSERT(!object->IsJSGlobalProxy()); | 1834 ASSERT(!object->IsJSGlobalProxy()); |
1846 ASSERT(DescriptorArray::kNotFound == | 1835 ASSERT(DescriptorArray::kNotFound == |
1847 object->map()->instance_descriptors()->Search( | 1836 object->map()->instance_descriptors()->Search( |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 old_details.type() == FIELD); | 2229 old_details.type() == FIELD); |
2241 Object* raw_value = old_details.type() == CONSTANT | 2230 Object* raw_value = old_details.type() == CONSTANT |
2242 ? old_descriptors->GetValue(i) | 2231 ? old_descriptors->GetValue(i) |
2243 : object->RawFastPropertyAt(old_descriptors->GetFieldIndex(i)); | 2232 : object->RawFastPropertyAt(old_descriptors->GetFieldIndex(i)); |
2244 Handle<Object> value(raw_value, isolate); | 2233 Handle<Object> value(raw_value, isolate); |
2245 if (!old_details.representation().IsDouble() && | 2234 if (!old_details.representation().IsDouble() && |
2246 details.representation().IsDouble()) { | 2235 details.representation().IsDouble()) { |
2247 if (old_details.representation().IsNone()) { | 2236 if (old_details.representation().IsNone()) { |
2248 value = handle(Smi::FromInt(0), isolate); | 2237 value = handle(Smi::FromInt(0), isolate); |
2249 } | 2238 } |
2250 value = NewStorageFor(isolate, value, details.representation()); | 2239 value = Object::NewStorageFor(isolate, value, details.representation()); |
2251 } | 2240 } |
2252 ASSERT(!(details.representation().IsDouble() && value->IsSmi())); | 2241 ASSERT(!(details.representation().IsDouble() && value->IsSmi())); |
2253 int target_index = new_descriptors->GetFieldIndex(i) - inobject; | 2242 int target_index = new_descriptors->GetFieldIndex(i) - inobject; |
2254 if (target_index < 0) target_index += total_size; | 2243 if (target_index < 0) target_index += total_size; |
2255 array->set(target_index, *value); | 2244 array->set(target_index, *value); |
2256 } | 2245 } |
2257 | 2246 |
2258 for (int i = old_nof; i < new_nof; i++) { | 2247 for (int i = old_nof; i < new_nof; i++) { |
2259 PropertyDetails details = new_descriptors->GetDetails(i); | 2248 PropertyDetails details = new_descriptors->GetDetails(i); |
2260 if (details.type() != FIELD) continue; | 2249 if (details.type() != FIELD) continue; |
(...skipping 3578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5839 Isolate* isolate = object->GetIsolate(); | 5828 Isolate* isolate = object->GetIsolate(); |
5840 CALL_HEAP_FUNCTION(isolate, | 5829 CALL_HEAP_FUNCTION(isolate, |
5841 isolate->heap()->CopyJSObject(*object), JSObject); | 5830 isolate->heap()->CopyJSObject(*object), JSObject); |
5842 } | 5831 } |
5843 | 5832 |
5844 | 5833 |
5845 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, | 5834 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, |
5846 Representation representation, | 5835 Representation representation, |
5847 int index) { | 5836 int index) { |
5848 Isolate* isolate = object->GetIsolate(); | 5837 Isolate* isolate = object->GetIsolate(); |
5849 CALL_HEAP_FUNCTION(isolate, | 5838 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); |
5850 object->FastPropertyAt(representation, index), Object); | 5839 return Object::NewStorageFor(isolate, raw_value, representation); |
5851 } | 5840 } |
5852 | 5841 |
5853 | 5842 |
5854 template<class ContextObject> | 5843 template<class ContextObject> |
5855 class JSObjectWalkVisitor { | 5844 class JSObjectWalkVisitor { |
5856 public: | 5845 public: |
5857 JSObjectWalkVisitor(ContextObject* site_context, bool copying, | 5846 JSObjectWalkVisitor(ContextObject* site_context, bool copying, |
5858 JSObject::DeepCopyHints hints) | 5847 JSObject::DeepCopyHints hints) |
5859 : site_context_(site_context), | 5848 : site_context_(site_context), |
5860 copying_(copying), | 5849 copying_(copying), |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5940 for (int i = 0; i < limit; i++) { | 5929 for (int i = 0; i < limit; i++) { |
5941 PropertyDetails details = descriptors->GetDetails(i); | 5930 PropertyDetails details = descriptors->GetDetails(i); |
5942 if (details.type() != FIELD) continue; | 5931 if (details.type() != FIELD) continue; |
5943 int index = descriptors->GetFieldIndex(i); | 5932 int index = descriptors->GetFieldIndex(i); |
5944 Handle<Object> value(object->RawFastPropertyAt(index), isolate); | 5933 Handle<Object> value(object->RawFastPropertyAt(index), isolate); |
5945 if (value->IsJSObject()) { | 5934 if (value->IsJSObject()) { |
5946 value = VisitElementOrProperty(copy, Handle<JSObject>::cast(value)); | 5935 value = VisitElementOrProperty(copy, Handle<JSObject>::cast(value)); |
5947 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, value, Handle<JSObject>()); | 5936 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, value, Handle<JSObject>()); |
5948 } else { | 5937 } else { |
5949 Representation representation = details.representation(); | 5938 Representation representation = details.representation(); |
5950 value = NewStorageFor(isolate, value, representation); | 5939 value = Object::NewStorageFor(isolate, value, representation); |
5951 } | 5940 } |
5952 if (copying) { | 5941 if (copying) { |
5953 copy->FastPropertyAtPut(index, *value); | 5942 copy->FastPropertyAtPut(index, *value); |
5954 } | 5943 } |
5955 } | 5944 } |
5956 } else { | 5945 } else { |
5957 Handle<FixedArray> names = | 5946 Handle<FixedArray> names = |
5958 isolate->factory()->NewFixedArray(copy->NumberOfLocalProperties()); | 5947 isolate->factory()->NewFixedArray(copy->NumberOfLocalProperties()); |
5959 copy->GetLocalPropertyNames(*names, 0); | 5948 copy->GetLocalPropertyNames(*names, 0); |
5960 for (int i = 0; i < names->length(); i++) { | 5949 for (int i = 0; i < names->length(); i++) { |
(...skipping 10644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16605 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16594 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16606 static const char* error_messages_[] = { | 16595 static const char* error_messages_[] = { |
16607 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16596 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16608 }; | 16597 }; |
16609 #undef ERROR_MESSAGES_TEXTS | 16598 #undef ERROR_MESSAGES_TEXTS |
16610 return error_messages_[reason]; | 16599 return error_messages_[reason]; |
16611 } | 16600 } |
16612 | 16601 |
16613 | 16602 |
16614 } } // namespace v8::internal | 16603 } } // namespace v8::internal |
OLD | NEW |