Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: src/bootstrapper.cc

Issue 8360004: Avoid incremental marking write-barrier when constructing descriptor arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/factory.cc » ('j') | src/objects.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor( 370 Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor(
371 PrototypePropertyMode prototypeMode) { 371 PrototypePropertyMode prototypeMode) {
372 Handle<DescriptorArray> descriptors = 372 Handle<DescriptorArray> descriptors =
373 factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE 373 factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE
374 ? 4 374 ? 4
375 : 5); 375 : 5);
376 PropertyAttributes attributes = 376 PropertyAttributes attributes =
377 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 377 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
378 378
379 DescriptorArray::WhitenessWitness witness(*descriptors);
380
379 { // Add length. 381 { // Add length.
380 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength); 382 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength);
381 CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes); 383 CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes);
382 descriptors->Set(0, &d); 384 descriptors->Set(0, &d, witness);
383 } 385 }
384 { // Add name. 386 { // Add name.
385 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName); 387 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName);
386 CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes); 388 CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes);
387 descriptors->Set(1, &d); 389 descriptors->Set(1, &d, witness);
388 } 390 }
389 { // Add arguments. 391 { // Add arguments.
390 Handle<Foreign> foreign = 392 Handle<Foreign> foreign =
391 factory()->NewForeign(&Accessors::FunctionArguments); 393 factory()->NewForeign(&Accessors::FunctionArguments);
392 CallbacksDescriptor d(*factory()->arguments_symbol(), *foreign, attributes); 394 CallbacksDescriptor d(*factory()->arguments_symbol(), *foreign, attributes);
393 descriptors->Set(2, &d); 395 descriptors->Set(2, &d, witness);
394 } 396 }
395 { // Add caller. 397 { // Add caller.
396 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionCaller); 398 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionCaller);
397 CallbacksDescriptor d(*factory()->caller_symbol(), *foreign, attributes); 399 CallbacksDescriptor d(*factory()->caller_symbol(), *foreign, attributes);
398 descriptors->Set(3, &d); 400 descriptors->Set(3, &d, witness);
399 } 401 }
400 if (prototypeMode != DONT_ADD_PROTOTYPE) { 402 if (prototypeMode != DONT_ADD_PROTOTYPE) {
401 // Add prototype. 403 // Add prototype.
402 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { 404 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
403 attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY); 405 attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY);
404 } 406 }
405 Handle<Foreign> foreign = 407 Handle<Foreign> foreign =
406 factory()->NewForeign(&Accessors::FunctionPrototype); 408 factory()->NewForeign(&Accessors::FunctionPrototype);
407 CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes); 409 CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes);
408 descriptors->Set(4, &d); 410 descriptors->Set(4, &d, witness);
409 } 411 }
410 descriptors->Sort(); 412 descriptors->Sort(witness);
411 return descriptors; 413 return descriptors;
412 } 414 }
413 415
414 416
415 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { 417 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) {
416 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); 418 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
417 Handle<DescriptorArray> descriptors = 419 Handle<DescriptorArray> descriptors =
418 ComputeFunctionInstanceDescriptor(prototype_mode); 420 ComputeFunctionInstanceDescriptor(prototype_mode);
419 map->set_instance_descriptors(*descriptors); 421 map->set_instance_descriptors(*descriptors);
420 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); 422 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 PrototypePropertyMode prototypeMode, 520 PrototypePropertyMode prototypeMode,
519 Handle<FixedArray> arguments, 521 Handle<FixedArray> arguments,
520 Handle<FixedArray> caller) { 522 Handle<FixedArray> caller) {
521 Handle<DescriptorArray> descriptors = 523 Handle<DescriptorArray> descriptors =
522 factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE 524 factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE
523 ? 4 525 ? 4
524 : 5); 526 : 5);
525 PropertyAttributes attributes = static_cast<PropertyAttributes>( 527 PropertyAttributes attributes = static_cast<PropertyAttributes>(
526 DONT_ENUM | DONT_DELETE); 528 DONT_ENUM | DONT_DELETE);
527 529
530 DescriptorArray::WhitenessWitness witness(*descriptors);
531
528 { // length 532 { // length
529 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength); 533 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength);
530 CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes); 534 CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes);
531 descriptors->Set(0, &d); 535 descriptors->Set(0, &d, witness);
532 } 536 }
533 { // name 537 { // name
534 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName); 538 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName);
535 CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes); 539 CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes);
536 descriptors->Set(1, &d); 540 descriptors->Set(1, &d, witness);
537 } 541 }
538 { // arguments 542 { // arguments
539 CallbacksDescriptor d(*factory()->arguments_symbol(), 543 CallbacksDescriptor d(*factory()->arguments_symbol(),
540 *arguments, 544 *arguments,
541 attributes); 545 attributes);
542 descriptors->Set(2, &d); 546 descriptors->Set(2, &d, witness);
543 } 547 }
544 { // caller 548 { // caller
545 CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attributes); 549 CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attributes);
546 descriptors->Set(3, &d); 550 descriptors->Set(3, &d, witness);
547 } 551 }
548 552
549 // prototype 553 // prototype
550 if (prototypeMode != DONT_ADD_PROTOTYPE) { 554 if (prototypeMode != DONT_ADD_PROTOTYPE) {
551 if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) { 555 if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) {
552 attributes = static_cast<PropertyAttributes>(attributes | READ_ONLY); 556 attributes = static_cast<PropertyAttributes>(attributes | READ_ONLY);
553 } 557 }
554 Handle<Foreign> foreign = 558 Handle<Foreign> foreign =
555 factory()->NewForeign(&Accessors::FunctionPrototype); 559 factory()->NewForeign(&Accessors::FunctionPrototype);
556 CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes); 560 CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes);
557 descriptors->Set(4, &d); 561 descriptors->Set(4, &d, witness);
558 } 562 }
559 563
560 descriptors->Sort(); 564 descriptors->Sort(witness);
561 return descriptors; 565 return descriptors;
562 } 566 }
563 567
564 568
565 // ECMAScript 5th Edition, 13.2.3 569 // ECMAScript 5th Edition, 13.2.3
566 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { 570 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
567 if (throw_type_error_function.is_null()) { 571 if (throw_type_error_function.is_null()) {
568 Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError"); 572 Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError");
569 throw_type_error_function = 573 throw_type_error_function =
570 factory()->NewFunctionWithoutPrototype(name, kNonStrictMode); 574 factory()->NewFunctionWithoutPrototype(name, kNonStrictMode);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 isolate->initial_object_prototype(), 939 isolate->initial_object_prototype(),
936 Builtins::kIllegal, true); 940 Builtins::kIllegal, true);
937 global_context()->set_regexp_function(*regexp_fun); 941 global_context()->set_regexp_function(*regexp_fun);
938 942
939 ASSERT(regexp_fun->has_initial_map()); 943 ASSERT(regexp_fun->has_initial_map());
940 Handle<Map> initial_map(regexp_fun->initial_map()); 944 Handle<Map> initial_map(regexp_fun->initial_map());
941 945
942 ASSERT_EQ(0, initial_map->inobject_properties()); 946 ASSERT_EQ(0, initial_map->inobject_properties());
943 947
944 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(5); 948 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(5);
949 DescriptorArray::WhitenessWitness witness(*descriptors);
945 PropertyAttributes final = 950 PropertyAttributes final =
946 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 951 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
947 int enum_index = 0; 952 int enum_index = 0;
948 { 953 {
949 // ECMA-262, section 15.10.7.1. 954 // ECMA-262, section 15.10.7.1.
950 FieldDescriptor field(heap->source_symbol(), 955 FieldDescriptor field(heap->source_symbol(),
951 JSRegExp::kSourceFieldIndex, 956 JSRegExp::kSourceFieldIndex,
952 final, 957 final,
953 enum_index++); 958 enum_index++);
954 descriptors->Set(0, &field); 959 descriptors->Set(0, &field, witness);
955 } 960 }
956 { 961 {
957 // ECMA-262, section 15.10.7.2. 962 // ECMA-262, section 15.10.7.2.
958 FieldDescriptor field(heap->global_symbol(), 963 FieldDescriptor field(heap->global_symbol(),
959 JSRegExp::kGlobalFieldIndex, 964 JSRegExp::kGlobalFieldIndex,
960 final, 965 final,
961 enum_index++); 966 enum_index++);
962 descriptors->Set(1, &field); 967 descriptors->Set(1, &field, witness);
963 } 968 }
964 { 969 {
965 // ECMA-262, section 15.10.7.3. 970 // ECMA-262, section 15.10.7.3.
966 FieldDescriptor field(heap->ignore_case_symbol(), 971 FieldDescriptor field(heap->ignore_case_symbol(),
967 JSRegExp::kIgnoreCaseFieldIndex, 972 JSRegExp::kIgnoreCaseFieldIndex,
968 final, 973 final,
969 enum_index++); 974 enum_index++);
970 descriptors->Set(2, &field); 975 descriptors->Set(2, &field, witness);
971 } 976 }
972 { 977 {
973 // ECMA-262, section 15.10.7.4. 978 // ECMA-262, section 15.10.7.4.
974 FieldDescriptor field(heap->multiline_symbol(), 979 FieldDescriptor field(heap->multiline_symbol(),
975 JSRegExp::kMultilineFieldIndex, 980 JSRegExp::kMultilineFieldIndex,
976 final, 981 final,
977 enum_index++); 982 enum_index++);
978 descriptors->Set(3, &field); 983 descriptors->Set(3, &field, witness);
979 } 984 }
980 { 985 {
981 // ECMA-262, section 15.10.7.5. 986 // ECMA-262, section 15.10.7.5.
982 PropertyAttributes writable = 987 PropertyAttributes writable =
983 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 988 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
984 FieldDescriptor field(heap->last_index_symbol(), 989 FieldDescriptor field(heap->last_index_symbol(),
985 JSRegExp::kLastIndexFieldIndex, 990 JSRegExp::kLastIndexFieldIndex,
986 writable, 991 writable,
987 enum_index++); 992 enum_index++);
988 descriptors->Set(4, &field); 993 descriptors->Set(4, &field, witness);
989 } 994 }
990 descriptors->SetNextEnumerationIndex(enum_index); 995 descriptors->SetNextEnumerationIndex(enum_index);
991 descriptors->Sort(); 996 descriptors->Sort(witness);
992 997
993 initial_map->set_inobject_properties(5); 998 initial_map->set_inobject_properties(5);
994 initial_map->set_pre_allocated_property_fields(5); 999 initial_map->set_pre_allocated_property_fields(5);
995 initial_map->set_unused_property_fields(0); 1000 initial_map->set_unused_property_fields(0);
996 initial_map->set_instance_size( 1001 initial_map->set_instance_size(
997 initial_map->instance_size() + 5 * kPointerSize); 1002 initial_map->instance_size() + 5 * kPointerSize);
998 initial_map->set_instance_descriptors(*descriptors); 1003 initial_map->set_instance_descriptors(*descriptors);
999 initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map)); 1004 initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map));
1000 1005
1001 // RegExp prototype object is itself a RegExp. 1006 // RegExp prototype object is itself a RegExp.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 GetThrowTypeErrorFunction(); 1123 GetThrowTypeErrorFunction();
1119 1124
1120 // Install the ThrowTypeError functions. 1125 // Install the ThrowTypeError functions.
1121 callee->set(0, *throw_function); 1126 callee->set(0, *throw_function);
1122 callee->set(1, *throw_function); 1127 callee->set(1, *throw_function);
1123 caller->set(0, *throw_function); 1128 caller->set(0, *throw_function);
1124 caller->set(1, *throw_function); 1129 caller->set(1, *throw_function);
1125 1130
1126 // Create the descriptor array for the arguments object. 1131 // Create the descriptor array for the arguments object.
1127 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3); 1132 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3);
1133 DescriptorArray::WhitenessWitness witness(*descriptors);
1128 { // length 1134 { // length
1129 FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM); 1135 FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM);
1130 descriptors->Set(0, &d); 1136 descriptors->Set(0, &d, witness);
1131 } 1137 }
1132 { // callee 1138 { // callee
1133 CallbacksDescriptor d(*factory->callee_symbol(), *callee, attributes); 1139 CallbacksDescriptor d(*factory->callee_symbol(), *callee, attributes);
1134 descriptors->Set(1, &d); 1140 descriptors->Set(1, &d, witness);
1135 } 1141 }
1136 { // caller 1142 { // caller
1137 CallbacksDescriptor d(*factory->caller_symbol(), *caller, attributes); 1143 CallbacksDescriptor d(*factory->caller_symbol(), *caller, attributes);
1138 descriptors->Set(2, &d); 1144 descriptors->Set(2, &d, witness);
1139 } 1145 }
1140 descriptors->Sort(); 1146 descriptors->Sort(witness);
1141 1147
1142 // Create the map. Allocate one in-object field for length. 1148 // Create the map. Allocate one in-object field for length.
1143 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, 1149 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE,
1144 Heap::kArgumentsObjectSizeStrict); 1150 Heap::kArgumentsObjectSizeStrict);
1145 map->set_instance_descriptors(*descriptors); 1151 map->set_instance_descriptors(*descriptors);
1146 map->set_function_with_prototype(true); 1152 map->set_function_with_prototype(true);
1147 map->set_prototype(global_context()->object_function()->prototype()); 1153 map->set_prototype(global_context()->object_function()->prototype());
1148 map->set_pre_allocated_property_fields(1); 1154 map->set_pre_allocated_property_fields(1);
1149 map->set_inobject_properties(1); 1155 map->set_inobject_properties(1);
1150 1156
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 1695
1690 // Update map with length accessor from Array and add "index" and "input". 1696 // Update map with length accessor from Array and add "index" and "input".
1691 Handle<Map> array_map(global_context()->js_array_map()); 1697 Handle<Map> array_map(global_context()->js_array_map());
1692 Handle<DescriptorArray> array_descriptors( 1698 Handle<DescriptorArray> array_descriptors(
1693 array_map->instance_descriptors()); 1699 array_map->instance_descriptors());
1694 ASSERT_EQ(1, array_descriptors->number_of_descriptors()); 1700 ASSERT_EQ(1, array_descriptors->number_of_descriptors());
1695 1701
1696 Handle<DescriptorArray> reresult_descriptors = 1702 Handle<DescriptorArray> reresult_descriptors =
1697 factory()->NewDescriptorArray(3); 1703 factory()->NewDescriptorArray(3);
1698 1704
1699 reresult_descriptors->CopyFrom(0, *array_descriptors, 0); 1705 DescriptorArray::WhitenessWitness witness(*reresult_descriptors);
1706
1707 reresult_descriptors->CopyFrom(0, *array_descriptors, 0, witness);
1700 1708
1701 int enum_index = 0; 1709 int enum_index = 0;
1702 { 1710 {
1703 FieldDescriptor index_field(heap()->index_symbol(), 1711 FieldDescriptor index_field(heap()->index_symbol(),
1704 JSRegExpResult::kIndexIndex, 1712 JSRegExpResult::kIndexIndex,
1705 NONE, 1713 NONE,
1706 enum_index++); 1714 enum_index++);
1707 reresult_descriptors->Set(1, &index_field); 1715 reresult_descriptors->Set(1, &index_field, witness);
1708 } 1716 }
1709 1717
1710 { 1718 {
1711 FieldDescriptor input_field(heap()->input_symbol(), 1719 FieldDescriptor input_field(heap()->input_symbol(),
1712 JSRegExpResult::kInputIndex, 1720 JSRegExpResult::kInputIndex,
1713 NONE, 1721 NONE,
1714 enum_index++); 1722 enum_index++);
1715 reresult_descriptors->Set(2, &input_field); 1723 reresult_descriptors->Set(2, &input_field, witness);
1716 } 1724 }
1717 reresult_descriptors->Sort(); 1725 reresult_descriptors->Sort(witness);
1718 1726
1719 initial_map->set_inobject_properties(2); 1727 initial_map->set_inobject_properties(2);
1720 initial_map->set_pre_allocated_property_fields(2); 1728 initial_map->set_pre_allocated_property_fields(2);
1721 initial_map->set_unused_property_fields(0); 1729 initial_map->set_unused_property_fields(0);
1722 initial_map->set_instance_descriptors(*reresult_descriptors); 1730 initial_map->set_instance_descriptors(*reresult_descriptors);
1723 1731
1724 global_context()->set_regexp_result_map(*initial_map); 1732 global_context()->set_regexp_result_map(*initial_map);
1725 } 1733 }
1726 1734
1727 #ifdef DEBUG 1735 #ifdef DEBUG
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 return from + sizeof(NestingCounterType); 2276 return from + sizeof(NestingCounterType);
2269 } 2277 }
2270 2278
2271 2279
2272 // Called when the top-level V8 mutex is destroyed. 2280 // Called when the top-level V8 mutex is destroyed.
2273 void Bootstrapper::FreeThreadResources() { 2281 void Bootstrapper::FreeThreadResources() {
2274 ASSERT(!IsActive()); 2282 ASSERT(!IsActive());
2275 } 2283 }
2276 2284
2277 } } // namespace v8::internal 2285 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.cc » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698