OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 object_function_map->set_constructor(*object_fun); | 475 object_function_map->set_constructor(*object_fun); |
476 | 476 |
477 native_context()->set_object_function(*object_fun); | 477 native_context()->set_object_function(*object_fun); |
478 | 478 |
479 // Allocate a new prototype for the object function. | 479 // Allocate a new prototype for the object function. |
480 Handle<JSObject> prototype = factory->NewJSObject( | 480 Handle<JSObject> prototype = factory->NewJSObject( |
481 isolate->object_function(), | 481 isolate->object_function(), |
482 TENURED); | 482 TENURED); |
483 | 483 |
484 native_context()->set_initial_object_prototype(*prototype); | 484 native_context()->set_initial_object_prototype(*prototype); |
| 485 // For boostrapping set the array prototype to be the same as the object |
| 486 // prototype, otherwise the missing initial_array_prototype will cause |
| 487 // assertions during startup. |
| 488 native_context()->set_initial_array_prototype(*prototype); |
485 SetPrototype(object_fun, prototype); | 489 SetPrototype(object_fun, prototype); |
486 } | 490 } |
487 | 491 |
488 // Allocate the empty function as the prototype for function ECMAScript | 492 // Allocate the empty function as the prototype for function ECMAScript |
489 // 262 15.3.4. | 493 // 262 15.3.4. |
490 Handle<String> empty_string = | 494 Handle<String> empty_string = |
491 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty")); | 495 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty")); |
492 Handle<JSFunction> empty_function = | 496 Handle<JSFunction> empty_function = |
493 factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE); | 497 factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE); |
494 | 498 |
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 Handle<FunctionTemplateInfo> proxy_constructor( | 2378 Handle<FunctionTemplateInfo> proxy_constructor( |
2375 FunctionTemplateInfo::cast(proxy_data->constructor())); | 2379 FunctionTemplateInfo::cast(proxy_data->constructor())); |
2376 if (!proxy_constructor->prototype_template()->IsUndefined()) { | 2380 if (!proxy_constructor->prototype_template()->IsUndefined()) { |
2377 Handle<ObjectTemplateInfo> inner_data( | 2381 Handle<ObjectTemplateInfo> inner_data( |
2378 ObjectTemplateInfo::cast(proxy_constructor->prototype_template())); | 2382 ObjectTemplateInfo::cast(proxy_constructor->prototype_template())); |
2379 if (!ConfigureApiObject(inner_global, inner_data)) return false; | 2383 if (!ConfigureApiObject(inner_global, inner_data)) return false; |
2380 } | 2384 } |
2381 } | 2385 } |
2382 | 2386 |
2383 SetObjectPrototype(global_proxy, inner_global); | 2387 SetObjectPrototype(global_proxy, inner_global); |
| 2388 |
| 2389 native_context()->set_initial_array_prototype( |
| 2390 JSArray::cast(native_context()->array_function()->prototype())); |
| 2391 |
2384 return true; | 2392 return true; |
2385 } | 2393 } |
2386 | 2394 |
2387 | 2395 |
2388 bool Genesis::ConfigureApiObject(Handle<JSObject> object, | 2396 bool Genesis::ConfigureApiObject(Handle<JSObject> object, |
2389 Handle<ObjectTemplateInfo> object_template) { | 2397 Handle<ObjectTemplateInfo> object_template) { |
2390 ASSERT(!object_template.is_null()); | 2398 ASSERT(!object_template.is_null()); |
2391 ASSERT(object->IsInstanceOf( | 2399 ASSERT(object->IsInstanceOf( |
2392 FunctionTemplateInfo::cast(object_template->constructor()))); | 2400 FunctionTemplateInfo::cast(object_template->constructor()))); |
2393 | 2401 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2618 return from + sizeof(NestingCounterType); | 2626 return from + sizeof(NestingCounterType); |
2619 } | 2627 } |
2620 | 2628 |
2621 | 2629 |
2622 // Called when the top-level V8 mutex is destroyed. | 2630 // Called when the top-level V8 mutex is destroyed. |
2623 void Bootstrapper::FreeThreadResources() { | 2631 void Bootstrapper::FreeThreadResources() { |
2624 ASSERT(!IsActive()); | 2632 ASSERT(!IsActive()); |
2625 } | 2633 } |
2626 | 2634 |
2627 } } // namespace v8::internal | 2635 } } // namespace v8::internal |
OLD | NEW |