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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 if (js_global_object_template.is_null()) { | 773 if (js_global_object_template.is_null()) { |
774 Handle<String> name = Handle<String>(heap()->empty_string()); | 774 Handle<String> name = Handle<String>(heap()->empty_string()); |
775 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( | 775 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( |
776 Builtins::kIllegal)); | 776 Builtins::kIllegal)); |
777 Handle<JSObject> prototype = | 777 Handle<JSObject> prototype = |
778 factory()->NewFunctionPrototype(isolate()->object_function()); | 778 factory()->NewFunctionPrototype(isolate()->object_function()); |
779 js_global_object_function = factory()->NewFunction( | 779 js_global_object_function = factory()->NewFunction( |
780 name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize); | 780 name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize); |
781 #ifdef DEBUG | 781 #ifdef DEBUG |
782 LookupIterator it(prototype, factory()->constructor_string(), | 782 LookupIterator it(prototype, factory()->constructor_string(), |
783 LookupIterator::CHECK_PROPERTY); | 783 LookupIterator::OWN_PROPERTY); |
784 Handle<Object> value = JSReceiver::GetProperty(&it).ToHandleChecked(); | 784 Handle<Object> value = JSReceiver::GetProperty(&it).ToHandleChecked(); |
785 DCHECK(it.IsFound()); | 785 DCHECK(it.IsFound()); |
786 DCHECK_EQ(*isolate()->object_function(), *value); | 786 DCHECK_EQ(*isolate()->object_function(), *value); |
787 #endif | 787 #endif |
788 } else { | 788 } else { |
789 Handle<FunctionTemplateInfo> js_global_object_constructor( | 789 Handle<FunctionTemplateInfo> js_global_object_constructor( |
790 FunctionTemplateInfo::cast(js_global_object_template->constructor())); | 790 FunctionTemplateInfo::cast(js_global_object_template->constructor())); |
791 js_global_object_function = | 791 js_global_object_function = |
792 factory()->CreateApiFunction(js_global_object_constructor, | 792 factory()->CreateApiFunction(js_global_object_constructor, |
793 factory()->the_hole_value(), | 793 factory()->the_hole_value(), |
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2442 } | 2442 } |
2443 case CONSTANT: { | 2443 case CONSTANT: { |
2444 HandleScope inner(isolate()); | 2444 HandleScope inner(isolate()); |
2445 Handle<Name> key = Handle<Name>(descs->GetKey(i)); | 2445 Handle<Name> key = Handle<Name>(descs->GetKey(i)); |
2446 Handle<Object> constant(descs->GetConstant(i), isolate()); | 2446 Handle<Object> constant(descs->GetConstant(i), isolate()); |
2447 JSObject::AddProperty(to, key, constant, details.attributes()); | 2447 JSObject::AddProperty(to, key, constant, details.attributes()); |
2448 break; | 2448 break; |
2449 } | 2449 } |
2450 case CALLBACKS: { | 2450 case CALLBACKS: { |
2451 Handle<Name> key(descs->GetKey(i)); | 2451 Handle<Name> key(descs->GetKey(i)); |
2452 LookupIterator it(to, key, LookupIterator::CHECK_PROPERTY); | 2452 LookupIterator it(to, key, LookupIterator::OWN_PROPERTY); |
2453 // If the property is already there we skip it | 2453 // If the property is already there we skip it |
2454 if (it.IsFound() && it.HasProperty()) continue; | 2454 if (it.IsFound() && it.HasProperty()) continue; |
2455 HandleScope inner(isolate()); | 2455 HandleScope inner(isolate()); |
2456 DCHECK(!to->HasFastProperties()); | 2456 DCHECK(!to->HasFastProperties()); |
2457 // Add to dictionary. | 2457 // Add to dictionary. |
2458 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); | 2458 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); |
2459 PropertyDetails d = PropertyDetails( | 2459 PropertyDetails d = PropertyDetails( |
2460 details.attributes(), CALLBACKS, i + 1); | 2460 details.attributes(), CALLBACKS, i + 1); |
2461 JSObject::SetNormalizedProperty(to, key, callbacks, d); | 2461 JSObject::SetNormalizedProperty(to, key, callbacks, d); |
2462 break; | 2462 break; |
(...skipping 10 matching lines...) Expand all Loading... |
2473 } else { | 2473 } else { |
2474 Handle<NameDictionary> properties = | 2474 Handle<NameDictionary> properties = |
2475 Handle<NameDictionary>(from->property_dictionary()); | 2475 Handle<NameDictionary>(from->property_dictionary()); |
2476 int capacity = properties->Capacity(); | 2476 int capacity = properties->Capacity(); |
2477 for (int i = 0; i < capacity; i++) { | 2477 for (int i = 0; i < capacity; i++) { |
2478 Object* raw_key(properties->KeyAt(i)); | 2478 Object* raw_key(properties->KeyAt(i)); |
2479 if (properties->IsKey(raw_key)) { | 2479 if (properties->IsKey(raw_key)) { |
2480 DCHECK(raw_key->IsName()); | 2480 DCHECK(raw_key->IsName()); |
2481 // If the property is already there we skip it. | 2481 // If the property is already there we skip it. |
2482 Handle<Name> key(Name::cast(raw_key)); | 2482 Handle<Name> key(Name::cast(raw_key)); |
2483 LookupIterator it(to, key, LookupIterator::CHECK_PROPERTY); | 2483 LookupIterator it(to, key, LookupIterator::OWN_PROPERTY); |
2484 if (it.IsFound() && it.HasProperty()) continue; | 2484 if (it.IsFound() && it.HasProperty()) continue; |
2485 // Set the property. | 2485 // Set the property. |
2486 Handle<Object> value = Handle<Object>(properties->ValueAt(i), | 2486 Handle<Object> value = Handle<Object>(properties->ValueAt(i), |
2487 isolate()); | 2487 isolate()); |
2488 DCHECK(!value->IsCell()); | 2488 DCHECK(!value->IsCell()); |
2489 if (value->IsPropertyCell()) { | 2489 if (value->IsPropertyCell()) { |
2490 value = Handle<Object>(PropertyCell::cast(*value)->value(), | 2490 value = Handle<Object>(PropertyCell::cast(*value)->value(), |
2491 isolate()); | 2491 isolate()); |
2492 } | 2492 } |
2493 PropertyDetails details = properties->DetailsAt(i); | 2493 PropertyDetails details = properties->DetailsAt(i); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 return from + sizeof(NestingCounterType); | 2691 return from + sizeof(NestingCounterType); |
2692 } | 2692 } |
2693 | 2693 |
2694 | 2694 |
2695 // Called when the top-level V8 mutex is destroyed. | 2695 // Called when the top-level V8 mutex is destroyed. |
2696 void Bootstrapper::FreeThreadResources() { | 2696 void Bootstrapper::FreeThreadResources() { |
2697 DCHECK(!IsActive()); | 2697 DCHECK(!IsActive()); |
2698 } | 2698 } |
2699 | 2699 |
2700 } } // namespace v8::internal | 2700 } } // namespace v8::internal |
OLD | NEW |