| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3319 } | 3319 } |
| 3320 | 3320 |
| 3321 // Careful: Don't allocate here! | 3321 // Careful: Don't allocate here! |
| 3322 // For some callers of this method, |object| might be in an inconsistent | 3322 // For some callers of this method, |object| might be in an inconsistent |
| 3323 // state now: the new map might have a new elements_kind, but the object's | 3323 // state now: the new map might have a new elements_kind, but the object's |
| 3324 // elements pointer hasn't been updated yet. Callers will fix this, but in | 3324 // elements pointer hasn't been updated yet. Callers will fix this, but in |
| 3325 // the meantime, (indirectly) calling JSObjectVerify() must be avoided. | 3325 // the meantime, (indirectly) calling JSObjectVerify() must be avoided. |
| 3326 // When adding code here, add a DisallowHeapAllocation too. | 3326 // When adding code here, add a DisallowHeapAllocation too. |
| 3327 } | 3327 } |
| 3328 | 3328 |
| 3329 void JSObject::ForceSetPrototype(Handle<JSObject> object, |
| 3330 Handle<Object> proto) { |
| 3331 // object.__proto__ = proto; |
| 3332 Handle<Map> old_map = Handle<Map>(object->map()); |
| 3333 Handle<Map> new_map = Map::Copy(old_map, "ForceSetPrototype"); |
| 3334 Map::SetPrototype(new_map, proto, FAST_PROTOTYPE); |
| 3335 JSObject::MigrateToMap(object, new_map); |
| 3336 } |
| 3337 |
| 3329 int Map::NumberOfFields() { | 3338 int Map::NumberOfFields() { |
| 3330 DescriptorArray* descriptors = instance_descriptors(); | 3339 DescriptorArray* descriptors = instance_descriptors(); |
| 3331 int result = 0; | 3340 int result = 0; |
| 3332 for (int i = 0; i < NumberOfOwnDescriptors(); i++) { | 3341 for (int i = 0; i < NumberOfOwnDescriptors(); i++) { |
| 3333 if (descriptors->GetDetails(i).location() == kField) result++; | 3342 if (descriptors->GetDetails(i).location() == kField) result++; |
| 3334 } | 3343 } |
| 3335 return result; | 3344 return result; |
| 3336 } | 3345 } |
| 3337 | 3346 |
| 3338 Handle<Map> Map::CopyGeneralizeAllRepresentations( | 3347 Handle<Map> Map::CopyGeneralizeAllRepresentations( |
| (...skipping 15596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18935 | 18944 |
| 18936 Object* data_obj = | 18945 Object* data_obj = |
| 18937 constructor->shared()->get_api_func_data()->access_check_info(); | 18946 constructor->shared()->get_api_func_data()->access_check_info(); |
| 18938 if (data_obj->IsUndefined(isolate)) return nullptr; | 18947 if (data_obj->IsUndefined(isolate)) return nullptr; |
| 18939 | 18948 |
| 18940 return AccessCheckInfo::cast(data_obj); | 18949 return AccessCheckInfo::cast(data_obj); |
| 18941 } | 18950 } |
| 18942 | 18951 |
| 18943 } // namespace internal | 18952 } // namespace internal |
| 18944 } // namespace v8 | 18953 } // namespace v8 |
| OLD | NEW |