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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 DescriptorArray::WhitenessWitness witness(*descriptors); | 531 DescriptorArray::WhitenessWitness witness(*descriptors); |
532 | 532 |
533 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); | 533 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); |
534 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); | 534 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); |
535 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 535 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); |
536 Handle<AccessorPair> caller(factory()->NewAccessorPair()); | 536 Handle<AccessorPair> caller(factory()->NewAccessorPair()); |
537 Handle<Foreign> prototype; | 537 Handle<Foreign> prototype; |
538 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 538 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
539 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 539 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
540 } | 540 } |
541 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 541 PropertyAttributes rw_attribs = |
542 DONT_ENUM | DONT_DELETE); | 542 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
| 543 PropertyAttributes ro_attribs = |
| 544 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
543 map->set_instance_descriptors(*descriptors); | 545 map->set_instance_descriptors(*descriptors); |
544 | 546 |
545 { // Add length. | 547 { // Add length. |
546 CallbacksDescriptor d(*factory()->length_string(), *length, attribs); | 548 CallbacksDescriptor d(*factory()->length_string(), *length, ro_attribs); |
547 map->AppendDescriptor(&d, witness); | 549 map->AppendDescriptor(&d, witness); |
548 } | 550 } |
549 { // Add name. | 551 { // Add name. |
550 CallbacksDescriptor d(*factory()->name_string(), *name, attribs); | 552 CallbacksDescriptor d(*factory()->name_string(), *name, rw_attribs); |
551 map->AppendDescriptor(&d, witness); | 553 map->AppendDescriptor(&d, witness); |
552 } | 554 } |
553 { // Add arguments. | 555 { // Add arguments. |
554 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, attribs); | 556 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, |
| 557 rw_attribs); |
555 map->AppendDescriptor(&d, witness); | 558 map->AppendDescriptor(&d, witness); |
556 } | 559 } |
557 { // Add caller. | 560 { // Add caller. |
558 CallbacksDescriptor d(*factory()->caller_string(), *caller, attribs); | 561 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs); |
559 map->AppendDescriptor(&d, witness); | 562 map->AppendDescriptor(&d, witness); |
560 } | 563 } |
561 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 564 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
562 // Add prototype. | 565 // Add prototype. |
563 if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) { | 566 PropertyAttributes attribs = |
564 attribs = static_cast<PropertyAttributes>(attribs | READ_ONLY); | 567 prototypeMode == ADD_WRITEABLE_PROTOTYPE ? rw_attribs : ro_attribs; |
565 } | |
566 CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); | 568 CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); |
567 map->AppendDescriptor(&d, witness); | 569 map->AppendDescriptor(&d, witness); |
568 } | 570 } |
569 } | 571 } |
570 | 572 |
571 | 573 |
572 // ECMAScript 5th Edition, 13.2.3 | 574 // ECMAScript 5th Edition, 13.2.3 |
573 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { | 575 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { |
574 if (throw_type_error_function.is_null()) { | 576 if (throw_type_error_function.is_null()) { |
575 Handle<String> name = factory()->InternalizeOneByteString( | 577 Handle<String> name = factory()->InternalizeOneByteString( |
(...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 return from + sizeof(NestingCounterType); | 2642 return from + sizeof(NestingCounterType); |
2641 } | 2643 } |
2642 | 2644 |
2643 | 2645 |
2644 // Called when the top-level V8 mutex is destroyed. | 2646 // Called when the top-level V8 mutex is destroyed. |
2645 void Bootstrapper::FreeThreadResources() { | 2647 void Bootstrapper::FreeThreadResources() { |
2646 ASSERT(!IsActive()); | 2648 ASSERT(!IsActive()); |
2647 } | 2649 } |
2648 | 2650 |
2649 } } // namespace v8::internal | 2651 } } // namespace v8::internal |
OLD | NEW |