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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 DescriptorArray::WhitenessWitness witness(*descriptors); | 389 DescriptorArray::WhitenessWitness witness(*descriptors); |
390 | 390 |
391 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); | 391 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); |
392 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); | 392 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); |
393 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); | 393 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); |
394 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); | 394 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); |
395 Handle<Foreign> prototype; | 395 Handle<Foreign> prototype; |
396 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 396 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
397 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 397 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
398 } | 398 } |
399 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 399 PropertyAttributes ro_attribs = static_cast<PropertyAttributes>( |
400 DONT_ENUM | DONT_DELETE | READ_ONLY); | 400 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 401 PropertyAttributes roc_attribs = static_cast<PropertyAttributes>( |
| 402 DONT_ENUM | READ_ONLY); |
401 map->set_instance_descriptors(*descriptors); | 403 map->set_instance_descriptors(*descriptors); |
402 | 404 |
403 { // Add length. | 405 { // Add length. |
404 CallbacksDescriptor d(*factory()->length_string(), *length, attribs); | 406 CallbacksDescriptor d(*factory()->length_string(), *length, roc_attribs); |
405 map->AppendDescriptor(&d, witness); | 407 map->AppendDescriptor(&d, witness); |
406 } | 408 } |
407 { // Add name. | 409 { // Add name. |
408 CallbacksDescriptor d(*factory()->name_string(), *name, attribs); | 410 CallbacksDescriptor d(*factory()->name_string(), *name, roc_attribs); |
409 map->AppendDescriptor(&d, witness); | 411 map->AppendDescriptor(&d, witness); |
410 } | 412 } |
411 { // Add arguments. | 413 { // Add arguments. |
412 CallbacksDescriptor d(*factory()->arguments_string(), *args, attribs); | 414 CallbacksDescriptor d(*factory()->arguments_string(), *args, ro_attribs); |
413 map->AppendDescriptor(&d, witness); | 415 map->AppendDescriptor(&d, witness); |
414 } | 416 } |
415 { // Add caller. | 417 { // Add caller. |
416 CallbacksDescriptor d(*factory()->caller_string(), *caller, attribs); | 418 CallbacksDescriptor d(*factory()->caller_string(), *caller, ro_attribs); |
417 map->AppendDescriptor(&d, witness); | 419 map->AppendDescriptor(&d, witness); |
418 } | 420 } |
419 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 421 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
420 // Add prototype. | 422 // Add prototype. |
421 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { | 423 PropertyAttributes attribs = (prototypeMode == ADD_WRITEABLE_PROTOTYPE) |
422 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); | 424 ? static_cast<PropertyAttributes>(ro_attribs & ~READ_ONLY) : ro_attribs; |
423 } | |
424 CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); | 425 CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); |
425 map->AppendDescriptor(&d, witness); | 426 map->AppendDescriptor(&d, witness); |
426 } | 427 } |
427 } | 428 } |
428 | 429 |
429 | 430 |
430 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { | 431 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { |
431 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 432 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
432 SetFunctionInstanceDescriptor(map, prototype_mode); | 433 SetFunctionInstanceDescriptor(map, prototype_mode); |
433 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); | 434 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 532 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); |
532 Handle<AccessorPair> caller(factory()->NewAccessorPair()); | 533 Handle<AccessorPair> caller(factory()->NewAccessorPair()); |
533 Handle<Foreign> prototype; | 534 Handle<Foreign> prototype; |
534 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 535 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
535 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 536 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
536 } | 537 } |
537 PropertyAttributes rw_attribs = | 538 PropertyAttributes rw_attribs = |
538 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 539 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
539 PropertyAttributes ro_attribs = | 540 PropertyAttributes ro_attribs = |
540 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 541 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 542 PropertyAttributes roc_attribs = |
| 543 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); |
541 map->set_instance_descriptors(*descriptors); | 544 map->set_instance_descriptors(*descriptors); |
542 | 545 |
543 { // Add length. | 546 { // Add length. |
544 CallbacksDescriptor d(*factory()->length_string(), *length, ro_attribs); | 547 CallbacksDescriptor d(*factory()->length_string(), *length, roc_attribs); |
545 map->AppendDescriptor(&d, witness); | 548 map->AppendDescriptor(&d, witness); |
546 } | 549 } |
547 { // Add name. | 550 { // Add name. |
548 CallbacksDescriptor d(*factory()->name_string(), *name, ro_attribs); | 551 CallbacksDescriptor d(*factory()->name_string(), *name, roc_attribs); |
549 map->AppendDescriptor(&d, witness); | 552 map->AppendDescriptor(&d, witness); |
550 } | 553 } |
551 { // Add arguments. | 554 { // Add arguments. |
552 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, | 555 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, |
553 rw_attribs); | 556 rw_attribs); |
554 map->AppendDescriptor(&d, witness); | 557 map->AppendDescriptor(&d, witness); |
555 } | 558 } |
556 { // Add caller. | 559 { // Add caller. |
557 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs); | 560 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs); |
558 map->AppendDescriptor(&d, witness); | 561 map->AppendDescriptor(&d, witness); |
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 return from + sizeof(NestingCounterType); | 2698 return from + sizeof(NestingCounterType); |
2696 } | 2699 } |
2697 | 2700 |
2698 | 2701 |
2699 // Called when the top-level V8 mutex is destroyed. | 2702 // Called when the top-level V8 mutex is destroyed. |
2700 void Bootstrapper::FreeThreadResources() { | 2703 void Bootstrapper::FreeThreadResources() { |
2701 ASSERT(!IsActive()); | 2704 ASSERT(!IsActive()); |
2702 } | 2705 } |
2703 | 2706 |
2704 } } // namespace v8::internal | 2707 } } // namespace v8::internal |
OLD | NEW |