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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); | 392 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); |
393 Handle<Foreign> prototype; | 393 Handle<Foreign> prototype; |
394 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 394 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
395 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 395 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
396 } | 396 } |
397 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 397 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
398 DONT_ENUM | DONT_DELETE | READ_ONLY); | 398 DONT_ENUM | DONT_DELETE | READ_ONLY); |
399 map->set_instance_descriptors(*descriptors); | 399 map->set_instance_descriptors(*descriptors); |
400 | 400 |
401 { // Add length. | 401 { // Add length. |
402 CallbacksDescriptor d(*factory()->length_string(), *length, attribs); | 402 CallbacksDescriptor d(factory()->length_string(), length, attribs); |
403 map->AppendDescriptor(&d, witness); | 403 map->AppendDescriptor(&d, witness); |
404 } | 404 } |
405 { // Add name. | 405 { // Add name. |
406 CallbacksDescriptor d(*factory()->name_string(), *name, attribs); | 406 CallbacksDescriptor d(factory()->name_string(), name, attribs); |
407 map->AppendDescriptor(&d, witness); | 407 map->AppendDescriptor(&d, witness); |
408 } | 408 } |
409 { // Add arguments. | 409 { // Add arguments. |
410 CallbacksDescriptor d(*factory()->arguments_string(), *args, attribs); | 410 CallbacksDescriptor d(factory()->arguments_string(), args, attribs); |
411 map->AppendDescriptor(&d, witness); | 411 map->AppendDescriptor(&d, witness); |
412 } | 412 } |
413 { // Add caller. | 413 { // Add caller. |
414 CallbacksDescriptor d(*factory()->caller_string(), *caller, attribs); | 414 CallbacksDescriptor d(factory()->caller_string(), caller, attribs); |
415 map->AppendDescriptor(&d, witness); | 415 map->AppendDescriptor(&d, witness); |
416 } | 416 } |
417 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 417 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
418 // Add prototype. | 418 // Add prototype. |
419 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { | 419 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { |
420 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); | 420 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); |
421 } | 421 } |
422 CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); | 422 CallbacksDescriptor d(factory()->prototype_string(), prototype, attribs); |
423 map->AppendDescriptor(&d, witness); | 423 map->AppendDescriptor(&d, witness); |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 | 427 |
428 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { | 428 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { |
429 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 429 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
430 SetFunctionInstanceDescriptor(map, prototype_mode); | 430 SetFunctionInstanceDescriptor(map, prototype_mode); |
431 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); | 431 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); |
432 return map; | 432 return map; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 533 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
534 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 534 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
535 } | 535 } |
536 PropertyAttributes rw_attribs = | 536 PropertyAttributes rw_attribs = |
537 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 537 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
538 PropertyAttributes ro_attribs = | 538 PropertyAttributes ro_attribs = |
539 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 539 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
540 map->set_instance_descriptors(*descriptors); | 540 map->set_instance_descriptors(*descriptors); |
541 | 541 |
542 { // Add length. | 542 { // Add length. |
543 CallbacksDescriptor d(*factory()->length_string(), *length, ro_attribs); | 543 CallbacksDescriptor d(factory()->length_string(), length, ro_attribs); |
544 map->AppendDescriptor(&d, witness); | 544 map->AppendDescriptor(&d, witness); |
545 } | 545 } |
546 { // Add name. | 546 { // Add name. |
547 CallbacksDescriptor d(*factory()->name_string(), *name, ro_attribs); | 547 CallbacksDescriptor d(factory()->name_string(), name, ro_attribs); |
548 map->AppendDescriptor(&d, witness); | 548 map->AppendDescriptor(&d, witness); |
549 } | 549 } |
550 { // Add arguments. | 550 { // Add arguments. |
551 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, | 551 CallbacksDescriptor d(factory()->arguments_string(), arguments, |
552 rw_attribs); | 552 rw_attribs); |
553 map->AppendDescriptor(&d, witness); | 553 map->AppendDescriptor(&d, witness); |
554 } | 554 } |
555 { // Add caller. | 555 { // Add caller. |
556 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs); | 556 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); |
557 map->AppendDescriptor(&d, witness); | 557 map->AppendDescriptor(&d, witness); |
558 } | 558 } |
559 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 559 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
560 // Add prototype. | 560 // Add prototype. |
561 PropertyAttributes attribs = | 561 PropertyAttributes attribs = |
562 prototypeMode == ADD_WRITEABLE_PROTOTYPE ? rw_attribs : ro_attribs; | 562 prototypeMode == ADD_WRITEABLE_PROTOTYPE ? rw_attribs : ro_attribs; |
563 CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); | 563 CallbacksDescriptor d(factory()->prototype_string(), prototype, attribs); |
564 map->AppendDescriptor(&d, witness); | 564 map->AppendDescriptor(&d, witness); |
565 } | 565 } |
566 } | 566 } |
567 | 567 |
568 | 568 |
569 // ECMAScript 5th Edition, 13.2.3 | 569 // ECMAScript 5th Edition, 13.2.3 |
570 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { | 570 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { |
571 if (throw_type_error_function.is_null()) { | 571 if (throw_type_error_function.is_null()) { |
572 Handle<String> name = factory()->InternalizeOneByteString( | 572 Handle<String> name = factory()->InternalizeOneByteString( |
573 STATIC_ASCII_VECTOR("ThrowTypeError")); | 573 STATIC_ASCII_VECTOR("ThrowTypeError")); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 Handle<DescriptorArray> array_descriptors( | 865 Handle<DescriptorArray> array_descriptors( |
866 factory->NewDescriptorArray(0, 1)); | 866 factory->NewDescriptorArray(0, 1)); |
867 DescriptorArray::WhitenessWitness witness(*array_descriptors); | 867 DescriptorArray::WhitenessWitness witness(*array_descriptors); |
868 | 868 |
869 Handle<Foreign> array_length(factory->NewForeign(&Accessors::ArrayLength)); | 869 Handle<Foreign> array_length(factory->NewForeign(&Accessors::ArrayLength)); |
870 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 870 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
871 DONT_ENUM | DONT_DELETE); | 871 DONT_ENUM | DONT_DELETE); |
872 initial_map->set_instance_descriptors(*array_descriptors); | 872 initial_map->set_instance_descriptors(*array_descriptors); |
873 | 873 |
874 { // Add length. | 874 { // Add length. |
875 CallbacksDescriptor d(*factory->length_string(), *array_length, attribs); | 875 CallbacksDescriptor d(factory->length_string(), array_length, attribs); |
876 array_function->initial_map()->AppendDescriptor(&d, witness); | 876 array_function->initial_map()->AppendDescriptor(&d, witness); |
877 } | 877 } |
878 | 878 |
879 // array_function is used internally. JS code creating array object should | 879 // array_function is used internally. JS code creating array object should |
880 // search for the 'Array' property on the global object and use that one | 880 // search for the 'Array' property on the global object and use that one |
881 // as the constructor. 'Array' property on a global object can be | 881 // as the constructor. 'Array' property on a global object can be |
882 // overwritten by JS code. | 882 // overwritten by JS code. |
883 native_context()->set_array_function(*array_function); | 883 native_context()->set_array_function(*array_function); |
884 | 884 |
885 // Cache the array maps, needed by ArrayConstructorStub | 885 // Cache the array maps, needed by ArrayConstructorStub |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 factory->NewDescriptorArray(0, 1)); | 920 factory->NewDescriptorArray(0, 1)); |
921 DescriptorArray::WhitenessWitness witness(*string_descriptors); | 921 DescriptorArray::WhitenessWitness witness(*string_descriptors); |
922 | 922 |
923 Handle<Foreign> string_length( | 923 Handle<Foreign> string_length( |
924 factory->NewForeign(&Accessors::StringLength)); | 924 factory->NewForeign(&Accessors::StringLength)); |
925 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 925 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
926 DONT_ENUM | DONT_DELETE | READ_ONLY); | 926 DONT_ENUM | DONT_DELETE | READ_ONLY); |
927 string_map->set_instance_descriptors(*string_descriptors); | 927 string_map->set_instance_descriptors(*string_descriptors); |
928 | 928 |
929 { // Add length. | 929 { // Add length. |
930 CallbacksDescriptor d(*factory->length_string(), *string_length, attribs); | 930 CallbacksDescriptor d(factory->length_string(), string_length, attribs); |
931 string_map->AppendDescriptor(&d, witness); | 931 string_map->AppendDescriptor(&d, witness); |
932 } | 932 } |
933 } | 933 } |
934 | 934 |
935 { // --- D a t e --- | 935 { // --- D a t e --- |
936 // Builtin functions for Date.prototype. | 936 // Builtin functions for Date.prototype. |
937 Handle<JSFunction> date_fun = | 937 Handle<JSFunction> date_fun = |
938 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, | 938 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, |
939 isolate->initial_object_prototype(), | 939 isolate->initial_object_prototype(), |
940 Builtins::kIllegal, true, true); | 940 Builtins::kIllegal, true, true); |
(...skipping 16 matching lines...) Expand all Loading... |
957 ASSERT_EQ(0, initial_map->inobject_properties()); | 957 ASSERT_EQ(0, initial_map->inobject_properties()); |
958 | 958 |
959 PropertyAttributes final = | 959 PropertyAttributes final = |
960 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 960 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
961 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 5); | 961 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 5); |
962 DescriptorArray::WhitenessWitness witness(*descriptors); | 962 DescriptorArray::WhitenessWitness witness(*descriptors); |
963 initial_map->set_instance_descriptors(*descriptors); | 963 initial_map->set_instance_descriptors(*descriptors); |
964 | 964 |
965 { | 965 { |
966 // ECMA-262, section 15.10.7.1. | 966 // ECMA-262, section 15.10.7.1. |
967 FieldDescriptor field(heap->source_string(), | 967 FieldDescriptor field(factory->source_string(), |
968 JSRegExp::kSourceFieldIndex, | 968 JSRegExp::kSourceFieldIndex, |
969 final, | 969 final, |
970 Representation::Tagged()); | 970 Representation::Tagged()); |
971 initial_map->AppendDescriptor(&field, witness); | 971 initial_map->AppendDescriptor(&field, witness); |
972 } | 972 } |
973 { | 973 { |
974 // ECMA-262, section 15.10.7.2. | 974 // ECMA-262, section 15.10.7.2. |
975 FieldDescriptor field(heap->global_string(), | 975 FieldDescriptor field(factory->global_string(), |
976 JSRegExp::kGlobalFieldIndex, | 976 JSRegExp::kGlobalFieldIndex, |
977 final, | 977 final, |
978 Representation::Tagged()); | 978 Representation::Tagged()); |
979 initial_map->AppendDescriptor(&field, witness); | 979 initial_map->AppendDescriptor(&field, witness); |
980 } | 980 } |
981 { | 981 { |
982 // ECMA-262, section 15.10.7.3. | 982 // ECMA-262, section 15.10.7.3. |
983 FieldDescriptor field(heap->ignore_case_string(), | 983 FieldDescriptor field(factory->ignore_case_string(), |
984 JSRegExp::kIgnoreCaseFieldIndex, | 984 JSRegExp::kIgnoreCaseFieldIndex, |
985 final, | 985 final, |
986 Representation::Tagged()); | 986 Representation::Tagged()); |
987 initial_map->AppendDescriptor(&field, witness); | 987 initial_map->AppendDescriptor(&field, witness); |
988 } | 988 } |
989 { | 989 { |
990 // ECMA-262, section 15.10.7.4. | 990 // ECMA-262, section 15.10.7.4. |
991 FieldDescriptor field(heap->multiline_string(), | 991 FieldDescriptor field(factory->multiline_string(), |
992 JSRegExp::kMultilineFieldIndex, | 992 JSRegExp::kMultilineFieldIndex, |
993 final, | 993 final, |
994 Representation::Tagged()); | 994 Representation::Tagged()); |
995 initial_map->AppendDescriptor(&field, witness); | 995 initial_map->AppendDescriptor(&field, witness); |
996 } | 996 } |
997 { | 997 { |
998 // ECMA-262, section 15.10.7.5. | 998 // ECMA-262, section 15.10.7.5. |
999 PropertyAttributes writable = | 999 PropertyAttributes writable = |
1000 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 1000 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
1001 FieldDescriptor field(heap->last_index_string(), | 1001 FieldDescriptor field(factory->last_index_string(), |
1002 JSRegExp::kLastIndexFieldIndex, | 1002 JSRegExp::kLastIndexFieldIndex, |
1003 writable, | 1003 writable, |
1004 Representation::Tagged()); | 1004 Representation::Tagged()); |
1005 initial_map->AppendDescriptor(&field, witness); | 1005 initial_map->AppendDescriptor(&field, witness); |
1006 } | 1006 } |
1007 | 1007 |
1008 initial_map->set_inobject_properties(5); | 1008 initial_map->set_inobject_properties(5); |
1009 initial_map->set_pre_allocated_property_fields(5); | 1009 initial_map->set_pre_allocated_property_fields(5); |
1010 initial_map->set_unused_property_fields(0); | 1010 initial_map->set_unused_property_fields(0); |
1011 initial_map->set_instance_size( | 1011 initial_map->set_instance_size( |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 // Create the map. Allocate one in-object field for length. | 1174 // Create the map. Allocate one in-object field for length. |
1175 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, | 1175 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, |
1176 Heap::kStrictArgumentsObjectSize); | 1176 Heap::kStrictArgumentsObjectSize); |
1177 // Create the descriptor array for the arguments object. | 1177 // Create the descriptor array for the arguments object. |
1178 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 3); | 1178 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 3); |
1179 DescriptorArray::WhitenessWitness witness(*descriptors); | 1179 DescriptorArray::WhitenessWitness witness(*descriptors); |
1180 map->set_instance_descriptors(*descriptors); | 1180 map->set_instance_descriptors(*descriptors); |
1181 | 1181 |
1182 { // length | 1182 { // length |
1183 FieldDescriptor d( | 1183 FieldDescriptor d( |
1184 *factory->length_string(), 0, DONT_ENUM, Representation::Tagged()); | 1184 factory->length_string(), 0, DONT_ENUM, Representation::Tagged()); |
1185 map->AppendDescriptor(&d, witness); | 1185 map->AppendDescriptor(&d, witness); |
1186 } | 1186 } |
1187 { // callee | 1187 { // callee |
1188 CallbacksDescriptor d(*factory->callee_string(), | 1188 CallbacksDescriptor d(factory->callee_string(), |
1189 *callee, | 1189 callee, |
1190 attributes); | 1190 attributes); |
1191 map->AppendDescriptor(&d, witness); | 1191 map->AppendDescriptor(&d, witness); |
1192 } | 1192 } |
1193 { // caller | 1193 { // caller |
1194 CallbacksDescriptor d(*factory->caller_string(), | 1194 CallbacksDescriptor d(factory->caller_string(), |
1195 *caller, | 1195 caller, |
1196 attributes); | 1196 attributes); |
1197 map->AppendDescriptor(&d, witness); | 1197 map->AppendDescriptor(&d, witness); |
1198 } | 1198 } |
1199 | 1199 |
1200 map->set_function_with_prototype(true); | 1200 map->set_function_with_prototype(true); |
1201 map->set_prototype(native_context()->object_function()->prototype()); | 1201 map->set_prototype(native_context()->object_function()->prototype()); |
1202 map->set_pre_allocated_property_fields(1); | 1202 map->set_pre_allocated_property_fields(1); |
1203 map->set_inobject_properties(1); | 1203 map->set_inobject_properties(1); |
1204 | 1204 |
1205 // Copy constructor from the sloppy arguments boilerplate. | 1205 // Copy constructor from the sloppy arguments boilerplate. |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 ASSERT(generator_result_map->inobject_properties() == | 1381 ASSERT(generator_result_map->inobject_properties() == |
1382 JSGeneratorObject::kResultPropertyCount); | 1382 JSGeneratorObject::kResultPropertyCount); |
1383 | 1383 |
1384 Handle<DescriptorArray> descriptors = factory()->NewDescriptorArray(0, | 1384 Handle<DescriptorArray> descriptors = factory()->NewDescriptorArray(0, |
1385 JSGeneratorObject::kResultPropertyCount); | 1385 JSGeneratorObject::kResultPropertyCount); |
1386 DescriptorArray::WhitenessWitness witness(*descriptors); | 1386 DescriptorArray::WhitenessWitness witness(*descriptors); |
1387 generator_result_map->set_instance_descriptors(*descriptors); | 1387 generator_result_map->set_instance_descriptors(*descriptors); |
1388 | 1388 |
1389 Handle<String> value_string = factory()->InternalizeOneByteString( | 1389 Handle<String> value_string = factory()->InternalizeOneByteString( |
1390 STATIC_ASCII_VECTOR("value")); | 1390 STATIC_ASCII_VECTOR("value")); |
1391 FieldDescriptor value_descr(*value_string, | 1391 FieldDescriptor value_descr(value_string, |
1392 JSGeneratorObject::kResultValuePropertyIndex, | 1392 JSGeneratorObject::kResultValuePropertyIndex, |
1393 NONE, | 1393 NONE, |
1394 Representation::Tagged()); | 1394 Representation::Tagged()); |
1395 generator_result_map->AppendDescriptor(&value_descr, witness); | 1395 generator_result_map->AppendDescriptor(&value_descr, witness); |
1396 | 1396 |
1397 Handle<String> done_string = factory()->InternalizeOneByteString( | 1397 Handle<String> done_string = factory()->InternalizeOneByteString( |
1398 STATIC_ASCII_VECTOR("done")); | 1398 STATIC_ASCII_VECTOR("done")); |
1399 FieldDescriptor done_descr(*done_string, | 1399 FieldDescriptor done_descr(done_string, |
1400 JSGeneratorObject::kResultDonePropertyIndex, | 1400 JSGeneratorObject::kResultDonePropertyIndex, |
1401 NONE, | 1401 NONE, |
1402 Representation::Tagged()); | 1402 Representation::Tagged()); |
1403 generator_result_map->AppendDescriptor(&done_descr, witness); | 1403 generator_result_map->AppendDescriptor(&done_descr, witness); |
1404 | 1404 |
1405 generator_result_map->set_unused_property_fields(0); | 1405 generator_result_map->set_unused_property_fields(0); |
1406 ASSERT_EQ(JSGeneratorObject::kResultSize, | 1406 ASSERT_EQ(JSGeneratorObject::kResultSize, |
1407 generator_result_map->instance_size()); | 1407 generator_result_map->instance_size()); |
1408 native_context()->set_generator_result_map(*generator_result_map); | 1408 native_context()->set_generator_result_map(*generator_result_map); |
1409 } | 1409 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 DescriptorArray::WhitenessWitness witness(*array_descriptors); | 1613 DescriptorArray::WhitenessWitness witness(*array_descriptors); |
1614 | 1614 |
1615 Handle<Foreign> array_length(factory()->NewForeign( | 1615 Handle<Foreign> array_length(factory()->NewForeign( |
1616 &Accessors::ArrayLength)); | 1616 &Accessors::ArrayLength)); |
1617 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 1617 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
1618 DONT_ENUM | DONT_DELETE); | 1618 DONT_ENUM | DONT_DELETE); |
1619 initial_map->set_instance_descriptors(*array_descriptors); | 1619 initial_map->set_instance_descriptors(*array_descriptors); |
1620 | 1620 |
1621 { // Add length. | 1621 { // Add length. |
1622 CallbacksDescriptor d( | 1622 CallbacksDescriptor d( |
1623 *factory()->length_string(), *array_length, attribs); | 1623 factory()->length_string(), array_length, attribs); |
1624 array_function->initial_map()->AppendDescriptor(&d, witness); | 1624 array_function->initial_map()->AppendDescriptor(&d, witness); |
1625 } | 1625 } |
1626 | 1626 |
1627 return array_function; | 1627 return array_function; |
1628 } | 1628 } |
1629 | 1629 |
1630 | 1630 |
1631 bool Genesis::InstallNatives() { | 1631 bool Genesis::InstallNatives() { |
1632 HandleScope scope(isolate()); | 1632 HandleScope scope(isolate()); |
1633 | 1633 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 factory()->InternalizeOneByteString( | 1754 factory()->InternalizeOneByteString( |
1755 STATIC_ASCII_VECTOR("eval_from_function_name"))); | 1755 STATIC_ASCII_VECTOR("eval_from_function_name"))); |
1756 Handle<Foreign> script_eval_from_function_name( | 1756 Handle<Foreign> script_eval_from_function_name( |
1757 factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName)); | 1757 factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName)); |
1758 PropertyAttributes attribs = | 1758 PropertyAttributes attribs = |
1759 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 1759 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
1760 script_map->set_instance_descriptors(*script_descriptors); | 1760 script_map->set_instance_descriptors(*script_descriptors); |
1761 | 1761 |
1762 { | 1762 { |
1763 CallbacksDescriptor d( | 1763 CallbacksDescriptor d( |
1764 *factory()->source_string(), *script_source, attribs); | 1764 factory()->source_string(), script_source, attribs); |
1765 script_map->AppendDescriptor(&d, witness); | 1765 script_map->AppendDescriptor(&d, witness); |
1766 } | 1766 } |
1767 | 1767 |
1768 { | 1768 { |
1769 CallbacksDescriptor d(*factory()->name_string(), *script_name, attribs); | 1769 CallbacksDescriptor d(factory()->name_string(), script_name, attribs); |
1770 script_map->AppendDescriptor(&d, witness); | 1770 script_map->AppendDescriptor(&d, witness); |
1771 } | 1771 } |
1772 | 1772 |
1773 { | 1773 { |
1774 CallbacksDescriptor d(*id_string, *script_id, attribs); | 1774 CallbacksDescriptor d(id_string, script_id, attribs); |
1775 script_map->AppendDescriptor(&d, witness); | 1775 script_map->AppendDescriptor(&d, witness); |
1776 } | 1776 } |
1777 | 1777 |
1778 { | 1778 { |
1779 CallbacksDescriptor d(*line_offset_string, *script_line_offset, attribs); | 1779 CallbacksDescriptor d(line_offset_string, script_line_offset, attribs); |
1780 script_map->AppendDescriptor(&d, witness); | 1780 script_map->AppendDescriptor(&d, witness); |
1781 } | 1781 } |
1782 | 1782 |
1783 { | 1783 { |
1784 CallbacksDescriptor d( | 1784 CallbacksDescriptor d( |
1785 *column_offset_string, *script_column_offset, attribs); | 1785 column_offset_string, script_column_offset, attribs); |
1786 script_map->AppendDescriptor(&d, witness); | 1786 script_map->AppendDescriptor(&d, witness); |
1787 } | 1787 } |
1788 | 1788 |
1789 { | 1789 { |
1790 CallbacksDescriptor d(*type_string, *script_type, attribs); | 1790 CallbacksDescriptor d(type_string, script_type, attribs); |
1791 script_map->AppendDescriptor(&d, witness); | 1791 script_map->AppendDescriptor(&d, witness); |
1792 } | 1792 } |
1793 | 1793 |
1794 { | 1794 { |
1795 CallbacksDescriptor d( | 1795 CallbacksDescriptor d( |
1796 *compilation_type_string, *script_compilation_type, attribs); | 1796 compilation_type_string, script_compilation_type, attribs); |
1797 script_map->AppendDescriptor(&d, witness); | 1797 script_map->AppendDescriptor(&d, witness); |
1798 } | 1798 } |
1799 | 1799 |
1800 { | 1800 { |
1801 CallbacksDescriptor d(*line_ends_string, *script_line_ends, attribs); | 1801 CallbacksDescriptor d(line_ends_string, script_line_ends, attribs); |
1802 script_map->AppendDescriptor(&d, witness); | 1802 script_map->AppendDescriptor(&d, witness); |
1803 } | 1803 } |
1804 | 1804 |
1805 { | 1805 { |
1806 CallbacksDescriptor d( | 1806 CallbacksDescriptor d( |
1807 *context_data_string, *script_context_data, attribs); | 1807 context_data_string, script_context_data, attribs); |
1808 script_map->AppendDescriptor(&d, witness); | 1808 script_map->AppendDescriptor(&d, witness); |
1809 } | 1809 } |
1810 | 1810 |
1811 { | 1811 { |
1812 CallbacksDescriptor d( | 1812 CallbacksDescriptor d( |
1813 *eval_from_script_string, *script_eval_from_script, attribs); | 1813 eval_from_script_string, script_eval_from_script, attribs); |
1814 script_map->AppendDescriptor(&d, witness); | 1814 script_map->AppendDescriptor(&d, witness); |
1815 } | 1815 } |
1816 | 1816 |
1817 { | 1817 { |
1818 CallbacksDescriptor d( | 1818 CallbacksDescriptor d( |
1819 *eval_from_script_position_string, | 1819 eval_from_script_position_string, |
1820 *script_eval_from_script_position, | 1820 script_eval_from_script_position, |
1821 attribs); | 1821 attribs); |
1822 script_map->AppendDescriptor(&d, witness); | 1822 script_map->AppendDescriptor(&d, witness); |
1823 } | 1823 } |
1824 | 1824 |
1825 { | 1825 { |
1826 CallbacksDescriptor d( | 1826 CallbacksDescriptor d( |
1827 *eval_from_function_name_string, | 1827 eval_from_function_name_string, |
1828 *script_eval_from_function_name, | 1828 script_eval_from_function_name, |
1829 attribs); | 1829 attribs); |
1830 script_map->AppendDescriptor(&d, witness); | 1830 script_map->AppendDescriptor(&d, witness); |
1831 } | 1831 } |
1832 | 1832 |
1833 // Allocate the empty script. | 1833 // Allocate the empty script. |
1834 Handle<Script> script = factory()->NewScript(factory()->empty_string()); | 1834 Handle<Script> script = factory()->NewScript(factory()->empty_string()); |
1835 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 1835 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
1836 heap()->public_set_empty_script(*script); | 1836 heap()->public_set_empty_script(*script); |
1837 } | 1837 } |
1838 { | 1838 { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 // Update map with length accessor from Array and add "index" and "input". | 1949 // Update map with length accessor from Array and add "index" and "input". |
1950 Handle<DescriptorArray> reresult_descriptors = | 1950 Handle<DescriptorArray> reresult_descriptors = |
1951 factory()->NewDescriptorArray(0, 3); | 1951 factory()->NewDescriptorArray(0, 3); |
1952 DescriptorArray::WhitenessWitness witness(*reresult_descriptors); | 1952 DescriptorArray::WhitenessWitness witness(*reresult_descriptors); |
1953 initial_map->set_instance_descriptors(*reresult_descriptors); | 1953 initial_map->set_instance_descriptors(*reresult_descriptors); |
1954 | 1954 |
1955 { | 1955 { |
1956 JSFunction* array_function = native_context()->array_function(); | 1956 JSFunction* array_function = native_context()->array_function(); |
1957 Handle<DescriptorArray> array_descriptors( | 1957 Handle<DescriptorArray> array_descriptors( |
1958 array_function->initial_map()->instance_descriptors()); | 1958 array_function->initial_map()->instance_descriptors()); |
1959 String* length = heap()->length_string(); | 1959 Handle<String> length = factory()->length_string(); |
1960 int old = array_descriptors->SearchWithCache( | 1960 int old = array_descriptors->SearchWithCache( |
1961 length, array_function->initial_map()); | 1961 *length, array_function->initial_map()); |
1962 ASSERT(old != DescriptorArray::kNotFound); | 1962 ASSERT(old != DescriptorArray::kNotFound); |
1963 CallbacksDescriptor desc(length, | 1963 CallbacksDescriptor desc(length, |
1964 array_descriptors->GetValue(old), | 1964 handle(array_descriptors->GetValue(old), |
| 1965 isolate()), |
1965 array_descriptors->GetDetails(old).attributes()); | 1966 array_descriptors->GetDetails(old).attributes()); |
1966 initial_map->AppendDescriptor(&desc, witness); | 1967 initial_map->AppendDescriptor(&desc, witness); |
1967 } | 1968 } |
1968 { | 1969 { |
1969 FieldDescriptor index_field(heap()->index_string(), | 1970 FieldDescriptor index_field(factory()->index_string(), |
1970 JSRegExpResult::kIndexIndex, | 1971 JSRegExpResult::kIndexIndex, |
1971 NONE, | 1972 NONE, |
1972 Representation::Tagged()); | 1973 Representation::Tagged()); |
1973 initial_map->AppendDescriptor(&index_field, witness); | 1974 initial_map->AppendDescriptor(&index_field, witness); |
1974 } | 1975 } |
1975 | 1976 |
1976 { | 1977 { |
1977 FieldDescriptor input_field(heap()->input_string(), | 1978 FieldDescriptor input_field(factory()->input_string(), |
1978 JSRegExpResult::kInputIndex, | 1979 JSRegExpResult::kInputIndex, |
1979 NONE, | 1980 NONE, |
1980 Representation::Tagged()); | 1981 Representation::Tagged()); |
1981 initial_map->AppendDescriptor(&input_field, witness); | 1982 initial_map->AppendDescriptor(&input_field, witness); |
1982 } | 1983 } |
1983 | 1984 |
1984 initial_map->set_inobject_properties(2); | 1985 initial_map->set_inobject_properties(2); |
1985 initial_map->set_pre_allocated_property_fields(2); | 1986 initial_map->set_pre_allocated_property_fields(2); |
1986 initial_map->set_unused_property_fields(0); | 1987 initial_map->set_unused_property_fields(0); |
1987 | 1988 |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 return from + sizeof(NestingCounterType); | 2718 return from + sizeof(NestingCounterType); |
2718 } | 2719 } |
2719 | 2720 |
2720 | 2721 |
2721 // Called when the top-level V8 mutex is destroyed. | 2722 // Called when the top-level V8 mutex is destroyed. |
2722 void Bootstrapper::FreeThreadResources() { | 2723 void Bootstrapper::FreeThreadResources() { |
2723 ASSERT(!IsActive()); | 2724 ASSERT(!IsActive()); |
2724 } | 2725 } |
2725 | 2726 |
2726 } } // namespace v8::internal | 2727 } } // namespace v8::internal |
OLD | NEW |