OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "allocation-site-scopes.h" | 8 #include "allocation-site-scopes.h" |
9 #include "api.h" | 9 #include "api.h" |
10 #include "arguments.h" | 10 #include "arguments.h" |
(...skipping 5952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5963 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) { | 5963 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) { |
5964 new_map = Map::CopyForObserved(old_map); | 5964 new_map = Map::CopyForObserved(old_map); |
5965 } else { | 5965 } else { |
5966 new_map = Map::Copy(old_map); | 5966 new_map = Map::Copy(old_map); |
5967 new_map->set_is_observed(); | 5967 new_map->set_is_observed(); |
5968 } | 5968 } |
5969 JSObject::MigrateToMap(object, new_map); | 5969 JSObject::MigrateToMap(object, new_map); |
5970 } | 5970 } |
5971 | 5971 |
5972 | 5972 |
5973 Handle<JSObject> JSObject::Copy(Handle<JSObject> object, | |
5974 Handle<AllocationSite> site) { | |
5975 Isolate* isolate = object->GetIsolate(); | |
5976 CALL_HEAP_FUNCTION(isolate, | |
5977 isolate->heap()->CopyJSObject( | |
5978 *object, | |
5979 site.is_null() ? NULL : *site), | |
5980 JSObject); | |
5981 } | |
5982 | |
5983 | |
5984 Handle<JSObject> JSObject::Copy(Handle<JSObject> object) { | |
5985 Isolate* isolate = object->GetIsolate(); | |
5986 CALL_HEAP_FUNCTION(isolate, | |
5987 isolate->heap()->CopyJSObject(*object, NULL), | |
5988 JSObject); | |
5989 } | |
5990 | |
5991 | |
5992 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, | 5973 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, |
5993 Representation representation, | 5974 Representation representation, |
5994 int index) { | 5975 int index) { |
5995 Isolate* isolate = object->GetIsolate(); | 5976 Isolate* isolate = object->GetIsolate(); |
5996 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); | 5977 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); |
5997 return Object::NewStorageFor(isolate, raw_value, representation); | 5978 return Object::NewStorageFor(isolate, raw_value, representation); |
5998 } | 5979 } |
5999 | 5980 |
6000 | 5981 |
6001 template<class ContextObject> | 5982 template<class ContextObject> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6050 if (object->map()->is_deprecated()) { | 6031 if (object->map()->is_deprecated()) { |
6051 JSObject::MigrateInstance(object); | 6032 JSObject::MigrateInstance(object); |
6052 } | 6033 } |
6053 | 6034 |
6054 Handle<JSObject> copy; | 6035 Handle<JSObject> copy; |
6055 if (copying) { | 6036 if (copying) { |
6056 Handle<AllocationSite> site_to_pass; | 6037 Handle<AllocationSite> site_to_pass; |
6057 if (site_context()->ShouldCreateMemento(object)) { | 6038 if (site_context()->ShouldCreateMemento(object)) { |
6058 site_to_pass = site_context()->current(); | 6039 site_to_pass = site_context()->current(); |
6059 } | 6040 } |
6060 copy = JSObject::Copy(object, site_to_pass); | 6041 copy = isolate->factory()->CopyJSObjectWithAllocationSite( |
| 6042 object, site_to_pass); |
6061 } else { | 6043 } else { |
6062 copy = object; | 6044 copy = object; |
6063 } | 6045 } |
6064 | 6046 |
6065 ASSERT(copying || copy.is_identical_to(object)); | 6047 ASSERT(copying || copy.is_identical_to(object)); |
6066 | 6048 |
6067 ElementsKind kind = copy->GetElementsKind(); | 6049 ElementsKind kind = copy->GetElementsKind(); |
6068 if (copying && IsFastSmiOrObjectElementsKind(kind) && | 6050 if (copying && IsFastSmiOrObjectElementsKind(kind) && |
6069 FixedArray::cast(copy->elements())->map() == | 6051 FixedArray::cast(copy->elements())->map() == |
6070 isolate->heap()->fixed_cow_array_map()) { | 6052 isolate->heap()->fixed_cow_array_map()) { |
(...skipping 11233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17304 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17286 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17305 static const char* error_messages_[] = { | 17287 static const char* error_messages_[] = { |
17306 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17288 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17307 }; | 17289 }; |
17308 #undef ERROR_MESSAGES_TEXTS | 17290 #undef ERROR_MESSAGES_TEXTS |
17309 return error_messages_[reason]; | 17291 return error_messages_[reason]; |
17310 } | 17292 } |
17311 | 17293 |
17312 | 17294 |
17313 } } // namespace v8::internal | 17295 } } // namespace v8::internal |
OLD | NEW |