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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 Handle<JSFunction> object_fun = | 470 Handle<JSFunction> object_fun = |
471 factory->NewFunction(object_name, factory->null_value()); | 471 factory->NewFunction(object_name, factory->null_value()); |
472 Handle<Map> object_function_map = | 472 Handle<Map> object_function_map = |
473 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 473 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
474 object_fun->set_initial_map(*object_function_map); | 474 object_fun->set_initial_map(*object_function_map); |
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<Map> object_prototype_map = | 480 Handle<JSObject> prototype = factory->NewJSObject( |
481 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 481 isolate->object_function(), |
482 Handle<DescriptorArray> prototype_descriptors( | 482 TENURED); |
483 factory->NewDescriptorArray(0, 1)); | |
484 DescriptorArray::WhitenessWitness witness(*prototype_descriptors); | |
485 | 483 |
486 Handle<Foreign> object_prototype( | |
487 factory->NewForeign(&Accessors::ObjectPrototype)); | |
488 PropertyAttributes attribs = static_cast<PropertyAttributes>(DONT_ENUM); | |
489 object_prototype_map->set_instance_descriptors(*prototype_descriptors); | |
490 | |
491 { // Add __proto__. | |
492 CallbacksDescriptor d(heap->proto_string(), *object_prototype, attribs); | |
493 object_prototype_map->AppendDescriptor(&d, witness); | |
494 } | |
495 | |
496 Handle<JSObject> prototype = factory->NewJSObjectFromMap( | |
497 object_prototype_map, | |
498 TENURED); | |
499 native_context()->set_initial_object_prototype(*prototype); | 484 native_context()->set_initial_object_prototype(*prototype); |
500 SetPrototype(object_fun, prototype); | 485 SetPrototype(object_fun, prototype); |
501 } | 486 } |
502 | 487 |
503 // Allocate the empty function as the prototype for function ECMAScript | 488 // Allocate the empty function as the prototype for function ECMAScript |
504 // 262 15.3.4. | 489 // 262 15.3.4. |
505 Handle<String> empty_string = | 490 Handle<String> empty_string = |
506 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty")); | 491 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty")); |
507 Handle<JSFunction> empty_function = | 492 Handle<JSFunction> empty_function = |
508 factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE); | 493 factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE); |
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 return from + sizeof(NestingCounterType); | 2495 return from + sizeof(NestingCounterType); |
2511 } | 2496 } |
2512 | 2497 |
2513 | 2498 |
2514 // Called when the top-level V8 mutex is destroyed. | 2499 // Called when the top-level V8 mutex is destroyed. |
2515 void Bootstrapper::FreeThreadResources() { | 2500 void Bootstrapper::FreeThreadResources() { |
2516 ASSERT(!IsActive()); | 2501 ASSERT(!IsActive()); |
2517 } | 2502 } |
2518 | 2503 |
2519 } } // namespace v8::internal | 2504 } } // namespace v8::internal |
OLD | NEW |