| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 4369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4380 Handle<DescriptorArray> descs = | 4380 Handle<DescriptorArray> descs = |
| 4381 Handle<DescriptorArray>(from->map()->instance_descriptors()); | 4381 Handle<DescriptorArray>(from->map()->instance_descriptors()); |
| 4382 for (int i = 0; i < from->map()->NumberOfOwnDescriptors(); i++) { | 4382 for (int i = 0; i < from->map()->NumberOfOwnDescriptors(); i++) { |
| 4383 PropertyDetails details = descs->GetDetails(i); | 4383 PropertyDetails details = descs->GetDetails(i); |
| 4384 if (details.location() == kField) { | 4384 if (details.location() == kField) { |
| 4385 if (details.kind() == kData) { | 4385 if (details.kind() == kData) { |
| 4386 HandleScope inner(isolate()); | 4386 HandleScope inner(isolate()); |
| 4387 Handle<Name> key = Handle<Name>(descs->GetKey(i)); | 4387 Handle<Name> key = Handle<Name>(descs->GetKey(i)); |
| 4388 FieldIndex index = FieldIndex::ForDescriptor(from->map(), i); | 4388 FieldIndex index = FieldIndex::ForDescriptor(from->map(), i); |
| 4389 DCHECK(!descs->GetDetails(i).representation().IsDouble()); | 4389 DCHECK(!descs->GetDetails(i).representation().IsDouble()); |
| 4390 Handle<Object> value = Handle<Object>(from->RawFastPropertyAt(index), | 4390 Handle<Object> value(from->RawFastPropertyAt(index), isolate()); |
| 4391 isolate()); | |
| 4392 JSObject::AddProperty(to, key, value, details.attributes()); | 4391 JSObject::AddProperty(to, key, value, details.attributes()); |
| 4393 } else { | 4392 } else { |
| 4394 DCHECK_EQ(kAccessor, details.kind()); | 4393 DCHECK_EQ(kAccessor, details.kind()); |
| 4395 UNREACHABLE(); | 4394 UNREACHABLE(); |
| 4396 } | 4395 } |
| 4397 | 4396 |
| 4398 } else { | 4397 } else { |
| 4399 DCHECK_EQ(kDescriptor, details.location()); | 4398 DCHECK_EQ(kDescriptor, details.location()); |
| 4400 if (details.kind() == kData) { | 4399 if (details.kind() == kData) { |
| 4401 HandleScope inner(isolate()); | 4400 HandleScope inner(isolate()); |
| 4402 Handle<Name> key = Handle<Name>(descs->GetKey(i)); | 4401 Handle<Name> key = Handle<Name>(descs->GetKey(i)); |
| 4403 Handle<Object> constant(descs->GetConstant(i), isolate()); | 4402 Handle<Object> value(descs->GetValue(i), isolate()); |
| 4404 JSObject::AddProperty(to, key, constant, details.attributes()); | 4403 JSObject::AddProperty(to, key, value, details.attributes()); |
| 4405 | 4404 |
| 4406 } else { | 4405 } else { |
| 4407 DCHECK_EQ(kAccessor, details.kind()); | 4406 DCHECK_EQ(kAccessor, details.kind()); |
| 4408 Handle<Name> key(descs->GetKey(i)); | 4407 Handle<Name> key(descs->GetKey(i)); |
| 4409 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); | 4408 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 4410 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); | 4409 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); |
| 4411 // If the property is already there we skip it | 4410 // If the property is already there we skip it |
| 4412 if (it.IsFound()) continue; | 4411 if (it.IsFound()) continue; |
| 4413 HandleScope inner(isolate()); | 4412 HandleScope inner(isolate()); |
| 4414 DCHECK(!to->HasFastProperties()); | 4413 DCHECK(!to->HasFastProperties()); |
| 4415 // Add to dictionary. | 4414 // Add to dictionary. |
| 4416 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); | 4415 Handle<Object> value(descs->GetValue(i), isolate()); |
| 4417 PropertyDetails d(kAccessor, details.attributes(), i + 1, | 4416 PropertyDetails d(kAccessor, details.attributes(), i + 1, |
| 4418 PropertyCellType::kMutable); | 4417 PropertyCellType::kMutable); |
| 4419 JSObject::SetNormalizedProperty(to, key, callbacks, d); | 4418 JSObject::SetNormalizedProperty(to, key, value, d); |
| 4420 } | 4419 } |
| 4421 } | 4420 } |
| 4422 } | 4421 } |
| 4423 } else if (from->IsJSGlobalObject()) { | 4422 } else if (from->IsJSGlobalObject()) { |
| 4424 // Copy all keys and values in enumeration order. | 4423 // Copy all keys and values in enumeration order. |
| 4425 Handle<GlobalDictionary> properties = | 4424 Handle<GlobalDictionary> properties = |
| 4426 Handle<GlobalDictionary>(from->global_dictionary()); | 4425 Handle<GlobalDictionary>(from->global_dictionary()); |
| 4427 Handle<FixedArray> key_indices = | 4426 Handle<FixedArray> key_indices = |
| 4428 GlobalDictionary::IterationIndices(properties); | 4427 GlobalDictionary::IterationIndices(properties); |
| 4429 for (int i = 0; i < key_indices->length(); i++) { | 4428 for (int i = 0; i < key_indices->length(); i++) { |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4763 } | 4762 } |
| 4764 | 4763 |
| 4765 | 4764 |
| 4766 // Called when the top-level V8 mutex is destroyed. | 4765 // Called when the top-level V8 mutex is destroyed. |
| 4767 void Bootstrapper::FreeThreadResources() { | 4766 void Bootstrapper::FreeThreadResources() { |
| 4768 DCHECK(!IsActive()); | 4767 DCHECK(!IsActive()); |
| 4769 } | 4768 } |
| 4770 | 4769 |
| 4771 } // namespace internal | 4770 } // namespace internal |
| 4772 } // namespace v8 | 4771 } // namespace v8 |
| OLD | NEW |