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

Side by Side Diff: src/bootstrapper.cc

Issue 228333003: Handlefy Descriptor and other code in objects.cc (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/elements.cc » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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
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
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
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 DescriptorArray::WhitenessWitness witness(*array_descriptors); 1614 DescriptorArray::WhitenessWitness witness(*array_descriptors);
1615 1615
1616 Handle<Foreign> array_length(factory()->NewForeign( 1616 Handle<Foreign> array_length(factory()->NewForeign(
1617 &Accessors::ArrayLength)); 1617 &Accessors::ArrayLength));
1618 PropertyAttributes attribs = static_cast<PropertyAttributes>( 1618 PropertyAttributes attribs = static_cast<PropertyAttributes>(
1619 DONT_ENUM | DONT_DELETE); 1619 DONT_ENUM | DONT_DELETE);
1620 initial_map->set_instance_descriptors(*array_descriptors); 1620 initial_map->set_instance_descriptors(*array_descriptors);
1621 1621
1622 { // Add length. 1622 { // Add length.
1623 CallbacksDescriptor d( 1623 CallbacksDescriptor d(
1624 *factory()->length_string(), *array_length, attribs); 1624 factory()->length_string(), array_length, attribs);
1625 array_function->initial_map()->AppendDescriptor(&d, witness); 1625 array_function->initial_map()->AppendDescriptor(&d, witness);
1626 } 1626 }
1627 1627
1628 return array_function; 1628 return array_function;
1629 } 1629 }
1630 1630
1631 1631
1632 bool Genesis::InstallNatives() { 1632 bool Genesis::InstallNatives() {
1633 HandleScope scope(isolate()); 1633 HandleScope scope(isolate());
1634 1634
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 factory()->InternalizeOneByteString( 1755 factory()->InternalizeOneByteString(
1756 STATIC_ASCII_VECTOR("eval_from_function_name"))); 1756 STATIC_ASCII_VECTOR("eval_from_function_name")));
1757 Handle<Foreign> script_eval_from_function_name( 1757 Handle<Foreign> script_eval_from_function_name(
1758 factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName)); 1758 factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName));
1759 PropertyAttributes attribs = 1759 PropertyAttributes attribs =
1760 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 1760 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
1761 script_map->set_instance_descriptors(*script_descriptors); 1761 script_map->set_instance_descriptors(*script_descriptors);
1762 1762
1763 { 1763 {
1764 CallbacksDescriptor d( 1764 CallbacksDescriptor d(
1765 *factory()->source_string(), *script_source, attribs); 1765 factory()->source_string(), script_source, attribs);
1766 script_map->AppendDescriptor(&d, witness); 1766 script_map->AppendDescriptor(&d, witness);
1767 } 1767 }
1768 1768
1769 { 1769 {
1770 CallbacksDescriptor d(*factory()->name_string(), *script_name, attribs); 1770 CallbacksDescriptor d(factory()->name_string(), script_name, attribs);
1771 script_map->AppendDescriptor(&d, witness); 1771 script_map->AppendDescriptor(&d, witness);
1772 } 1772 }
1773 1773
1774 { 1774 {
1775 CallbacksDescriptor d(*id_string, *script_id, attribs); 1775 CallbacksDescriptor d(id_string, script_id, attribs);
1776 script_map->AppendDescriptor(&d, witness); 1776 script_map->AppendDescriptor(&d, witness);
1777 } 1777 }
1778 1778
1779 { 1779 {
1780 CallbacksDescriptor d(*line_offset_string, *script_line_offset, attribs); 1780 CallbacksDescriptor d(line_offset_string, script_line_offset, attribs);
1781 script_map->AppendDescriptor(&d, witness); 1781 script_map->AppendDescriptor(&d, witness);
1782 } 1782 }
1783 1783
1784 { 1784 {
1785 CallbacksDescriptor d( 1785 CallbacksDescriptor d(
1786 *column_offset_string, *script_column_offset, attribs); 1786 column_offset_string, script_column_offset, attribs);
1787 script_map->AppendDescriptor(&d, witness); 1787 script_map->AppendDescriptor(&d, witness);
1788 } 1788 }
1789 1789
1790 { 1790 {
1791 CallbacksDescriptor d(*type_string, *script_type, attribs); 1791 CallbacksDescriptor d(type_string, script_type, attribs);
1792 script_map->AppendDescriptor(&d, witness); 1792 script_map->AppendDescriptor(&d, witness);
1793 } 1793 }
1794 1794
1795 { 1795 {
1796 CallbacksDescriptor d( 1796 CallbacksDescriptor d(
1797 *compilation_type_string, *script_compilation_type, attribs); 1797 compilation_type_string, script_compilation_type, attribs);
1798 script_map->AppendDescriptor(&d, witness); 1798 script_map->AppendDescriptor(&d, witness);
1799 } 1799 }
1800 1800
1801 { 1801 {
1802 CallbacksDescriptor d(*line_ends_string, *script_line_ends, attribs); 1802 CallbacksDescriptor d(line_ends_string, script_line_ends, attribs);
1803 script_map->AppendDescriptor(&d, witness); 1803 script_map->AppendDescriptor(&d, witness);
1804 } 1804 }
1805 1805
1806 { 1806 {
1807 CallbacksDescriptor d( 1807 CallbacksDescriptor d(
1808 *context_data_string, *script_context_data, attribs); 1808 context_data_string, script_context_data, attribs);
1809 script_map->AppendDescriptor(&d, witness); 1809 script_map->AppendDescriptor(&d, witness);
1810 } 1810 }
1811 1811
1812 { 1812 {
1813 CallbacksDescriptor d( 1813 CallbacksDescriptor d(
1814 *eval_from_script_string, *script_eval_from_script, attribs); 1814 eval_from_script_string, script_eval_from_script, attribs);
1815 script_map->AppendDescriptor(&d, witness); 1815 script_map->AppendDescriptor(&d, witness);
1816 } 1816 }
1817 1817
1818 { 1818 {
1819 CallbacksDescriptor d( 1819 CallbacksDescriptor d(
1820 *eval_from_script_position_string, 1820 eval_from_script_position_string,
1821 *script_eval_from_script_position, 1821 script_eval_from_script_position,
1822 attribs); 1822 attribs);
1823 script_map->AppendDescriptor(&d, witness); 1823 script_map->AppendDescriptor(&d, witness);
1824 } 1824 }
1825 1825
1826 { 1826 {
1827 CallbacksDescriptor d( 1827 CallbacksDescriptor d(
1828 *eval_from_function_name_string, 1828 eval_from_function_name_string,
1829 *script_eval_from_function_name, 1829 script_eval_from_function_name,
1830 attribs); 1830 attribs);
1831 script_map->AppendDescriptor(&d, witness); 1831 script_map->AppendDescriptor(&d, witness);
1832 } 1832 }
1833 1833
1834 // Allocate the empty script. 1834 // Allocate the empty script.
1835 Handle<Script> script = factory()->NewScript(factory()->empty_string()); 1835 Handle<Script> script = factory()->NewScript(factory()->empty_string());
1836 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 1836 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
1837 heap()->public_set_empty_script(*script); 1837 heap()->public_set_empty_script(*script);
1838 } 1838 }
1839 { 1839 {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 // Update map with length accessor from Array and add "index" and "input". 1950 // Update map with length accessor from Array and add "index" and "input".
1951 Handle<DescriptorArray> reresult_descriptors = 1951 Handle<DescriptorArray> reresult_descriptors =
1952 factory()->NewDescriptorArray(0, 3); 1952 factory()->NewDescriptorArray(0, 3);
1953 DescriptorArray::WhitenessWitness witness(*reresult_descriptors); 1953 DescriptorArray::WhitenessWitness witness(*reresult_descriptors);
1954 initial_map->set_instance_descriptors(*reresult_descriptors); 1954 initial_map->set_instance_descriptors(*reresult_descriptors);
1955 1955
1956 { 1956 {
1957 JSFunction* array_function = native_context()->array_function(); 1957 JSFunction* array_function = native_context()->array_function();
1958 Handle<DescriptorArray> array_descriptors( 1958 Handle<DescriptorArray> array_descriptors(
1959 array_function->initial_map()->instance_descriptors()); 1959 array_function->initial_map()->instance_descriptors());
1960 String* length = heap()->length_string(); 1960 Handle<String> length = factory()->length_string();
1961 int old = array_descriptors->SearchWithCache( 1961 int old = array_descriptors->SearchWithCache(
1962 length, array_function->initial_map()); 1962 *length, array_function->initial_map());
1963 ASSERT(old != DescriptorArray::kNotFound); 1963 ASSERT(old != DescriptorArray::kNotFound);
1964 CallbacksDescriptor desc(length, 1964 CallbacksDescriptor desc(length,
1965 array_descriptors->GetValue(old), 1965 handle(array_descriptors->GetValue(old),
1966 isolate()),
1966 array_descriptors->GetDetails(old).attributes()); 1967 array_descriptors->GetDetails(old).attributes());
1967 initial_map->AppendDescriptor(&desc, witness); 1968 initial_map->AppendDescriptor(&desc, witness);
1968 } 1969 }
1969 { 1970 {
1970 FieldDescriptor index_field(heap()->index_string(), 1971 FieldDescriptor index_field(factory()->index_string(),
1971 JSRegExpResult::kIndexIndex, 1972 JSRegExpResult::kIndexIndex,
1972 NONE, 1973 NONE,
1973 Representation::Tagged()); 1974 Representation::Tagged());
1974 initial_map->AppendDescriptor(&index_field, witness); 1975 initial_map->AppendDescriptor(&index_field, witness);
1975 } 1976 }
1976 1977
1977 { 1978 {
1978 FieldDescriptor input_field(heap()->input_string(), 1979 FieldDescriptor input_field(factory()->input_string(),
1979 JSRegExpResult::kInputIndex, 1980 JSRegExpResult::kInputIndex,
1980 NONE, 1981 NONE,
1981 Representation::Tagged()); 1982 Representation::Tagged());
1982 initial_map->AppendDescriptor(&input_field, witness); 1983 initial_map->AppendDescriptor(&input_field, witness);
1983 } 1984 }
1984 1985
1985 initial_map->set_inobject_properties(2); 1986 initial_map->set_inobject_properties(2);
1986 initial_map->set_pre_allocated_property_fields(2); 1987 initial_map->set_pre_allocated_property_fields(2);
1987 initial_map->set_unused_property_fields(0); 1988 initial_map->set_unused_property_fields(0);
1988 1989
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | src/elements.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698