OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 } else { | 573 } else { |
574 Handle<FunctionTemplateInfo> js_global_constructor( | 574 Handle<FunctionTemplateInfo> js_global_constructor( |
575 FunctionTemplateInfo::cast(js_global_template->constructor())); | 575 FunctionTemplateInfo::cast(js_global_template->constructor())); |
576 js_global_function = | 576 js_global_function = |
577 Factory::CreateApiFunction(js_global_constructor, | 577 Factory::CreateApiFunction(js_global_constructor, |
578 Factory::InnerGlobalObject); | 578 Factory::InnerGlobalObject); |
579 } | 579 } |
580 | 580 |
581 js_global_function->initial_map()->set_is_hidden_prototype(); | 581 js_global_function->initial_map()->set_is_hidden_prototype(); |
582 SetExpectedNofProperties(js_global_function, 100); | 582 SetExpectedNofProperties(js_global_function, 100); |
583 object = Handle<JSGlobalObject>::cast( | 583 object = Factory::NewJSGlobalObject(js_global_function); |
584 Factory::NewJSObject(js_global_function, TENURED)); | |
585 } | 584 } |
586 | 585 |
587 // Set the global context for the global object. | 586 // Set the global context for the global object. |
588 object->set_global_context(*global_context()); | 587 object->set_global_context(*global_context()); |
589 | 588 |
590 // Step 2: create or re-initialize the global proxy object. | 589 // Step 2: create or re-initialize the global proxy object. |
591 Handle<JSGlobalProxy> global_proxy; | 590 Handle<JSGlobalProxy> global_proxy; |
592 { | 591 { |
593 Handle<JSFunction> global_proxy_function; | 592 Handle<JSFunction> global_proxy_function; |
594 if (global_template.IsEmpty()) { | 593 if (global_template.IsEmpty()) { |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 Object* raw_key(properties->KeyAt(i)); | 1437 Object* raw_key(properties->KeyAt(i)); |
1439 if (properties->IsKey(raw_key)) { | 1438 if (properties->IsKey(raw_key)) { |
1440 ASSERT(raw_key->IsString()); | 1439 ASSERT(raw_key->IsString()); |
1441 // If the property is already there we skip it. | 1440 // If the property is already there we skip it. |
1442 LookupResult result; | 1441 LookupResult result; |
1443 to->LocalLookup(String::cast(raw_key), &result); | 1442 to->LocalLookup(String::cast(raw_key), &result); |
1444 if (result.IsValid()) continue; | 1443 if (result.IsValid()) continue; |
1445 // Set the property. | 1444 // Set the property. |
1446 Handle<String> key = Handle<String>(String::cast(raw_key)); | 1445 Handle<String> key = Handle<String>(String::cast(raw_key)); |
1447 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); | 1446 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); |
| 1447 if (value->IsJSGlobalPropertyCell()) { |
| 1448 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value()); |
| 1449 } |
1448 PropertyDetails details = properties->DetailsAt(i); | 1450 PropertyDetails details = properties->DetailsAt(i); |
1449 SetProperty(to, key, value, details.attributes()); | 1451 SetProperty(to, key, value, details.attributes()); |
1450 } | 1452 } |
1451 } | 1453 } |
1452 } | 1454 } |
1453 } | 1455 } |
1454 | 1456 |
1455 | 1457 |
1456 void Genesis::TransferIndexedProperties(Handle<JSObject> from, | 1458 void Genesis::TransferIndexedProperties(Handle<JSObject> from, |
1457 Handle<JSObject> to) { | 1459 Handle<JSObject> to) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 } | 1615 } |
1614 | 1616 |
1615 | 1617 |
1616 // Restore statics that are thread local. | 1618 // Restore statics that are thread local. |
1617 char* Genesis::RestoreState(char* from) { | 1619 char* Genesis::RestoreState(char* from) { |
1618 current_ = *reinterpret_cast<Genesis**>(from); | 1620 current_ = *reinterpret_cast<Genesis**>(from); |
1619 return from + sizeof(current_); | 1621 return from + sizeof(current_); |
1620 } | 1622 } |
1621 | 1623 |
1622 } } // namespace v8::internal | 1624 } } // namespace v8::internal |
OLD | NEW |