| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 function->shared()->set_instance_class_name(*internalized_name); | 376 function->shared()->set_instance_class_name(*internalized_name); |
| 377 } | 377 } |
| 378 function->shared()->set_native(true); | 378 function->shared()->set_native(true); |
| 379 return function; | 379 return function; |
| 380 } | 380 } |
| 381 | 381 |
| 382 | 382 |
| 383 void Genesis::SetFunctionInstanceDescriptor( | 383 void Genesis::SetFunctionInstanceDescriptor( |
| 384 Handle<Map> map, PrototypePropertyMode prototypeMode) { | 384 Handle<Map> map, PrototypePropertyMode prototypeMode) { |
| 385 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; | 385 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; |
| 386 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(0, size)); | 386 Map::EnsureDescriptorSlack(map, size); |
| 387 DescriptorArray::WhitenessWitness witness(*descriptors); | |
| 388 | 387 |
| 389 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); | 388 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); |
| 390 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); | 389 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); |
| 391 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); | 390 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); |
| 392 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); | 391 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); |
| 393 Handle<Foreign> prototype; | 392 Handle<Foreign> prototype; |
| 394 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 393 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
| 395 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 394 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
| 396 } | 395 } |
| 397 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 396 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
| 398 DONT_ENUM | DONT_DELETE | READ_ONLY); | 397 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 399 map->set_instance_descriptors(*descriptors); | |
| 400 | 398 |
| 401 { // Add length. | 399 { // Add length. |
| 402 CallbacksDescriptor d(factory()->length_string(), length, attribs); | 400 CallbacksDescriptor d(factory()->length_string(), length, attribs); |
| 403 map->AppendDescriptor(&d, witness); | 401 map->AppendDescriptor(&d); |
| 404 } | 402 } |
| 405 { // Add name. | 403 { // Add name. |
| 406 CallbacksDescriptor d(factory()->name_string(), name, attribs); | 404 CallbacksDescriptor d(factory()->name_string(), name, attribs); |
| 407 map->AppendDescriptor(&d, witness); | 405 map->AppendDescriptor(&d); |
| 408 } | 406 } |
| 409 { // Add arguments. | 407 { // Add arguments. |
| 410 CallbacksDescriptor d(factory()->arguments_string(), args, attribs); | 408 CallbacksDescriptor d(factory()->arguments_string(), args, attribs); |
| 411 map->AppendDescriptor(&d, witness); | 409 map->AppendDescriptor(&d); |
| 412 } | 410 } |
| 413 { // Add caller. | 411 { // Add caller. |
| 414 CallbacksDescriptor d(factory()->caller_string(), caller, attribs); | 412 CallbacksDescriptor d(factory()->caller_string(), caller, attribs); |
| 415 map->AppendDescriptor(&d, witness); | 413 map->AppendDescriptor(&d); |
| 416 } | 414 } |
| 417 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 415 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
| 418 // Add prototype. | 416 // Add prototype. |
| 419 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { | 417 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { |
| 420 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); | 418 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); |
| 421 } | 419 } |
| 422 CallbacksDescriptor d(factory()->prototype_string(), prototype, attribs); | 420 CallbacksDescriptor d(factory()->prototype_string(), prototype, attribs); |
| 423 map->AppendDescriptor(&d, witness); | 421 map->AppendDescriptor(&d); |
| 424 } | 422 } |
| 425 } | 423 } |
| 426 | 424 |
| 427 | 425 |
| 428 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { | 426 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { |
| 429 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 427 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
| 430 SetFunctionInstanceDescriptor(map, prototype_mode); | 428 SetFunctionInstanceDescriptor(map, prototype_mode); |
| 431 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); | 429 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); |
| 432 return map; | 430 return map; |
| 433 } | 431 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 empty_function_map->set_prototype( | 513 empty_function_map->set_prototype( |
| 516 native_context()->object_function()->prototype()); | 514 native_context()->object_function()->prototype()); |
| 517 empty_function->set_map(*empty_function_map); | 515 empty_function->set_map(*empty_function_map); |
| 518 return empty_function; | 516 return empty_function; |
| 519 } | 517 } |
| 520 | 518 |
| 521 | 519 |
| 522 void Genesis::SetStrictFunctionInstanceDescriptor( | 520 void Genesis::SetStrictFunctionInstanceDescriptor( |
| 523 Handle<Map> map, PrototypePropertyMode prototypeMode) { | 521 Handle<Map> map, PrototypePropertyMode prototypeMode) { |
| 524 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; | 522 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; |
| 525 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(0, size)); | 523 Map::EnsureDescriptorSlack(map, size); |
| 526 DescriptorArray::WhitenessWitness witness(*descriptors); | |
| 527 | 524 |
| 528 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); | 525 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); |
| 529 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); | 526 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); |
| 530 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 527 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); |
| 531 Handle<AccessorPair> caller(factory()->NewAccessorPair()); | 528 Handle<AccessorPair> caller(factory()->NewAccessorPair()); |
| 532 Handle<Foreign> prototype; | 529 Handle<Foreign> prototype; |
| 533 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 530 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
| 534 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); | 531 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); |
| 535 } | 532 } |
| 536 PropertyAttributes rw_attribs = | 533 PropertyAttributes rw_attribs = |
| 537 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 534 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
| 538 PropertyAttributes ro_attribs = | 535 PropertyAttributes ro_attribs = |
| 539 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 536 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 540 map->set_instance_descriptors(*descriptors); | |
| 541 | 537 |
| 542 { // Add length. | 538 { // Add length. |
| 543 CallbacksDescriptor d(factory()->length_string(), length, ro_attribs); | 539 CallbacksDescriptor d(factory()->length_string(), length, ro_attribs); |
| 544 map->AppendDescriptor(&d, witness); | 540 map->AppendDescriptor(&d); |
| 545 } | 541 } |
| 546 { // Add name. | 542 { // Add name. |
| 547 CallbacksDescriptor d(factory()->name_string(), name, ro_attribs); | 543 CallbacksDescriptor d(factory()->name_string(), name, ro_attribs); |
| 548 map->AppendDescriptor(&d, witness); | 544 map->AppendDescriptor(&d); |
| 549 } | 545 } |
| 550 { // Add arguments. | 546 { // Add arguments. |
| 551 CallbacksDescriptor d(factory()->arguments_string(), arguments, | 547 CallbacksDescriptor d(factory()->arguments_string(), arguments, |
| 552 rw_attribs); | 548 rw_attribs); |
| 553 map->AppendDescriptor(&d, witness); | 549 map->AppendDescriptor(&d); |
| 554 } | 550 } |
| 555 { // Add caller. | 551 { // Add caller. |
| 556 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); | 552 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); |
| 557 map->AppendDescriptor(&d, witness); | 553 map->AppendDescriptor(&d); |
| 558 } | 554 } |
| 559 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 555 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
| 560 // Add prototype. | 556 // Add prototype. |
| 561 PropertyAttributes attribs = | 557 PropertyAttributes attribs = |
| 562 prototypeMode == ADD_WRITEABLE_PROTOTYPE ? rw_attribs : ro_attribs; | 558 prototypeMode == ADD_WRITEABLE_PROTOTYPE ? rw_attribs : ro_attribs; |
| 563 CallbacksDescriptor d(factory()->prototype_string(), prototype, attribs); | 559 CallbacksDescriptor d(factory()->prototype_string(), prototype, attribs); |
| 564 map->AppendDescriptor(&d, witness); | 560 map->AppendDescriptor(&d); |
| 565 } | 561 } |
| 566 } | 562 } |
| 567 | 563 |
| 568 | 564 |
| 569 // ECMAScript 5th Edition, 13.2.3 | 565 // ECMAScript 5th Edition, 13.2.3 |
| 570 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { | 566 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { |
| 571 if (throw_type_error_function.is_null()) { | 567 if (throw_type_error_function.is_null()) { |
| 572 Handle<String> name = factory()->InternalizeOneByteString( | 568 Handle<String> name = factory()->InternalizeOneByteString( |
| 573 STATIC_ASCII_VECTOR("ThrowTypeError")); | 569 STATIC_ASCII_VECTOR("ThrowTypeError")); |
| 574 throw_type_error_function = | 570 throw_type_error_function = |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 | 850 |
| 855 // This seems a bit hackish, but we need to make sure Array.length | 851 // This seems a bit hackish, but we need to make sure Array.length |
| 856 // is 1. | 852 // is 1. |
| 857 array_function->shared()->set_length(1); | 853 array_function->shared()->set_length(1); |
| 858 | 854 |
| 859 Handle<Map> initial_map(array_function->initial_map()); | 855 Handle<Map> initial_map(array_function->initial_map()); |
| 860 | 856 |
| 861 // This assert protects an optimization in | 857 // This assert protects an optimization in |
| 862 // HGraphBuilder::JSArrayBuilder::EmitMapCode() | 858 // HGraphBuilder::JSArrayBuilder::EmitMapCode() |
| 863 ASSERT(initial_map->elements_kind() == GetInitialFastElementsKind()); | 859 ASSERT(initial_map->elements_kind() == GetInitialFastElementsKind()); |
| 864 | 860 Map::EnsureDescriptorSlack(initial_map, 1); |
| 865 Handle<DescriptorArray> array_descriptors( | |
| 866 factory->NewDescriptorArray(0, 1)); | |
| 867 DescriptorArray::WhitenessWitness witness(*array_descriptors); | |
| 868 | 861 |
| 869 Handle<Foreign> array_length(factory->NewForeign(&Accessors::ArrayLength)); | 862 Handle<Foreign> array_length(factory->NewForeign(&Accessors::ArrayLength)); |
| 870 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 863 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
| 871 DONT_ENUM | DONT_DELETE); | 864 DONT_ENUM | DONT_DELETE); |
| 872 initial_map->set_instance_descriptors(*array_descriptors); | |
| 873 | 865 |
| 874 { // Add length. | 866 { // Add length. |
| 875 CallbacksDescriptor d(factory->length_string(), array_length, attribs); | 867 CallbacksDescriptor d(factory->length_string(), array_length, attribs); |
| 876 array_function->initial_map()->AppendDescriptor(&d, witness); | 868 array_function->initial_map()->AppendDescriptor(&d); |
| 877 } | 869 } |
| 878 | 870 |
| 879 // array_function is used internally. JS code creating array object should | 871 // 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 | 872 // 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 | 873 // as the constructor. 'Array' property on a global object can be |
| 882 // overwritten by JS code. | 874 // overwritten by JS code. |
| 883 native_context()->set_array_function(*array_function); | 875 native_context()->set_array_function(*array_function); |
| 884 | 876 |
| 885 // Cache the array maps, needed by ArrayConstructorStub | 877 // Cache the array maps, needed by ArrayConstructorStub |
| 886 CacheInitialJSArrayMaps(native_context(), initial_map); | 878 CacheInitialJSArrayMaps(native_context(), initial_map); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 909 Handle<JSFunction> string_fun = | 901 Handle<JSFunction> string_fun = |
| 910 InstallFunction(global, "String", JS_VALUE_TYPE, JSValue::kSize, | 902 InstallFunction(global, "String", JS_VALUE_TYPE, JSValue::kSize, |
| 911 isolate->initial_object_prototype(), | 903 isolate->initial_object_prototype(), |
| 912 Builtins::kIllegal, true, true); | 904 Builtins::kIllegal, true, true); |
| 913 string_fun->shared()->set_construct_stub( | 905 string_fun->shared()->set_construct_stub( |
| 914 isolate->builtins()->builtin(Builtins::kStringConstructCode)); | 906 isolate->builtins()->builtin(Builtins::kStringConstructCode)); |
| 915 native_context()->set_string_function(*string_fun); | 907 native_context()->set_string_function(*string_fun); |
| 916 | 908 |
| 917 Handle<Map> string_map = | 909 Handle<Map> string_map = |
| 918 Handle<Map>(native_context()->string_function()->initial_map()); | 910 Handle<Map>(native_context()->string_function()->initial_map()); |
| 919 Handle<DescriptorArray> string_descriptors( | 911 Map::EnsureDescriptorSlack(string_map, 1); |
| 920 factory->NewDescriptorArray(0, 1)); | |
| 921 DescriptorArray::WhitenessWitness witness(*string_descriptors); | |
| 922 | 912 |
| 923 Handle<Foreign> string_length( | 913 Handle<Foreign> string_length( |
| 924 factory->NewForeign(&Accessors::StringLength)); | 914 factory->NewForeign(&Accessors::StringLength)); |
| 925 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 915 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
| 926 DONT_ENUM | DONT_DELETE | READ_ONLY); | 916 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 927 string_map->set_instance_descriptors(*string_descriptors); | |
| 928 | 917 |
| 929 { // Add length. | 918 { // Add length. |
| 930 CallbacksDescriptor d(factory->length_string(), string_length, attribs); | 919 CallbacksDescriptor d(factory->length_string(), string_length, attribs); |
| 931 string_map->AppendDescriptor(&d, witness); | 920 string_map->AppendDescriptor(&d); |
| 932 } | 921 } |
| 933 } | 922 } |
| 934 | 923 |
| 935 { // --- D a t e --- | 924 { // --- D a t e --- |
| 936 // Builtin functions for Date.prototype. | 925 // Builtin functions for Date.prototype. |
| 937 Handle<JSFunction> date_fun = | 926 Handle<JSFunction> date_fun = |
| 938 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, | 927 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, |
| 939 isolate->initial_object_prototype(), | 928 isolate->initial_object_prototype(), |
| 940 Builtins::kIllegal, true, true); | 929 Builtins::kIllegal, true, true); |
| 941 | 930 |
| 942 native_context()->set_date_function(*date_fun); | 931 native_context()->set_date_function(*date_fun); |
| 943 } | 932 } |
| 944 | 933 |
| 945 | 934 |
| 946 { // -- R e g E x p | 935 { // -- R e g E x p |
| 947 // Builtin functions for RegExp.prototype. | 936 // Builtin functions for RegExp.prototype. |
| 948 Handle<JSFunction> regexp_fun = | 937 Handle<JSFunction> regexp_fun = |
| 949 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, | 938 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, |
| 950 isolate->initial_object_prototype(), | 939 isolate->initial_object_prototype(), |
| 951 Builtins::kIllegal, true, true); | 940 Builtins::kIllegal, true, true); |
| 952 native_context()->set_regexp_function(*regexp_fun); | 941 native_context()->set_regexp_function(*regexp_fun); |
| 953 | 942 |
| 954 ASSERT(regexp_fun->has_initial_map()); | 943 ASSERT(regexp_fun->has_initial_map()); |
| 955 Handle<Map> initial_map(regexp_fun->initial_map()); | 944 Handle<Map> initial_map(regexp_fun->initial_map()); |
| 956 | 945 |
| 957 ASSERT_EQ(0, initial_map->inobject_properties()); | 946 ASSERT_EQ(0, initial_map->inobject_properties()); |
| 958 | 947 |
| 959 PropertyAttributes final = | 948 PropertyAttributes final = |
| 960 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 949 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 961 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 5); | 950 Map::EnsureDescriptorSlack(initial_map, 5); |
| 962 DescriptorArray::WhitenessWitness witness(*descriptors); | |
| 963 initial_map->set_instance_descriptors(*descriptors); | |
| 964 | 951 |
| 965 { | 952 { |
| 966 // ECMA-262, section 15.10.7.1. | 953 // ECMA-262, section 15.10.7.1. |
| 967 FieldDescriptor field(factory->source_string(), | 954 FieldDescriptor field(factory->source_string(), |
| 968 JSRegExp::kSourceFieldIndex, | 955 JSRegExp::kSourceFieldIndex, |
| 969 final, | 956 final, |
| 970 Representation::Tagged()); | 957 Representation::Tagged()); |
| 971 initial_map->AppendDescriptor(&field, witness); | 958 initial_map->AppendDescriptor(&field); |
| 972 } | 959 } |
| 973 { | 960 { |
| 974 // ECMA-262, section 15.10.7.2. | 961 // ECMA-262, section 15.10.7.2. |
| 975 FieldDescriptor field(factory->global_string(), | 962 FieldDescriptor field(factory->global_string(), |
| 976 JSRegExp::kGlobalFieldIndex, | 963 JSRegExp::kGlobalFieldIndex, |
| 977 final, | 964 final, |
| 978 Representation::Tagged()); | 965 Representation::Tagged()); |
| 979 initial_map->AppendDescriptor(&field, witness); | 966 initial_map->AppendDescriptor(&field); |
| 980 } | 967 } |
| 981 { | 968 { |
| 982 // ECMA-262, section 15.10.7.3. | 969 // ECMA-262, section 15.10.7.3. |
| 983 FieldDescriptor field(factory->ignore_case_string(), | 970 FieldDescriptor field(factory->ignore_case_string(), |
| 984 JSRegExp::kIgnoreCaseFieldIndex, | 971 JSRegExp::kIgnoreCaseFieldIndex, |
| 985 final, | 972 final, |
| 986 Representation::Tagged()); | 973 Representation::Tagged()); |
| 987 initial_map->AppendDescriptor(&field, witness); | 974 initial_map->AppendDescriptor(&field); |
| 988 } | 975 } |
| 989 { | 976 { |
| 990 // ECMA-262, section 15.10.7.4. | 977 // ECMA-262, section 15.10.7.4. |
| 991 FieldDescriptor field(factory->multiline_string(), | 978 FieldDescriptor field(factory->multiline_string(), |
| 992 JSRegExp::kMultilineFieldIndex, | 979 JSRegExp::kMultilineFieldIndex, |
| 993 final, | 980 final, |
| 994 Representation::Tagged()); | 981 Representation::Tagged()); |
| 995 initial_map->AppendDescriptor(&field, witness); | 982 initial_map->AppendDescriptor(&field); |
| 996 } | 983 } |
| 997 { | 984 { |
| 998 // ECMA-262, section 15.10.7.5. | 985 // ECMA-262, section 15.10.7.5. |
| 999 PropertyAttributes writable = | 986 PropertyAttributes writable = |
| 1000 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 987 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
| 1001 FieldDescriptor field(factory->last_index_string(), | 988 FieldDescriptor field(factory->last_index_string(), |
| 1002 JSRegExp::kLastIndexFieldIndex, | 989 JSRegExp::kLastIndexFieldIndex, |
| 1003 writable, | 990 writable, |
| 1004 Representation::Tagged()); | 991 Representation::Tagged()); |
| 1005 initial_map->AppendDescriptor(&field, witness); | 992 initial_map->AppendDescriptor(&field); |
| 1006 } | 993 } |
| 1007 | 994 |
| 1008 initial_map->set_inobject_properties(5); | 995 initial_map->set_inobject_properties(5); |
| 1009 initial_map->set_pre_allocated_property_fields(5); | 996 initial_map->set_pre_allocated_property_fields(5); |
| 1010 initial_map->set_unused_property_fields(0); | 997 initial_map->set_unused_property_fields(0); |
| 1011 initial_map->set_instance_size( | 998 initial_map->set_instance_size( |
| 1012 initial_map->instance_size() + 5 * kPointerSize); | 999 initial_map->instance_size() + 5 * kPointerSize); |
| 1013 initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map)); | 1000 initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map)); |
| 1014 | 1001 |
| 1015 // RegExp prototype object is itself a RegExp. | 1002 // RegExp prototype object is itself a RegExp. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 // Install the ThrowTypeError functions. | 1155 // Install the ThrowTypeError functions. |
| 1169 callee->set_getter(*throw_function); | 1156 callee->set_getter(*throw_function); |
| 1170 callee->set_setter(*throw_function); | 1157 callee->set_setter(*throw_function); |
| 1171 caller->set_getter(*throw_function); | 1158 caller->set_getter(*throw_function); |
| 1172 caller->set_setter(*throw_function); | 1159 caller->set_setter(*throw_function); |
| 1173 | 1160 |
| 1174 // Create the map. Allocate one in-object field for length. | 1161 // Create the map. Allocate one in-object field for length. |
| 1175 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, | 1162 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, |
| 1176 Heap::kStrictArgumentsObjectSize); | 1163 Heap::kStrictArgumentsObjectSize); |
| 1177 // Create the descriptor array for the arguments object. | 1164 // Create the descriptor array for the arguments object. |
| 1178 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 3); | 1165 Map::EnsureDescriptorSlack(map, 3); |
| 1179 DescriptorArray::WhitenessWitness witness(*descriptors); | |
| 1180 map->set_instance_descriptors(*descriptors); | |
| 1181 | 1166 |
| 1182 { // length | 1167 { // length |
| 1183 FieldDescriptor d( | 1168 FieldDescriptor d( |
| 1184 factory->length_string(), 0, DONT_ENUM, Representation::Tagged()); | 1169 factory->length_string(), 0, DONT_ENUM, Representation::Tagged()); |
| 1185 map->AppendDescriptor(&d, witness); | 1170 map->AppendDescriptor(&d); |
| 1186 } | 1171 } |
| 1187 { // callee | 1172 { // callee |
| 1188 CallbacksDescriptor d(factory->callee_string(), | 1173 CallbacksDescriptor d(factory->callee_string(), |
| 1189 callee, | 1174 callee, |
| 1190 attributes); | 1175 attributes); |
| 1191 map->AppendDescriptor(&d, witness); | 1176 map->AppendDescriptor(&d); |
| 1192 } | 1177 } |
| 1193 { // caller | 1178 { // caller |
| 1194 CallbacksDescriptor d(factory->caller_string(), | 1179 CallbacksDescriptor d(factory->caller_string(), |
| 1195 caller, | 1180 caller, |
| 1196 attributes); | 1181 attributes); |
| 1197 map->AppendDescriptor(&d, witness); | 1182 map->AppendDescriptor(&d); |
| 1198 } | 1183 } |
| 1199 | 1184 |
| 1200 map->set_function_with_prototype(true); | 1185 map->set_function_with_prototype(true); |
| 1201 map->set_prototype(native_context()->object_function()->prototype()); | 1186 map->set_prototype(native_context()->object_function()->prototype()); |
| 1202 map->set_pre_allocated_property_fields(1); | 1187 map->set_pre_allocated_property_fields(1); |
| 1203 map->set_inobject_properties(1); | 1188 map->set_inobject_properties(1); |
| 1204 | 1189 |
| 1205 // Copy constructor from the sloppy arguments boilerplate. | 1190 // Copy constructor from the sloppy arguments boilerplate. |
| 1206 map->set_constructor( | 1191 map->set_constructor( |
| 1207 native_context()->sloppy_arguments_boilerplate()->map()->constructor()); | 1192 native_context()->sloppy_arguments_boilerplate()->map()->constructor()); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 native_context()->set_generator_object_prototype_map( | 1358 native_context()->set_generator_object_prototype_map( |
| 1374 *generator_object_prototype_map); | 1359 *generator_object_prototype_map); |
| 1375 | 1360 |
| 1376 // Create a map for generator result objects. | 1361 // Create a map for generator result objects. |
| 1377 ASSERT(object_function->initial_map()->inobject_properties() == 0); | 1362 ASSERT(object_function->initial_map()->inobject_properties() == 0); |
| 1378 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); | 1363 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); |
| 1379 Handle<Map> generator_result_map = Map::Create( | 1364 Handle<Map> generator_result_map = Map::Create( |
| 1380 object_function, JSGeneratorObject::kResultPropertyCount); | 1365 object_function, JSGeneratorObject::kResultPropertyCount); |
| 1381 ASSERT(generator_result_map->inobject_properties() == | 1366 ASSERT(generator_result_map->inobject_properties() == |
| 1382 JSGeneratorObject::kResultPropertyCount); | 1367 JSGeneratorObject::kResultPropertyCount); |
| 1383 | 1368 Map::EnsureDescriptorSlack( |
| 1384 Handle<DescriptorArray> descriptors = factory()->NewDescriptorArray(0, | 1369 generator_result_map, JSGeneratorObject::kResultPropertyCount); |
| 1385 JSGeneratorObject::kResultPropertyCount); | |
| 1386 DescriptorArray::WhitenessWitness witness(*descriptors); | |
| 1387 generator_result_map->set_instance_descriptors(*descriptors); | |
| 1388 | 1370 |
| 1389 Handle<String> value_string = factory()->InternalizeOneByteString( | 1371 Handle<String> value_string = factory()->InternalizeOneByteString( |
| 1390 STATIC_ASCII_VECTOR("value")); | 1372 STATIC_ASCII_VECTOR("value")); |
| 1391 FieldDescriptor value_descr(value_string, | 1373 FieldDescriptor value_descr(value_string, |
| 1392 JSGeneratorObject::kResultValuePropertyIndex, | 1374 JSGeneratorObject::kResultValuePropertyIndex, |
| 1393 NONE, | 1375 NONE, |
| 1394 Representation::Tagged()); | 1376 Representation::Tagged()); |
| 1395 generator_result_map->AppendDescriptor(&value_descr, witness); | 1377 generator_result_map->AppendDescriptor(&value_descr); |
| 1396 | 1378 |
| 1397 Handle<String> done_string = factory()->InternalizeOneByteString( | 1379 Handle<String> done_string = factory()->InternalizeOneByteString( |
| 1398 STATIC_ASCII_VECTOR("done")); | 1380 STATIC_ASCII_VECTOR("done")); |
| 1399 FieldDescriptor done_descr(done_string, | 1381 FieldDescriptor done_descr(done_string, |
| 1400 JSGeneratorObject::kResultDonePropertyIndex, | 1382 JSGeneratorObject::kResultDonePropertyIndex, |
| 1401 NONE, | 1383 NONE, |
| 1402 Representation::Tagged()); | 1384 Representation::Tagged()); |
| 1403 generator_result_map->AppendDescriptor(&done_descr, witness); | 1385 generator_result_map->AppendDescriptor(&done_descr); |
| 1404 | 1386 |
| 1405 generator_result_map->set_unused_property_fields(0); | 1387 generator_result_map->set_unused_property_fields(0); |
| 1406 ASSERT_EQ(JSGeneratorObject::kResultSize, | 1388 ASSERT_EQ(JSGeneratorObject::kResultSize, |
| 1407 generator_result_map->instance_size()); | 1389 generator_result_map->instance_size()); |
| 1408 native_context()->set_generator_result_map(*generator_result_map); | 1390 native_context()->set_generator_result_map(*generator_result_map); |
| 1409 } | 1391 } |
| 1410 } | 1392 } |
| 1411 | 1393 |
| 1412 | 1394 |
| 1413 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1395 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 Handle<Code> code = internal_array_constructor_stub.GetCode(isolate()); | 1583 Handle<Code> code = internal_array_constructor_stub.GetCode(isolate()); |
| 1602 array_function->shared()->set_construct_stub(*code); | 1584 array_function->shared()->set_construct_stub(*code); |
| 1603 array_function->shared()->DontAdaptArguments(); | 1585 array_function->shared()->DontAdaptArguments(); |
| 1604 | 1586 |
| 1605 Handle<Map> original_map(array_function->initial_map()); | 1587 Handle<Map> original_map(array_function->initial_map()); |
| 1606 Handle<Map> initial_map = Map::Copy(original_map); | 1588 Handle<Map> initial_map = Map::Copy(original_map); |
| 1607 initial_map->set_elements_kind(elements_kind); | 1589 initial_map->set_elements_kind(elements_kind); |
| 1608 array_function->set_initial_map(*initial_map); | 1590 array_function->set_initial_map(*initial_map); |
| 1609 | 1591 |
| 1610 // Make "length" magic on instances. | 1592 // Make "length" magic on instances. |
| 1611 Handle<DescriptorArray> array_descriptors( | 1593 Map::EnsureDescriptorSlack(initial_map, 1); |
| 1612 factory()->NewDescriptorArray(0, 1)); | |
| 1613 DescriptorArray::WhitenessWitness witness(*array_descriptors); | |
| 1614 | 1594 |
| 1615 Handle<Foreign> array_length(factory()->NewForeign( | 1595 Handle<Foreign> array_length(factory()->NewForeign( |
| 1616 &Accessors::ArrayLength)); | 1596 &Accessors::ArrayLength)); |
| 1617 PropertyAttributes attribs = static_cast<PropertyAttributes>( | 1597 PropertyAttributes attribs = static_cast<PropertyAttributes>( |
| 1618 DONT_ENUM | DONT_DELETE); | 1598 DONT_ENUM | DONT_DELETE); |
| 1619 initial_map->set_instance_descriptors(*array_descriptors); | |
| 1620 | 1599 |
| 1621 { // Add length. | 1600 { // Add length. |
| 1622 CallbacksDescriptor d( | 1601 CallbacksDescriptor d( |
| 1623 factory()->length_string(), array_length, attribs); | 1602 factory()->length_string(), array_length, attribs); |
| 1624 array_function->initial_map()->AppendDescriptor(&d, witness); | 1603 array_function->initial_map()->AppendDescriptor(&d); |
| 1625 } | 1604 } |
| 1626 | 1605 |
| 1627 return array_function; | 1606 return array_function; |
| 1628 } | 1607 } |
| 1629 | 1608 |
| 1630 | 1609 |
| 1631 bool Genesis::InstallNatives() { | 1610 bool Genesis::InstallNatives() { |
| 1632 HandleScope scope(isolate()); | 1611 HandleScope scope(isolate()); |
| 1633 | 1612 |
| 1634 // Create a function for the builtins object. Allocate space for the | 1613 // Create a function for the builtins object. Allocate space for the |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 Handle<JSFunction> script_fun = | 1674 Handle<JSFunction> script_fun = |
| 1696 InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, | 1675 InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, |
| 1697 isolate()->initial_object_prototype(), | 1676 isolate()->initial_object_prototype(), |
| 1698 Builtins::kIllegal, false, false); | 1677 Builtins::kIllegal, false, false); |
| 1699 Handle<JSObject> prototype = | 1678 Handle<JSObject> prototype = |
| 1700 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1679 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 1701 Accessors::FunctionSetPrototype(script_fun, prototype); | 1680 Accessors::FunctionSetPrototype(script_fun, prototype); |
| 1702 native_context()->set_script_function(*script_fun); | 1681 native_context()->set_script_function(*script_fun); |
| 1703 | 1682 |
| 1704 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); | 1683 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); |
| 1705 | 1684 Map::EnsureDescriptorSlack(script_map, 13); |
| 1706 Handle<DescriptorArray> script_descriptors( | |
| 1707 factory()->NewDescriptorArray(0, 13)); | |
| 1708 DescriptorArray::WhitenessWitness witness(*script_descriptors); | |
| 1709 | 1685 |
| 1710 Handle<Foreign> script_source( | 1686 Handle<Foreign> script_source( |
| 1711 factory()->NewForeign(&Accessors::ScriptSource)); | 1687 factory()->NewForeign(&Accessors::ScriptSource)); |
| 1712 Handle<Foreign> script_name(factory()->NewForeign(&Accessors::ScriptName)); | 1688 Handle<Foreign> script_name(factory()->NewForeign(&Accessors::ScriptName)); |
| 1713 Handle<String> id_string(factory()->InternalizeOneByteString( | 1689 Handle<String> id_string(factory()->InternalizeOneByteString( |
| 1714 STATIC_ASCII_VECTOR("id"))); | 1690 STATIC_ASCII_VECTOR("id"))); |
| 1715 Handle<Foreign> script_id(factory()->NewForeign(&Accessors::ScriptId)); | 1691 Handle<Foreign> script_id(factory()->NewForeign(&Accessors::ScriptId)); |
| 1716 Handle<String> line_offset_string( | 1692 Handle<String> line_offset_string( |
| 1717 factory()->InternalizeOneByteString( | 1693 factory()->InternalizeOneByteString( |
| 1718 STATIC_ASCII_VECTOR("line_offset"))); | 1694 STATIC_ASCII_VECTOR("line_offset"))); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 STATIC_ASCII_VECTOR("eval_from_script_position"))); | 1726 STATIC_ASCII_VECTOR("eval_from_script_position"))); |
| 1751 Handle<Foreign> script_eval_from_script_position( | 1727 Handle<Foreign> script_eval_from_script_position( |
| 1752 factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition)); | 1728 factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition)); |
| 1753 Handle<String> eval_from_function_name_string( | 1729 Handle<String> eval_from_function_name_string( |
| 1754 factory()->InternalizeOneByteString( | 1730 factory()->InternalizeOneByteString( |
| 1755 STATIC_ASCII_VECTOR("eval_from_function_name"))); | 1731 STATIC_ASCII_VECTOR("eval_from_function_name"))); |
| 1756 Handle<Foreign> script_eval_from_function_name( | 1732 Handle<Foreign> script_eval_from_function_name( |
| 1757 factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName)); | 1733 factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName)); |
| 1758 PropertyAttributes attribs = | 1734 PropertyAttributes attribs = |
| 1759 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 1735 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 1760 script_map->set_instance_descriptors(*script_descriptors); | |
| 1761 | 1736 |
| 1762 { | 1737 { |
| 1763 CallbacksDescriptor d( | 1738 CallbacksDescriptor d( |
| 1764 factory()->source_string(), script_source, attribs); | 1739 factory()->source_string(), script_source, attribs); |
| 1765 script_map->AppendDescriptor(&d, witness); | 1740 script_map->AppendDescriptor(&d); |
| 1766 } | 1741 } |
| 1767 | 1742 |
| 1768 { | 1743 { |
| 1769 CallbacksDescriptor d(factory()->name_string(), script_name, attribs); | 1744 CallbacksDescriptor d(factory()->name_string(), script_name, attribs); |
| 1770 script_map->AppendDescriptor(&d, witness); | 1745 script_map->AppendDescriptor(&d); |
| 1771 } | 1746 } |
| 1772 | 1747 |
| 1773 { | 1748 { |
| 1774 CallbacksDescriptor d(id_string, script_id, attribs); | 1749 CallbacksDescriptor d(id_string, script_id, attribs); |
| 1775 script_map->AppendDescriptor(&d, witness); | 1750 script_map->AppendDescriptor(&d); |
| 1776 } | 1751 } |
| 1777 | 1752 |
| 1778 { | 1753 { |
| 1779 CallbacksDescriptor d(line_offset_string, script_line_offset, attribs); | 1754 CallbacksDescriptor d(line_offset_string, script_line_offset, attribs); |
| 1780 script_map->AppendDescriptor(&d, witness); | 1755 script_map->AppendDescriptor(&d); |
| 1781 } | 1756 } |
| 1782 | 1757 |
| 1783 { | 1758 { |
| 1784 CallbacksDescriptor d( | 1759 CallbacksDescriptor d( |
| 1785 column_offset_string, script_column_offset, attribs); | 1760 column_offset_string, script_column_offset, attribs); |
| 1786 script_map->AppendDescriptor(&d, witness); | 1761 script_map->AppendDescriptor(&d); |
| 1787 } | 1762 } |
| 1788 | 1763 |
| 1789 { | 1764 { |
| 1790 CallbacksDescriptor d(type_string, script_type, attribs); | 1765 CallbacksDescriptor d(type_string, script_type, attribs); |
| 1791 script_map->AppendDescriptor(&d, witness); | 1766 script_map->AppendDescriptor(&d); |
| 1792 } | 1767 } |
| 1793 | 1768 |
| 1794 { | 1769 { |
| 1795 CallbacksDescriptor d( | 1770 CallbacksDescriptor d( |
| 1796 compilation_type_string, script_compilation_type, attribs); | 1771 compilation_type_string, script_compilation_type, attribs); |
| 1797 script_map->AppendDescriptor(&d, witness); | 1772 script_map->AppendDescriptor(&d); |
| 1798 } | 1773 } |
| 1799 | 1774 |
| 1800 { | 1775 { |
| 1801 CallbacksDescriptor d(line_ends_string, script_line_ends, attribs); | 1776 CallbacksDescriptor d(line_ends_string, script_line_ends, attribs); |
| 1802 script_map->AppendDescriptor(&d, witness); | 1777 script_map->AppendDescriptor(&d); |
| 1803 } | 1778 } |
| 1804 | 1779 |
| 1805 { | 1780 { |
| 1806 CallbacksDescriptor d( | 1781 CallbacksDescriptor d( |
| 1807 context_data_string, script_context_data, attribs); | 1782 context_data_string, script_context_data, attribs); |
| 1808 script_map->AppendDescriptor(&d, witness); | 1783 script_map->AppendDescriptor(&d); |
| 1809 } | 1784 } |
| 1810 | 1785 |
| 1811 { | 1786 { |
| 1812 CallbacksDescriptor d( | 1787 CallbacksDescriptor d( |
| 1813 eval_from_script_string, script_eval_from_script, attribs); | 1788 eval_from_script_string, script_eval_from_script, attribs); |
| 1814 script_map->AppendDescriptor(&d, witness); | 1789 script_map->AppendDescriptor(&d); |
| 1815 } | 1790 } |
| 1816 | 1791 |
| 1817 { | 1792 { |
| 1818 CallbacksDescriptor d( | 1793 CallbacksDescriptor d( |
| 1819 eval_from_script_position_string, | 1794 eval_from_script_position_string, |
| 1820 script_eval_from_script_position, | 1795 script_eval_from_script_position, |
| 1821 attribs); | 1796 attribs); |
| 1822 script_map->AppendDescriptor(&d, witness); | 1797 script_map->AppendDescriptor(&d); |
| 1823 } | 1798 } |
| 1824 | 1799 |
| 1825 { | 1800 { |
| 1826 CallbacksDescriptor d( | 1801 CallbacksDescriptor d( |
| 1827 eval_from_function_name_string, | 1802 eval_from_function_name_string, |
| 1828 script_eval_from_function_name, | 1803 script_eval_from_function_name, |
| 1829 attribs); | 1804 attribs); |
| 1830 script_map->AppendDescriptor(&d, witness); | 1805 script_map->AppendDescriptor(&d); |
| 1831 } | 1806 } |
| 1832 | 1807 |
| 1833 // Allocate the empty script. | 1808 // Allocate the empty script. |
| 1834 Handle<Script> script = factory()->NewScript(factory()->empty_string()); | 1809 Handle<Script> script = factory()->NewScript(factory()->empty_string()); |
| 1835 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 1810 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
| 1836 heap()->public_set_empty_script(*script); | 1811 heap()->public_set_empty_script(*script); |
| 1837 } | 1812 } |
| 1838 { | 1813 { |
| 1839 // Builtin function for OpaqueReference -- a JSValue-based object, | 1814 // Builtin function for OpaqueReference -- a JSValue-based object, |
| 1840 // that keeps its field isolated from JavaScript code. It may store | 1815 // that keeps its field isolated from JavaScript code. It may store |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 // Add initial map. | 1915 // Add initial map. |
| 1941 Handle<Map> initial_map = | 1916 Handle<Map> initial_map = |
| 1942 factory()->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize); | 1917 factory()->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize); |
| 1943 initial_map->set_constructor(*array_constructor); | 1918 initial_map->set_constructor(*array_constructor); |
| 1944 | 1919 |
| 1945 // Set prototype on map. | 1920 // Set prototype on map. |
| 1946 initial_map->set_non_instance_prototype(false); | 1921 initial_map->set_non_instance_prototype(false); |
| 1947 initial_map->set_prototype(*array_prototype); | 1922 initial_map->set_prototype(*array_prototype); |
| 1948 | 1923 |
| 1949 // Update map with length accessor from Array and add "index" and "input". | 1924 // Update map with length accessor from Array and add "index" and "input". |
| 1950 Handle<DescriptorArray> reresult_descriptors = | 1925 Map::EnsureDescriptorSlack(initial_map, 3); |
| 1951 factory()->NewDescriptorArray(0, 3); | |
| 1952 DescriptorArray::WhitenessWitness witness(*reresult_descriptors); | |
| 1953 initial_map->set_instance_descriptors(*reresult_descriptors); | |
| 1954 | 1926 |
| 1955 { | 1927 { |
| 1956 JSFunction* array_function = native_context()->array_function(); | 1928 JSFunction* array_function = native_context()->array_function(); |
| 1957 Handle<DescriptorArray> array_descriptors( | 1929 Handle<DescriptorArray> array_descriptors( |
| 1958 array_function->initial_map()->instance_descriptors()); | 1930 array_function->initial_map()->instance_descriptors()); |
| 1959 Handle<String> length = factory()->length_string(); | 1931 Handle<String> length = factory()->length_string(); |
| 1960 int old = array_descriptors->SearchWithCache( | 1932 int old = array_descriptors->SearchWithCache( |
| 1961 *length, array_function->initial_map()); | 1933 *length, array_function->initial_map()); |
| 1962 ASSERT(old != DescriptorArray::kNotFound); | 1934 ASSERT(old != DescriptorArray::kNotFound); |
| 1963 CallbacksDescriptor desc(length, | 1935 CallbacksDescriptor desc(length, |
| 1964 handle(array_descriptors->GetValue(old), | 1936 handle(array_descriptors->GetValue(old), |
| 1965 isolate()), | 1937 isolate()), |
| 1966 array_descriptors->GetDetails(old).attributes()); | 1938 array_descriptors->GetDetails(old).attributes()); |
| 1967 initial_map->AppendDescriptor(&desc, witness); | 1939 initial_map->AppendDescriptor(&desc); |
| 1968 } | 1940 } |
| 1969 { | 1941 { |
| 1970 FieldDescriptor index_field(factory()->index_string(), | 1942 FieldDescriptor index_field(factory()->index_string(), |
| 1971 JSRegExpResult::kIndexIndex, | 1943 JSRegExpResult::kIndexIndex, |
| 1972 NONE, | 1944 NONE, |
| 1973 Representation::Tagged()); | 1945 Representation::Tagged()); |
| 1974 initial_map->AppendDescriptor(&index_field, witness); | 1946 initial_map->AppendDescriptor(&index_field); |
| 1975 } | 1947 } |
| 1976 | 1948 |
| 1977 { | 1949 { |
| 1978 FieldDescriptor input_field(factory()->input_string(), | 1950 FieldDescriptor input_field(factory()->input_string(), |
| 1979 JSRegExpResult::kInputIndex, | 1951 JSRegExpResult::kInputIndex, |
| 1980 NONE, | 1952 NONE, |
| 1981 Representation::Tagged()); | 1953 Representation::Tagged()); |
| 1982 initial_map->AppendDescriptor(&input_field, witness); | 1954 initial_map->AppendDescriptor(&input_field); |
| 1983 } | 1955 } |
| 1984 | 1956 |
| 1985 initial_map->set_inobject_properties(2); | 1957 initial_map->set_inobject_properties(2); |
| 1986 initial_map->set_pre_allocated_property_fields(2); | 1958 initial_map->set_pre_allocated_property_fields(2); |
| 1987 initial_map->set_unused_property_fields(0); | 1959 initial_map->set_unused_property_fields(0); |
| 1988 | 1960 |
| 1989 native_context()->set_regexp_result_map(*initial_map); | 1961 native_context()->set_regexp_result_map(*initial_map); |
| 1990 } | 1962 } |
| 1991 | 1963 |
| 1992 #ifdef VERIFY_HEAP | 1964 #ifdef VERIFY_HEAP |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2718 return from + sizeof(NestingCounterType); | 2690 return from + sizeof(NestingCounterType); |
| 2719 } | 2691 } |
| 2720 | 2692 |
| 2721 | 2693 |
| 2722 // Called when the top-level V8 mutex is destroyed. | 2694 // Called when the top-level V8 mutex is destroyed. |
| 2723 void Bootstrapper::FreeThreadResources() { | 2695 void Bootstrapper::FreeThreadResources() { |
| 2724 ASSERT(!IsActive()); | 2696 ASSERT(!IsActive()); |
| 2725 } | 2697 } |
| 2726 | 2698 |
| 2727 } } // namespace v8::internal | 2699 } } // namespace v8::internal |
| OLD | NEW |