OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "bootstrapper.h" | 5 #include "bootstrapper.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
9 #include "natives.h" | 9 #include "natives.h" |
10 #include "snapshot.h" | 10 #include "snapshot.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 function->shared()->set_native(true); | 381 function->shared()->set_native(true); |
382 return function; | 382 return function; |
383 } | 383 } |
384 | 384 |
385 | 385 |
386 void Genesis::SetFunctionInstanceDescriptor( | 386 void Genesis::SetFunctionInstanceDescriptor( |
387 Handle<Map> map, PrototypePropertyMode prototypeMode) { | 387 Handle<Map> map, PrototypePropertyMode prototypeMode) { |
388 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; | 388 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; |
389 Map::EnsureDescriptorSlack(map, size); | 389 Map::EnsureDescriptorSlack(map, size); |
390 | 390 |
391 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); | |
392 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); | 391 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); |
393 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); | 392 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); |
394 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); | 393 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); |
395 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 394 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
396 DONT_ENUM | DONT_DELETE | READ_ONLY); | 395 DONT_ENUM | DONT_DELETE | READ_ONLY); |
397 | 396 |
| 397 Handle<AccessorInfo> length = |
| 398 Accessors::FunctionLengthInfo(isolate(), attribs); |
398 { // Add length. | 399 { // Add length. |
399 CallbacksDescriptor d(factory()->length_string(), length, attribs); | 400 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), |
| 401 length, attribs); |
400 map->AppendDescriptor(&d); | 402 map->AppendDescriptor(&d); |
401 } | 403 } |
402 { // Add name. | 404 { // Add name. |
403 CallbacksDescriptor d(factory()->name_string(), name, attribs); | 405 CallbacksDescriptor d(factory()->name_string(), name, attribs); |
404 map->AppendDescriptor(&d); | 406 map->AppendDescriptor(&d); |
405 } | 407 } |
406 { // Add arguments. | 408 { // Add arguments. |
407 CallbacksDescriptor d(factory()->arguments_string(), args, attribs); | 409 CallbacksDescriptor d(factory()->arguments_string(), args, attribs); |
408 map->AppendDescriptor(&d); | 410 map->AppendDescriptor(&d); |
409 } | 411 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 empty_function->set_map(*empty_function_map); | 512 empty_function->set_map(*empty_function_map); |
511 return empty_function; | 513 return empty_function; |
512 } | 514 } |
513 | 515 |
514 | 516 |
515 void Genesis::SetStrictFunctionInstanceDescriptor( | 517 void Genesis::SetStrictFunctionInstanceDescriptor( |
516 Handle<Map> map, PrototypePropertyMode prototypeMode) { | 518 Handle<Map> map, PrototypePropertyMode prototypeMode) { |
517 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; | 519 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; |
518 Map::EnsureDescriptorSlack(map, size); | 520 Map::EnsureDescriptorSlack(map, size); |
519 | 521 |
520 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); | |
521 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); | 522 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); |
522 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 523 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); |
523 Handle<AccessorPair> caller(factory()->NewAccessorPair()); | 524 Handle<AccessorPair> caller(factory()->NewAccessorPair()); |
524 PropertyAttributes rw_attribs = | 525 PropertyAttributes rw_attribs = |
525 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 526 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
526 PropertyAttributes ro_attribs = | 527 PropertyAttributes ro_attribs = |
527 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 528 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
528 | 529 |
| 530 Handle<AccessorInfo> length = |
| 531 Accessors::FunctionLengthInfo(isolate(), ro_attribs); |
529 { // Add length. | 532 { // Add length. |
530 CallbacksDescriptor d(factory()->length_string(), length, ro_attribs); | 533 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), |
| 534 length, ro_attribs); |
531 map->AppendDescriptor(&d); | 535 map->AppendDescriptor(&d); |
532 } | 536 } |
533 { // Add name. | 537 { // Add name. |
534 CallbacksDescriptor d(factory()->name_string(), name, ro_attribs); | 538 CallbacksDescriptor d(factory()->name_string(), name, ro_attribs); |
535 map->AppendDescriptor(&d); | 539 map->AppendDescriptor(&d); |
536 } | 540 } |
537 { // Add arguments. | 541 { // Add arguments. |
538 CallbacksDescriptor d(factory()->arguments_string(), arguments, | 542 CallbacksDescriptor d(factory()->arguments_string(), arguments, |
539 rw_attribs); | 543 rw_attribs); |
540 map->AppendDescriptor(&d); | 544 map->AppendDescriptor(&d); |
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 return from + sizeof(NestingCounterType); | 2683 return from + sizeof(NestingCounterType); |
2680 } | 2684 } |
2681 | 2685 |
2682 | 2686 |
2683 // Called when the top-level V8 mutex is destroyed. | 2687 // Called when the top-level V8 mutex is destroyed. |
2684 void Bootstrapper::FreeThreadResources() { | 2688 void Bootstrapper::FreeThreadResources() { |
2685 ASSERT(!IsActive()); | 2689 ASSERT(!IsActive()); |
2686 } | 2690 } |
2687 | 2691 |
2688 } } // namespace v8::internal | 2692 } } // namespace v8::internal |
OLD | NEW |