| 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/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
| 10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
| (...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 Handle<Name> key = Handle<Name>(descs->GetKey(i)); | 2481 Handle<Name> key = Handle<Name>(descs->GetKey(i)); |
| 2482 Handle<Object> constant(descs->GetConstant(i), isolate()); | 2482 Handle<Object> constant(descs->GetConstant(i), isolate()); |
| 2483 JSObject::AddProperty(to, key, constant, details.attributes()); | 2483 JSObject::AddProperty(to, key, constant, details.attributes()); |
| 2484 break; | 2484 break; |
| 2485 } | 2485 } |
| 2486 case CALLBACKS: { | 2486 case CALLBACKS: { |
| 2487 Handle<Name> key(descs->GetKey(i)); | 2487 Handle<Name> key(descs->GetKey(i)); |
| 2488 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); | 2488 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 2489 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); | 2489 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); |
| 2490 // If the property is already there we skip it | 2490 // If the property is already there we skip it |
| 2491 if (it.IsFound() && it.HasProperty()) continue; | 2491 if (it.IsFound()) continue; |
| 2492 HandleScope inner(isolate()); | 2492 HandleScope inner(isolate()); |
| 2493 DCHECK(!to->HasFastProperties()); | 2493 DCHECK(!to->HasFastProperties()); |
| 2494 // Add to dictionary. | 2494 // Add to dictionary. |
| 2495 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); | 2495 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); |
| 2496 PropertyDetails d = PropertyDetails( | 2496 PropertyDetails d = PropertyDetails( |
| 2497 details.attributes(), CALLBACKS, i + 1); | 2497 details.attributes(), CALLBACKS, i + 1); |
| 2498 JSObject::SetNormalizedProperty(to, key, callbacks, d); | 2498 JSObject::SetNormalizedProperty(to, key, callbacks, d); |
| 2499 break; | 2499 break; |
| 2500 } | 2500 } |
| 2501 // Do not occur since the from object has fast properties. | 2501 // Do not occur since the from object has fast properties. |
| 2502 case NORMAL: | 2502 case NORMAL: |
| 2503 UNREACHABLE(); | 2503 UNREACHABLE(); |
| 2504 break; | 2504 break; |
| 2505 } | 2505 } |
| 2506 } | 2506 } |
| 2507 } else { | 2507 } else { |
| 2508 Handle<NameDictionary> properties = | 2508 Handle<NameDictionary> properties = |
| 2509 Handle<NameDictionary>(from->property_dictionary()); | 2509 Handle<NameDictionary>(from->property_dictionary()); |
| 2510 int capacity = properties->Capacity(); | 2510 int capacity = properties->Capacity(); |
| 2511 for (int i = 0; i < capacity; i++) { | 2511 for (int i = 0; i < capacity; i++) { |
| 2512 Object* raw_key(properties->KeyAt(i)); | 2512 Object* raw_key(properties->KeyAt(i)); |
| 2513 if (properties->IsKey(raw_key)) { | 2513 if (properties->IsKey(raw_key)) { |
| 2514 DCHECK(raw_key->IsName()); | 2514 DCHECK(raw_key->IsName()); |
| 2515 // If the property is already there we skip it. | 2515 // If the property is already there we skip it. |
| 2516 Handle<Name> key(Name::cast(raw_key)); | 2516 Handle<Name> key(Name::cast(raw_key)); |
| 2517 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); | 2517 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 2518 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); | 2518 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); |
| 2519 if (it.IsFound() && it.HasProperty()) continue; | 2519 if (it.IsFound()) continue; |
| 2520 // Set the property. | 2520 // Set the property. |
| 2521 Handle<Object> value = Handle<Object>(properties->ValueAt(i), | 2521 Handle<Object> value = Handle<Object>(properties->ValueAt(i), |
| 2522 isolate()); | 2522 isolate()); |
| 2523 DCHECK(!value->IsCell()); | 2523 DCHECK(!value->IsCell()); |
| 2524 if (value->IsPropertyCell()) { | 2524 if (value->IsPropertyCell()) { |
| 2525 value = Handle<Object>(PropertyCell::cast(*value)->value(), | 2525 value = Handle<Object>(PropertyCell::cast(*value)->value(), |
| 2526 isolate()); | 2526 isolate()); |
| 2527 } | 2527 } |
| 2528 PropertyDetails details = properties->DetailsAt(i); | 2528 PropertyDetails details = properties->DetailsAt(i); |
| 2529 JSObject::AddProperty(to, key, value, details.attributes()); | 2529 JSObject::AddProperty(to, key, value, details.attributes()); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2726 return from + sizeof(NestingCounterType); | 2726 return from + sizeof(NestingCounterType); |
| 2727 } | 2727 } |
| 2728 | 2728 |
| 2729 | 2729 |
| 2730 // Called when the top-level V8 mutex is destroyed. | 2730 // Called when the top-level V8 mutex is destroyed. |
| 2731 void Bootstrapper::FreeThreadResources() { | 2731 void Bootstrapper::FreeThreadResources() { |
| 2732 DCHECK(!IsActive()); | 2732 DCHECK(!IsActive()); |
| 2733 } | 2733 } |
| 2734 | 2734 |
| 2735 } } // namespace v8::internal | 2735 } } // namespace v8::internal |
| OLD | NEW |