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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 Handle<JSFunction> object_fun = | 471 Handle<JSFunction> object_fun = |
472 factory->NewFunction(object_name, factory->null_value()); | 472 factory->NewFunction(object_name, factory->null_value()); |
473 Handle<Map> object_function_map = | 473 Handle<Map> object_function_map = |
474 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 474 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
475 object_fun->set_initial_map(*object_function_map); | 475 object_fun->set_initial_map(*object_function_map); |
476 object_function_map->set_constructor(*object_fun); | 476 object_function_map->set_constructor(*object_fun); |
477 | 477 |
478 native_context()->set_object_function(*object_fun); | 478 native_context()->set_object_function(*object_fun); |
479 | 479 |
480 // Allocate a new prototype for the object function. | 480 // Allocate a new prototype for the object function. |
481 Handle<JSObject> prototype = factory->NewJSObject( | 481 Handle<Map> object_prototype_map = |
482 isolate->object_function(), | 482 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 483 Handle<DescriptorArray> prototype_descriptors( |
| 484 factory->NewDescriptorArray(0, 1)); |
| 485 DescriptorArray::WhitenessWitness witness(*prototype_descriptors); |
| 486 |
| 487 Handle<Foreign> object_prototype( |
| 488 factory->NewForeign(&Accessors::ObjectPrototype)); |
| 489 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
| 490 DONT_ENUM | DONT_DELETE); |
| 491 object_prototype_map->set_instance_descriptors(*prototype_descriptors); |
| 492 |
| 493 { // Add __proto__. |
| 494 CallbacksDescriptor d(heap->Proto_symbol(), *object_prototype, attribs); |
| 495 object_prototype_map->AppendDescriptor(&d, witness); |
| 496 } |
| 497 |
| 498 Handle<JSObject> prototype = factory->NewJSObjectFromMap( |
| 499 object_prototype_map, |
483 TENURED); | 500 TENURED); |
484 | |
485 native_context()->set_initial_object_prototype(*prototype); | 501 native_context()->set_initial_object_prototype(*prototype); |
486 SetPrototype(object_fun, prototype); | 502 SetPrototype(object_fun, prototype); |
487 } | 503 } |
488 | 504 |
489 // Allocate the empty function as the prototype for function ECMAScript | 505 // Allocate the empty function as the prototype for function ECMAScript |
490 // 262 15.3.4. | 506 // 262 15.3.4. |
491 Handle<String> symbol = | 507 Handle<String> symbol = |
492 factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("Empty")); | 508 factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("Empty")); |
493 Handle<JSFunction> empty_function = | 509 Handle<JSFunction> empty_function = |
494 factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE); | 510 factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE); |
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2429 return from + sizeof(NestingCounterType); | 2445 return from + sizeof(NestingCounterType); |
2430 } | 2446 } |
2431 | 2447 |
2432 | 2448 |
2433 // Called when the top-level V8 mutex is destroyed. | 2449 // Called when the top-level V8 mutex is destroyed. |
2434 void Bootstrapper::FreeThreadResources() { | 2450 void Bootstrapper::FreeThreadResources() { |
2435 ASSERT(!IsActive()); | 2451 ASSERT(!IsActive()); |
2436 } | 2452 } |
2437 | 2453 |
2438 } } // namespace v8::internal | 2454 } } // namespace v8::internal |
OLD | NEW |