| 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> name(factory()->NewForeign(&Accessors::FunctionName)); | |
| 392 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); | 391 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); |
| 393 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); | 392 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); |
| 394 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 393 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
| 395 DONT_ENUM | DONT_DELETE | READ_ONLY); | 394 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 396 | 395 |
| 397 Handle<AccessorInfo> length = | 396 Handle<AccessorInfo> length = |
| 398 Accessors::FunctionLengthInfo(isolate(), attribs); | 397 Accessors::FunctionLengthInfo(isolate(), attribs); |
| 399 { // Add length. | 398 { // Add length. |
| 400 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), | 399 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), |
| 401 length, attribs); | 400 length, attribs); |
| 402 map->AppendDescriptor(&d); | 401 map->AppendDescriptor(&d); |
| 403 } | 402 } |
| 403 Handle<AccessorInfo> name = |
| 404 Accessors::FunctionNameInfo(isolate(), attribs); |
| 404 { // Add name. | 405 { // Add name. |
| 405 CallbacksDescriptor d(factory()->name_string(), name, attribs); | 406 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), |
| 407 name, attribs); |
| 406 map->AppendDescriptor(&d); | 408 map->AppendDescriptor(&d); |
| 407 } | 409 } |
| 408 { // Add arguments. | 410 { // Add arguments. |
| 409 CallbacksDescriptor d(factory()->arguments_string(), args, attribs); | 411 CallbacksDescriptor d(factory()->arguments_string(), args, attribs); |
| 410 map->AppendDescriptor(&d); | 412 map->AppendDescriptor(&d); |
| 411 } | 413 } |
| 412 { // Add caller. | 414 { // Add caller. |
| 413 CallbacksDescriptor d(factory()->caller_string(), caller, attribs); | 415 CallbacksDescriptor d(factory()->caller_string(), caller, attribs); |
| 414 map->AppendDescriptor(&d); | 416 map->AppendDescriptor(&d); |
| 415 } | 417 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 empty_function->set_map(*empty_function_map); | 514 empty_function->set_map(*empty_function_map); |
| 513 return empty_function; | 515 return empty_function; |
| 514 } | 516 } |
| 515 | 517 |
| 516 | 518 |
| 517 void Genesis::SetStrictFunctionInstanceDescriptor( | 519 void Genesis::SetStrictFunctionInstanceDescriptor( |
| 518 Handle<Map> map, PrototypePropertyMode prototypeMode) { | 520 Handle<Map> map, PrototypePropertyMode prototypeMode) { |
| 519 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; | 521 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; |
| 520 Map::EnsureDescriptorSlack(map, size); | 522 Map::EnsureDescriptorSlack(map, size); |
| 521 | 523 |
| 522 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); | |
| 523 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 524 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); |
| 524 Handle<AccessorPair> caller(factory()->NewAccessorPair()); | 525 Handle<AccessorPair> caller(factory()->NewAccessorPair()); |
| 525 PropertyAttributes rw_attribs = | 526 PropertyAttributes rw_attribs = |
| 526 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 527 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
| 527 PropertyAttributes ro_attribs = | 528 PropertyAttributes ro_attribs = |
| 528 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 529 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 529 | 530 |
| 530 Handle<AccessorInfo> length = | 531 Handle<AccessorInfo> length = |
| 531 Accessors::FunctionLengthInfo(isolate(), ro_attribs); | 532 Accessors::FunctionLengthInfo(isolate(), ro_attribs); |
| 532 { // Add length. | 533 { // Add length. |
| 533 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), | 534 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), |
| 534 length, ro_attribs); | 535 length, ro_attribs); |
| 535 map->AppendDescriptor(&d); | 536 map->AppendDescriptor(&d); |
| 536 } | 537 } |
| 538 Handle<AccessorInfo> name = |
| 539 Accessors::FunctionNameInfo(isolate(), ro_attribs); |
| 537 { // Add name. | 540 { // Add name. |
| 538 CallbacksDescriptor d(factory()->name_string(), name, ro_attribs); | 541 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), |
| 542 name, ro_attribs); |
| 539 map->AppendDescriptor(&d); | 543 map->AppendDescriptor(&d); |
| 540 } | 544 } |
| 541 { // Add arguments. | 545 { // Add arguments. |
| 542 CallbacksDescriptor d(factory()->arguments_string(), arguments, | 546 CallbacksDescriptor d(factory()->arguments_string(), arguments, |
| 543 rw_attribs); | 547 rw_attribs); |
| 544 map->AppendDescriptor(&d); | 548 map->AppendDescriptor(&d); |
| 545 } | 549 } |
| 546 { // Add caller. | 550 { // Add caller. |
| 547 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); | 551 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); |
| 548 map->AppendDescriptor(&d); | 552 map->AppendDescriptor(&d); |
| (...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 return from + sizeof(NestingCounterType); | 2687 return from + sizeof(NestingCounterType); |
| 2684 } | 2688 } |
| 2685 | 2689 |
| 2686 | 2690 |
| 2687 // Called when the top-level V8 mutex is destroyed. | 2691 // Called when the top-level V8 mutex is destroyed. |
| 2688 void Bootstrapper::FreeThreadResources() { | 2692 void Bootstrapper::FreeThreadResources() { |
| 2689 ASSERT(!IsActive()); | 2693 ASSERT(!IsActive()); |
| 2690 } | 2694 } |
| 2691 | 2695 |
| 2692 } } // namespace v8::internal | 2696 } } // namespace v8::internal |
| OLD | NEW |