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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 DescriptorArray::WhitenessWitness witness(*descriptors); | 419 DescriptorArray::WhitenessWitness witness(*descriptors); |
420 | 420 |
421 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); | 421 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); |
422 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); | 422 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); |
423 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); | 423 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); |
424 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); | 424 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); |
425 Handle<Foreign> prototype; | 425 Handle<Foreign> prototype; |
426 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 426 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
427 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 427 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
428 } | 428 } |
429 PropertyAttributes ro_attribs = static_cast<PropertyAttributes>( | 429 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
430 DONT_ENUM | DONT_DELETE | READ_ONLY); | 430 DONT_ENUM | DONT_DELETE | READ_ONLY); |
431 PropertyAttributes roc_attribs = static_cast<PropertyAttributes>( | |
432 DONT_ENUM | READ_ONLY); | |
433 map->set_instance_descriptors(*descriptors); | 431 map->set_instance_descriptors(*descriptors); |
434 | 432 |
435 { // Add length. | 433 { // Add length. |
436 CallbacksDescriptor d(*factory()->length_string(), *length, roc_attribs); | 434 CallbacksDescriptor d(*factory()->length_string(), *length, attribs); |
437 map->AppendDescriptor(&d, witness); | 435 map->AppendDescriptor(&d, witness); |
438 } | 436 } |
439 { // Add name. | 437 { // Add name. |
440 CallbacksDescriptor d(*factory()->name_string(), *name, roc_attribs); | 438 CallbacksDescriptor d(*factory()->name_string(), *name, attribs); |
441 map->AppendDescriptor(&d, witness); | 439 map->AppendDescriptor(&d, witness); |
442 } | 440 } |
443 { // Add arguments. | 441 { // Add arguments. |
444 CallbacksDescriptor d(*factory()->arguments_string(), *args, ro_attribs); | 442 CallbacksDescriptor d(*factory()->arguments_string(), *args, attribs); |
445 map->AppendDescriptor(&d, witness); | 443 map->AppendDescriptor(&d, witness); |
446 } | 444 } |
447 { // Add caller. | 445 { // Add caller. |
448 CallbacksDescriptor d(*factory()->caller_string(), *caller, ro_attribs); | 446 CallbacksDescriptor d(*factory()->caller_string(), *caller, attribs); |
449 map->AppendDescriptor(&d, witness); | 447 map->AppendDescriptor(&d, witness); |
450 } | 448 } |
451 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 449 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
452 // Add prototype. | 450 // Add prototype. |
453 PropertyAttributes attribs = (prototypeMode == ADD_WRITEABLE_PROTOTYPE) | 451 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { |
454 ? static_cast<PropertyAttributes>(ro_attribs & ~READ_ONLY) : ro_attribs; | 452 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); |
| 453 } |
455 CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); | 454 CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); |
456 map->AppendDescriptor(&d, witness); | 455 map->AppendDescriptor(&d, witness); |
457 } | 456 } |
458 } | 457 } |
459 | 458 |
460 | 459 |
461 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { | 460 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { |
462 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 461 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
463 SetFunctionInstanceDescriptor(map, prototype_mode); | 462 SetFunctionInstanceDescriptor(map, prototype_mode); |
464 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); | 463 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 561 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); |
563 Handle<AccessorPair> caller(factory()->NewAccessorPair()); | 562 Handle<AccessorPair> caller(factory()->NewAccessorPair()); |
564 Handle<Foreign> prototype; | 563 Handle<Foreign> prototype; |
565 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 564 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
566 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 565 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
567 } | 566 } |
568 PropertyAttributes rw_attribs = | 567 PropertyAttributes rw_attribs = |
569 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 568 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
570 PropertyAttributes ro_attribs = | 569 PropertyAttributes ro_attribs = |
571 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 570 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
572 PropertyAttributes roc_attribs = | |
573 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | |
574 map->set_instance_descriptors(*descriptors); | 571 map->set_instance_descriptors(*descriptors); |
575 | 572 |
576 { // Add length. | 573 { // Add length. |
577 CallbacksDescriptor d(*factory()->length_string(), *length, roc_attribs); | 574 CallbacksDescriptor d(*factory()->length_string(), *length, ro_attribs); |
578 map->AppendDescriptor(&d, witness); | 575 map->AppendDescriptor(&d, witness); |
579 } | 576 } |
580 { // Add name. | 577 { // Add name. |
581 CallbacksDescriptor d(*factory()->name_string(), *name, roc_attribs); | 578 CallbacksDescriptor d(*factory()->name_string(), *name, ro_attribs); |
582 map->AppendDescriptor(&d, witness); | 579 map->AppendDescriptor(&d, witness); |
583 } | 580 } |
584 { // Add arguments. | 581 { // Add arguments. |
585 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, | 582 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, |
586 rw_attribs); | 583 rw_attribs); |
587 map->AppendDescriptor(&d, witness); | 584 map->AppendDescriptor(&d, witness); |
588 } | 585 } |
589 { // Add caller. | 586 { // Add caller. |
590 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs); | 587 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs); |
591 map->AppendDescriptor(&d, witness); | 588 map->AppendDescriptor(&d, witness); |
(...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2734 return from + sizeof(NestingCounterType); | 2731 return from + sizeof(NestingCounterType); |
2735 } | 2732 } |
2736 | 2733 |
2737 | 2734 |
2738 // Called when the top-level V8 mutex is destroyed. | 2735 // Called when the top-level V8 mutex is destroyed. |
2739 void Bootstrapper::FreeThreadResources() { | 2736 void Bootstrapper::FreeThreadResources() { |
2740 ASSERT(!IsActive()); | 2737 ASSERT(!IsActive()); |
2741 } | 2738 } |
2742 | 2739 |
2743 } } // namespace v8::internal | 2740 } } // namespace v8::internal |
OLD | NEW |