OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 #include "api.h" | 31 #include "api.h" |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "compiler.h" | 33 #include "compiler.h" |
34 #include "debug.h" | 34 #include "debug.h" |
35 #include "execution.h" | 35 #include "execution.h" |
36 #include "global-handles.h" | 36 #include "global-handles.h" |
37 #include "isolate-inl.h" | 37 #include "isolate-inl.h" |
38 #include "macro-assembler.h" | 38 #include "macro-assembler.h" |
39 #include "natives.h" | 39 #include "natives.h" |
40 #include "objects-visiting.h" | 40 #include "objects-visiting.h" |
| 41 #include "platform.h" |
41 #include "snapshot.h" | 42 #include "snapshot.h" |
42 #include "extensions/externalize-string-extension.h" | 43 #include "extensions/externalize-string-extension.h" |
43 #include "extensions/gc-extension.h" | 44 #include "extensions/gc-extension.h" |
44 | 45 |
45 namespace v8 { | 46 namespace v8 { |
46 namespace internal { | 47 namespace internal { |
47 | 48 |
48 | 49 |
49 NativesExternalStringResource::NativesExternalStringResource( | 50 NativesExternalStringResource::NativesExternalStringResource( |
50 Bootstrapper* bootstrapper, | 51 Bootstrapper* bootstrapper, |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 if (target->IsJSBuiltinsObject()) { | 356 if (target->IsJSBuiltinsObject()) { |
356 attributes = | 357 attributes = |
357 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 358 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
358 } else { | 359 } else { |
359 attributes = DONT_ENUM; | 360 attributes = DONT_ENUM; |
360 } | 361 } |
361 SetLocalPropertyNoThrow(target, symbol, function, attributes); | 362 SetLocalPropertyNoThrow(target, symbol, function, attributes); |
362 if (is_ecma_native) { | 363 if (is_ecma_native) { |
363 function->shared()->set_instance_class_name(*symbol); | 364 function->shared()->set_instance_class_name(*symbol); |
364 } | 365 } |
| 366 function->shared()->set_native(true); |
365 return function; | 367 return function; |
366 } | 368 } |
367 | 369 |
368 | 370 |
369 Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor( | 371 Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor( |
370 PrototypePropertyMode prototypeMode) { | 372 PrototypePropertyMode prototypeMode) { |
371 Handle<DescriptorArray> descriptors = | 373 Handle<DescriptorArray> descriptors = |
372 factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE | 374 factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE |
373 ? 4 | 375 ? 4 |
374 : 5); | 376 : 5); |
375 PropertyAttributes attributes = | 377 PropertyAttributes attributes = |
376 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 378 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
377 | 379 |
| 380 DescriptorArray::WhitenessWitness witness(*descriptors); |
| 381 |
378 { // Add length. | 382 { // Add length. |
379 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength); | 383 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength); |
380 CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes); | 384 CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes); |
381 descriptors->Set(0, &d); | 385 descriptors->Set(0, &d, witness); |
382 } | 386 } |
383 { // Add name. | 387 { // Add name. |
384 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName); | 388 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName); |
385 CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes); | 389 CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes); |
386 descriptors->Set(1, &d); | 390 descriptors->Set(1, &d, witness); |
387 } | 391 } |
388 { // Add arguments. | 392 { // Add arguments. |
389 Handle<Foreign> foreign = | 393 Handle<Foreign> foreign = |
390 factory()->NewForeign(&Accessors::FunctionArguments); | 394 factory()->NewForeign(&Accessors::FunctionArguments); |
391 CallbacksDescriptor d(*factory()->arguments_symbol(), *foreign, attributes); | 395 CallbacksDescriptor d(*factory()->arguments_symbol(), *foreign, attributes); |
392 descriptors->Set(2, &d); | 396 descriptors->Set(2, &d, witness); |
393 } | 397 } |
394 { // Add caller. | 398 { // Add caller. |
395 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionCaller); | 399 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionCaller); |
396 CallbacksDescriptor d(*factory()->caller_symbol(), *foreign, attributes); | 400 CallbacksDescriptor d(*factory()->caller_symbol(), *foreign, attributes); |
397 descriptors->Set(3, &d); | 401 descriptors->Set(3, &d, witness); |
398 } | 402 } |
399 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 403 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
400 // Add prototype. | 404 // Add prototype. |
401 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { | 405 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { |
402 attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY); | 406 attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY); |
403 } | 407 } |
404 Handle<Foreign> foreign = | 408 Handle<Foreign> foreign = |
405 factory()->NewForeign(&Accessors::FunctionPrototype); | 409 factory()->NewForeign(&Accessors::FunctionPrototype); |
406 CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes); | 410 CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes); |
407 descriptors->Set(4, &d); | 411 descriptors->Set(4, &d, witness); |
408 } | 412 } |
409 descriptors->Sort(); | 413 descriptors->Sort(witness); |
410 return descriptors; | 414 return descriptors; |
411 } | 415 } |
412 | 416 |
413 | 417 |
414 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { | 418 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { |
415 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 419 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
416 Handle<DescriptorArray> descriptors = | 420 Handle<DescriptorArray> descriptors = |
417 ComputeFunctionInstanceDescriptor(prototype_mode); | 421 ComputeFunctionInstanceDescriptor(prototype_mode); |
418 map->set_instance_descriptors(*descriptors); | 422 map->set_instance_descriptors(*descriptors); |
419 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); | 423 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 519 |
516 Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor( | 520 Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor( |
517 PrototypePropertyMode prototypeMode, | 521 PrototypePropertyMode prototypeMode, |
518 Handle<FixedArray> arguments, | 522 Handle<FixedArray> arguments, |
519 Handle<FixedArray> caller) { | 523 Handle<FixedArray> caller) { |
520 Handle<DescriptorArray> descriptors = | 524 Handle<DescriptorArray> descriptors = |
521 factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE | 525 factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE |
522 ? 4 | 526 ? 4 |
523 : 5); | 527 : 5); |
524 PropertyAttributes attributes = static_cast<PropertyAttributes>( | 528 PropertyAttributes attributes = static_cast<PropertyAttributes>( |
525 DONT_ENUM | DONT_DELETE | READ_ONLY); | 529 DONT_ENUM | DONT_DELETE); |
| 530 |
| 531 DescriptorArray::WhitenessWitness witness(*descriptors); |
526 | 532 |
527 { // length | 533 { // length |
528 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength); | 534 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionLength); |
529 CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes); | 535 CallbacksDescriptor d(*factory()->length_symbol(), *foreign, attributes); |
530 descriptors->Set(0, &d); | 536 descriptors->Set(0, &d, witness); |
531 } | 537 } |
532 { // name | 538 { // name |
533 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName); | 539 Handle<Foreign> foreign = factory()->NewForeign(&Accessors::FunctionName); |
534 CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes); | 540 CallbacksDescriptor d(*factory()->name_symbol(), *foreign, attributes); |
535 descriptors->Set(1, &d); | 541 descriptors->Set(1, &d, witness); |
536 } | 542 } |
537 { // arguments | 543 { // arguments |
538 CallbacksDescriptor d(*factory()->arguments_symbol(), | 544 CallbacksDescriptor d(*factory()->arguments_symbol(), |
539 *arguments, | 545 *arguments, |
540 attributes); | 546 attributes); |
541 descriptors->Set(2, &d); | 547 descriptors->Set(2, &d, witness); |
542 } | 548 } |
543 { // caller | 549 { // caller |
544 CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attributes); | 550 CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attributes); |
545 descriptors->Set(3, &d); | 551 descriptors->Set(3, &d, witness); |
546 } | 552 } |
547 | 553 |
548 // prototype | 554 // prototype |
549 if (prototypeMode != DONT_ADD_PROTOTYPE) { | 555 if (prototypeMode != DONT_ADD_PROTOTYPE) { |
550 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { | 556 if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) { |
551 attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY); | 557 attributes = static_cast<PropertyAttributes>(attributes | READ_ONLY); |
552 } | 558 } |
553 Handle<Foreign> foreign = | 559 Handle<Foreign> foreign = |
554 factory()->NewForeign(&Accessors::FunctionPrototype); | 560 factory()->NewForeign(&Accessors::FunctionPrototype); |
555 CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes); | 561 CallbacksDescriptor d(*factory()->prototype_symbol(), *foreign, attributes); |
556 descriptors->Set(4, &d); | 562 descriptors->Set(4, &d, witness); |
557 } | 563 } |
558 | 564 |
559 descriptors->Sort(); | 565 descriptors->Sort(witness); |
560 return descriptors; | 566 return descriptors; |
561 } | 567 } |
562 | 568 |
563 | 569 |
564 // ECMAScript 5th Edition, 13.2.3 | 570 // ECMAScript 5th Edition, 13.2.3 |
565 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { | 571 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { |
566 if (throw_type_error_function.is_null()) { | 572 if (throw_type_error_function.is_null()) { |
567 Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError"); | 573 Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError"); |
568 throw_type_error_function = | 574 throw_type_error_function = |
569 factory()->NewFunctionWithoutPrototype(name, kNonStrictMode); | 575 factory()->NewFunctionWithoutPrototype(name, kNonStrictMode); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 isolate->initial_object_prototype(), | 940 isolate->initial_object_prototype(), |
935 Builtins::kIllegal, true); | 941 Builtins::kIllegal, true); |
936 global_context()->set_regexp_function(*regexp_fun); | 942 global_context()->set_regexp_function(*regexp_fun); |
937 | 943 |
938 ASSERT(regexp_fun->has_initial_map()); | 944 ASSERT(regexp_fun->has_initial_map()); |
939 Handle<Map> initial_map(regexp_fun->initial_map()); | 945 Handle<Map> initial_map(regexp_fun->initial_map()); |
940 | 946 |
941 ASSERT_EQ(0, initial_map->inobject_properties()); | 947 ASSERT_EQ(0, initial_map->inobject_properties()); |
942 | 948 |
943 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(5); | 949 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(5); |
| 950 DescriptorArray::WhitenessWitness witness(*descriptors); |
944 PropertyAttributes final = | 951 PropertyAttributes final = |
945 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 952 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
946 int enum_index = 0; | 953 int enum_index = 0; |
947 { | 954 { |
948 // ECMA-262, section 15.10.7.1. | 955 // ECMA-262, section 15.10.7.1. |
949 FieldDescriptor field(heap->source_symbol(), | 956 FieldDescriptor field(heap->source_symbol(), |
950 JSRegExp::kSourceFieldIndex, | 957 JSRegExp::kSourceFieldIndex, |
951 final, | 958 final, |
952 enum_index++); | 959 enum_index++); |
953 descriptors->Set(0, &field); | 960 descriptors->Set(0, &field, witness); |
954 } | 961 } |
955 { | 962 { |
956 // ECMA-262, section 15.10.7.2. | 963 // ECMA-262, section 15.10.7.2. |
957 FieldDescriptor field(heap->global_symbol(), | 964 FieldDescriptor field(heap->global_symbol(), |
958 JSRegExp::kGlobalFieldIndex, | 965 JSRegExp::kGlobalFieldIndex, |
959 final, | 966 final, |
960 enum_index++); | 967 enum_index++); |
961 descriptors->Set(1, &field); | 968 descriptors->Set(1, &field, witness); |
962 } | 969 } |
963 { | 970 { |
964 // ECMA-262, section 15.10.7.3. | 971 // ECMA-262, section 15.10.7.3. |
965 FieldDescriptor field(heap->ignore_case_symbol(), | 972 FieldDescriptor field(heap->ignore_case_symbol(), |
966 JSRegExp::kIgnoreCaseFieldIndex, | 973 JSRegExp::kIgnoreCaseFieldIndex, |
967 final, | 974 final, |
968 enum_index++); | 975 enum_index++); |
969 descriptors->Set(2, &field); | 976 descriptors->Set(2, &field, witness); |
970 } | 977 } |
971 { | 978 { |
972 // ECMA-262, section 15.10.7.4. | 979 // ECMA-262, section 15.10.7.4. |
973 FieldDescriptor field(heap->multiline_symbol(), | 980 FieldDescriptor field(heap->multiline_symbol(), |
974 JSRegExp::kMultilineFieldIndex, | 981 JSRegExp::kMultilineFieldIndex, |
975 final, | 982 final, |
976 enum_index++); | 983 enum_index++); |
977 descriptors->Set(3, &field); | 984 descriptors->Set(3, &field, witness); |
978 } | 985 } |
979 { | 986 { |
980 // ECMA-262, section 15.10.7.5. | 987 // ECMA-262, section 15.10.7.5. |
981 PropertyAttributes writable = | 988 PropertyAttributes writable = |
982 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 989 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
983 FieldDescriptor field(heap->last_index_symbol(), | 990 FieldDescriptor field(heap->last_index_symbol(), |
984 JSRegExp::kLastIndexFieldIndex, | 991 JSRegExp::kLastIndexFieldIndex, |
985 writable, | 992 writable, |
986 enum_index++); | 993 enum_index++); |
987 descriptors->Set(4, &field); | 994 descriptors->Set(4, &field, witness); |
988 } | 995 } |
989 descriptors->SetNextEnumerationIndex(enum_index); | 996 descriptors->SetNextEnumerationIndex(enum_index); |
990 descriptors->Sort(); | 997 descriptors->Sort(witness); |
991 | 998 |
992 initial_map->set_inobject_properties(5); | 999 initial_map->set_inobject_properties(5); |
993 initial_map->set_pre_allocated_property_fields(5); | 1000 initial_map->set_pre_allocated_property_fields(5); |
994 initial_map->set_unused_property_fields(0); | 1001 initial_map->set_unused_property_fields(0); |
995 initial_map->set_instance_size( | 1002 initial_map->set_instance_size( |
996 initial_map->instance_size() + 5 * kPointerSize); | 1003 initial_map->instance_size() + 5 * kPointerSize); |
997 initial_map->set_instance_descriptors(*descriptors); | 1004 initial_map->set_instance_descriptors(*descriptors); |
998 initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map)); | 1005 initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map)); |
999 | 1006 |
1000 // RegExp prototype object is itself a RegExp. | 1007 // RegExp prototype object is itself a RegExp. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 // Note: length must be added as the first property and | 1065 // Note: length must be added as the first property and |
1059 // callee must be added as the second property. | 1066 // callee must be added as the second property. |
1060 SetLocalPropertyNoThrow(result, factory->length_symbol(), | 1067 SetLocalPropertyNoThrow(result, factory->length_symbol(), |
1061 factory->undefined_value(), | 1068 factory->undefined_value(), |
1062 DONT_ENUM); | 1069 DONT_ENUM); |
1063 SetLocalPropertyNoThrow(result, factory->callee_symbol(), | 1070 SetLocalPropertyNoThrow(result, factory->callee_symbol(), |
1064 factory->undefined_value(), | 1071 factory->undefined_value(), |
1065 DONT_ENUM); | 1072 DONT_ENUM); |
1066 | 1073 |
1067 #ifdef DEBUG | 1074 #ifdef DEBUG |
1068 LookupResult lookup; | 1075 LookupResult lookup(isolate); |
1069 result->LocalLookup(heap->callee_symbol(), &lookup); | 1076 result->LocalLookup(heap->callee_symbol(), &lookup); |
1070 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); | 1077 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); |
1071 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsCalleeIndex); | 1078 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsCalleeIndex); |
1072 | 1079 |
1073 result->LocalLookup(heap->length_symbol(), &lookup); | 1080 result->LocalLookup(heap->length_symbol(), &lookup); |
1074 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); | 1081 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); |
1075 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex); | 1082 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex); |
1076 | 1083 |
1077 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsCalleeIndex); | 1084 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsCalleeIndex); |
1078 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex); | 1085 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex); |
1079 | 1086 |
1080 // Check the state of the object. | 1087 // Check the state of the object. |
1081 ASSERT(result->HasFastProperties()); | 1088 ASSERT(result->HasFastProperties()); |
1082 ASSERT(result->HasFastElements()); | 1089 ASSERT(result->HasFastElements()); |
1083 #endif | 1090 #endif |
1084 } | 1091 } |
1085 | 1092 |
1086 { // --- aliased_arguments_boilerplate_ | 1093 { // --- aliased_arguments_boilerplate_ |
1087 Handle<Map> old_map(global_context()->arguments_boilerplate()->map()); | |
1088 Handle<Map> new_map = factory->CopyMapDropTransitions(old_map); | |
1089 new_map->set_pre_allocated_property_fields(2); | |
1090 Handle<JSObject> result = factory->NewJSObjectFromMap(new_map); | |
1091 new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS); | |
1092 // Set up a well-formed parameter map to make assertions happy. | 1094 // Set up a well-formed parameter map to make assertions happy. |
1093 Handle<FixedArray> elements = factory->NewFixedArray(2); | 1095 Handle<FixedArray> elements = factory->NewFixedArray(2); |
1094 elements->set_map(heap->non_strict_arguments_elements_map()); | 1096 elements->set_map(heap->non_strict_arguments_elements_map()); |
1095 Handle<FixedArray> array; | 1097 Handle<FixedArray> array; |
1096 array = factory->NewFixedArray(0); | 1098 array = factory->NewFixedArray(0); |
1097 elements->set(0, *array); | 1099 elements->set(0, *array); |
1098 array = factory->NewFixedArray(0); | 1100 array = factory->NewFixedArray(0); |
1099 elements->set(1, *array); | 1101 elements->set(1, *array); |
1100 Handle<Map> non_strict_arguments_elements_map = | 1102 |
1101 factory->GetElementsTransitionMap(result, | 1103 Handle<Map> old_map(global_context()->arguments_boilerplate()->map()); |
1102 NON_STRICT_ARGUMENTS_ELEMENTS); | 1104 Handle<Map> new_map = factory->CopyMapDropTransitions(old_map); |
1103 result->set_map(*non_strict_arguments_elements_map); | 1105 new_map->set_pre_allocated_property_fields(2); |
| 1106 Handle<JSObject> result = factory->NewJSObjectFromMap(new_map); |
| 1107 // Set elements kind after allocating the object because |
| 1108 // NewJSObjectFromMap assumes a fast elements map. |
| 1109 new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS); |
| 1110 result->set_elements(*elements); |
1104 ASSERT(result->HasNonStrictArgumentsElements()); | 1111 ASSERT(result->HasNonStrictArgumentsElements()); |
1105 result->set_elements(*elements); | |
1106 global_context()->set_aliased_arguments_boilerplate(*result); | 1112 global_context()->set_aliased_arguments_boilerplate(*result); |
1107 } | 1113 } |
1108 | 1114 |
1109 { // --- strict mode arguments boilerplate | 1115 { // --- strict mode arguments boilerplate |
1110 const PropertyAttributes attributes = | 1116 const PropertyAttributes attributes = |
1111 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 1117 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
1112 | 1118 |
1113 // Create the ThrowTypeError functions. | 1119 // Create the ThrowTypeError functions. |
1114 Handle<FixedArray> callee = factory->NewFixedArray(2, TENURED); | 1120 Handle<FixedArray> callee = factory->NewFixedArray(2, TENURED); |
1115 Handle<FixedArray> caller = factory->NewFixedArray(2, TENURED); | 1121 Handle<FixedArray> caller = factory->NewFixedArray(2, TENURED); |
1116 | 1122 |
1117 Handle<JSFunction> throw_function = | 1123 Handle<JSFunction> throw_function = |
1118 GetThrowTypeErrorFunction(); | 1124 GetThrowTypeErrorFunction(); |
1119 | 1125 |
1120 // Install the ThrowTypeError functions. | 1126 // Install the ThrowTypeError functions. |
1121 callee->set(0, *throw_function); | 1127 callee->set(0, *throw_function); |
1122 callee->set(1, *throw_function); | 1128 callee->set(1, *throw_function); |
1123 caller->set(0, *throw_function); | 1129 caller->set(0, *throw_function); |
1124 caller->set(1, *throw_function); | 1130 caller->set(1, *throw_function); |
1125 | 1131 |
1126 // Create the descriptor array for the arguments object. | 1132 // Create the descriptor array for the arguments object. |
1127 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3); | 1133 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3); |
| 1134 DescriptorArray::WhitenessWitness witness(*descriptors); |
1128 { // length | 1135 { // length |
1129 FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM); | 1136 FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM); |
1130 descriptors->Set(0, &d); | 1137 descriptors->Set(0, &d, witness); |
1131 } | 1138 } |
1132 { // callee | 1139 { // callee |
1133 CallbacksDescriptor d(*factory->callee_symbol(), *callee, attributes); | 1140 CallbacksDescriptor d(*factory->callee_symbol(), *callee, attributes); |
1134 descriptors->Set(1, &d); | 1141 descriptors->Set(1, &d, witness); |
1135 } | 1142 } |
1136 { // caller | 1143 { // caller |
1137 CallbacksDescriptor d(*factory->caller_symbol(), *caller, attributes); | 1144 CallbacksDescriptor d(*factory->caller_symbol(), *caller, attributes); |
1138 descriptors->Set(2, &d); | 1145 descriptors->Set(2, &d, witness); |
1139 } | 1146 } |
1140 descriptors->Sort(); | 1147 descriptors->Sort(witness); |
1141 | 1148 |
1142 // Create the map. Allocate one in-object field for length. | 1149 // Create the map. Allocate one in-object field for length. |
1143 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, | 1150 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, |
1144 Heap::kArgumentsObjectSizeStrict); | 1151 Heap::kArgumentsObjectSizeStrict); |
1145 map->set_instance_descriptors(*descriptors); | 1152 map->set_instance_descriptors(*descriptors); |
1146 map->set_function_with_prototype(true); | 1153 map->set_function_with_prototype(true); |
1147 map->set_prototype(global_context()->object_function()->prototype()); | 1154 map->set_prototype(global_context()->object_function()->prototype()); |
1148 map->set_pre_allocated_property_fields(1); | 1155 map->set_pre_allocated_property_fields(1); |
1149 map->set_inobject_properties(1); | 1156 map->set_inobject_properties(1); |
1150 | 1157 |
1151 // Copy constructor from the non-strict arguments boilerplate. | 1158 // Copy constructor from the non-strict arguments boilerplate. |
1152 map->set_constructor( | 1159 map->set_constructor( |
1153 global_context()->arguments_boilerplate()->map()->constructor()); | 1160 global_context()->arguments_boilerplate()->map()->constructor()); |
1154 | 1161 |
1155 // Allocate the arguments boilerplate object. | 1162 // Allocate the arguments boilerplate object. |
1156 Handle<JSObject> result = factory->NewJSObjectFromMap(map); | 1163 Handle<JSObject> result = factory->NewJSObjectFromMap(map); |
1157 global_context()->set_strict_mode_arguments_boilerplate(*result); | 1164 global_context()->set_strict_mode_arguments_boilerplate(*result); |
1158 | 1165 |
1159 // Add length property only for strict mode boilerplate. | 1166 // Add length property only for strict mode boilerplate. |
1160 SetLocalPropertyNoThrow(result, factory->length_symbol(), | 1167 SetLocalPropertyNoThrow(result, factory->length_symbol(), |
1161 factory->undefined_value(), | 1168 factory->undefined_value(), |
1162 DONT_ENUM); | 1169 DONT_ENUM); |
1163 | 1170 |
1164 #ifdef DEBUG | 1171 #ifdef DEBUG |
1165 LookupResult lookup; | 1172 LookupResult lookup(isolate); |
1166 result->LocalLookup(heap->length_symbol(), &lookup); | 1173 result->LocalLookup(heap->length_symbol(), &lookup); |
1167 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); | 1174 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); |
1168 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex); | 1175 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex); |
1169 | 1176 |
1170 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex); | 1177 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex); |
1171 | 1178 |
1172 // Check the state of the object. | 1179 // Check the state of the object. |
1173 ASSERT(result->HasFastProperties()); | 1180 ASSERT(result->HasFastProperties()); |
1174 ASSERT(result->HasFastElements()); | 1181 ASSERT(result->HasFastElements()); |
1175 #endif | 1182 #endif |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 JSObject::kHeaderSize, code, true); | 1221 JSObject::kHeaderSize, code, true); |
1215 global_context()->set_call_as_constructor_delegate(*delegate); | 1222 global_context()->set_call_as_constructor_delegate(*delegate); |
1216 delegate->shared()->DontAdaptArguments(); | 1223 delegate->shared()->DontAdaptArguments(); |
1217 } | 1224 } |
1218 | 1225 |
1219 // Initialize the out of memory slot. | 1226 // Initialize the out of memory slot. |
1220 global_context()->set_out_of_memory(heap->false_value()); | 1227 global_context()->set_out_of_memory(heap->false_value()); |
1221 | 1228 |
1222 // Initialize the data slot. | 1229 // Initialize the data slot. |
1223 global_context()->set_data(heap->undefined_value()); | 1230 global_context()->set_data(heap->undefined_value()); |
| 1231 |
| 1232 { |
| 1233 // Initialize the random seed slot. |
| 1234 Handle<ByteArray> zeroed_byte_array( |
| 1235 factory->NewByteArray(kRandomStateSize)); |
| 1236 global_context()->set_random_seed(*zeroed_byte_array); |
| 1237 memset(zeroed_byte_array->GetDataStartAddress(), 0, kRandomStateSize); |
| 1238 } |
1224 } | 1239 } |
1225 | 1240 |
1226 | 1241 |
1227 void Genesis::InitializeExperimentalGlobal() { | 1242 void Genesis::InitializeExperimentalGlobal() { |
1228 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); | 1243 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); |
1229 | 1244 |
1230 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no | 1245 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no |
1231 // longer need to live behind a flag, so WeakMap gets added to the snapshot. | 1246 // longer need to live behind a flag, so functions get added to the snapshot. |
1232 if (FLAG_harmony_weakmaps) { // -- W e a k M a p | 1247 if (FLAG_harmony_collections) { |
1233 Handle<JSObject> prototype = | 1248 { // -- S e t |
1234 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1249 Handle<JSObject> prototype = |
1235 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, | 1250 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1236 prototype, Builtins::kIllegal, true); | 1251 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, |
| 1252 prototype, Builtins::kIllegal, true); |
| 1253 } |
| 1254 { // -- M a p |
| 1255 Handle<JSObject> prototype = |
| 1256 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 1257 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize, |
| 1258 prototype, Builtins::kIllegal, true); |
| 1259 } |
| 1260 { // -- W e a k M a p |
| 1261 Handle<JSObject> prototype = |
| 1262 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 1263 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, |
| 1264 prototype, Builtins::kIllegal, true); |
| 1265 } |
1237 } | 1266 } |
1238 } | 1267 } |
1239 | 1268 |
1240 | 1269 |
1241 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1270 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
1242 Vector<const char> name = Natives::GetScriptName(index); | 1271 Vector<const char> name = Natives::GetScriptName(index); |
1243 Handle<String> source_code = | 1272 Handle<String> source_code = |
1244 isolate->bootstrapper()->NativesSourceLookup(index); | 1273 isolate->bootstrapper()->NativesSourceLookup(index); |
1245 return CompileNative(name, source_code); | 1274 return CompileNative(name, source_code); |
1246 } | 1275 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 INSTALL_NATIVE(JSObject, "functionCache", function_cache); | 1384 INSTALL_NATIVE(JSObject, "functionCache", function_cache); |
1356 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", | 1385 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", |
1357 to_complete_property_descriptor); | 1386 to_complete_property_descriptor); |
1358 } | 1387 } |
1359 | 1388 |
1360 void Genesis::InstallExperimentalNativeFunctions() { | 1389 void Genesis::InstallExperimentalNativeFunctions() { |
1361 if (FLAG_harmony_proxies) { | 1390 if (FLAG_harmony_proxies) { |
1362 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1391 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
1363 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1392 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
1364 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1393 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
| 1394 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
1365 } | 1395 } |
1366 } | 1396 } |
1367 | 1397 |
1368 #undef INSTALL_NATIVE | 1398 #undef INSTALL_NATIVE |
1369 | 1399 |
1370 | 1400 |
1371 bool Genesis::InstallNatives() { | 1401 bool Genesis::InstallNatives() { |
1372 HandleScope scope; | 1402 HandleScope scope; |
1373 | 1403 |
1374 // Create a function for the builtins object. Allocate space for the | 1404 // Create a function for the builtins object. Allocate space for the |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 | 1719 |
1690 // Update map with length accessor from Array and add "index" and "input". | 1720 // Update map with length accessor from Array and add "index" and "input". |
1691 Handle<Map> array_map(global_context()->js_array_map()); | 1721 Handle<Map> array_map(global_context()->js_array_map()); |
1692 Handle<DescriptorArray> array_descriptors( | 1722 Handle<DescriptorArray> array_descriptors( |
1693 array_map->instance_descriptors()); | 1723 array_map->instance_descriptors()); |
1694 ASSERT_EQ(1, array_descriptors->number_of_descriptors()); | 1724 ASSERT_EQ(1, array_descriptors->number_of_descriptors()); |
1695 | 1725 |
1696 Handle<DescriptorArray> reresult_descriptors = | 1726 Handle<DescriptorArray> reresult_descriptors = |
1697 factory()->NewDescriptorArray(3); | 1727 factory()->NewDescriptorArray(3); |
1698 | 1728 |
1699 reresult_descriptors->CopyFrom(0, *array_descriptors, 0); | 1729 DescriptorArray::WhitenessWitness witness(*reresult_descriptors); |
| 1730 |
| 1731 reresult_descriptors->CopyFrom(0, *array_descriptors, 0, witness); |
1700 | 1732 |
1701 int enum_index = 0; | 1733 int enum_index = 0; |
1702 { | 1734 { |
1703 FieldDescriptor index_field(heap()->index_symbol(), | 1735 FieldDescriptor index_field(heap()->index_symbol(), |
1704 JSRegExpResult::kIndexIndex, | 1736 JSRegExpResult::kIndexIndex, |
1705 NONE, | 1737 NONE, |
1706 enum_index++); | 1738 enum_index++); |
1707 reresult_descriptors->Set(1, &index_field); | 1739 reresult_descriptors->Set(1, &index_field, witness); |
1708 } | 1740 } |
1709 | 1741 |
1710 { | 1742 { |
1711 FieldDescriptor input_field(heap()->input_symbol(), | 1743 FieldDescriptor input_field(heap()->input_symbol(), |
1712 JSRegExpResult::kInputIndex, | 1744 JSRegExpResult::kInputIndex, |
1713 NONE, | 1745 NONE, |
1714 enum_index++); | 1746 enum_index++); |
1715 reresult_descriptors->Set(2, &input_field); | 1747 reresult_descriptors->Set(2, &input_field, witness); |
1716 } | 1748 } |
1717 reresult_descriptors->Sort(); | 1749 reresult_descriptors->Sort(witness); |
1718 | 1750 |
1719 initial_map->set_inobject_properties(2); | 1751 initial_map->set_inobject_properties(2); |
1720 initial_map->set_pre_allocated_property_fields(2); | 1752 initial_map->set_pre_allocated_property_fields(2); |
1721 initial_map->set_unused_property_fields(0); | 1753 initial_map->set_unused_property_fields(0); |
1722 initial_map->set_instance_descriptors(*reresult_descriptors); | 1754 initial_map->set_instance_descriptors(*reresult_descriptors); |
1723 | 1755 |
1724 global_context()->set_regexp_result_map(*initial_map); | 1756 global_context()->set_regexp_result_map(*initial_map); |
1725 } | 1757 } |
1726 | 1758 |
1727 #ifdef DEBUG | 1759 #ifdef DEBUG |
1728 builtins->Verify(); | 1760 builtins->Verify(); |
1729 #endif | 1761 #endif |
1730 | 1762 |
1731 return true; | 1763 return true; |
1732 } | 1764 } |
1733 | 1765 |
1734 | 1766 |
1735 bool Genesis::InstallExperimentalNatives() { | 1767 bool Genesis::InstallExperimentalNatives() { |
1736 for (int i = ExperimentalNatives::GetDebuggerCount(); | 1768 for (int i = ExperimentalNatives::GetDebuggerCount(); |
1737 i < ExperimentalNatives::GetBuiltinsCount(); | 1769 i < ExperimentalNatives::GetBuiltinsCount(); |
1738 i++) { | 1770 i++) { |
1739 if (FLAG_harmony_proxies && | 1771 if (FLAG_harmony_proxies && |
1740 strcmp(ExperimentalNatives::GetScriptName(i).start(), | 1772 strcmp(ExperimentalNatives::GetScriptName(i).start(), |
1741 "native proxy.js") == 0) { | 1773 "native proxy.js") == 0) { |
1742 if (!CompileExperimentalBuiltin(isolate(), i)) return false; | 1774 if (!CompileExperimentalBuiltin(isolate(), i)) return false; |
1743 } | 1775 } |
1744 if (FLAG_harmony_weakmaps && | 1776 if (FLAG_harmony_collections && |
1745 strcmp(ExperimentalNatives::GetScriptName(i).start(), | 1777 strcmp(ExperimentalNatives::GetScriptName(i).start(), |
1746 "native weakmap.js") == 0) { | 1778 "native collection.js") == 0) { |
1747 if (!CompileExperimentalBuiltin(isolate(), i)) return false; | 1779 if (!CompileExperimentalBuiltin(isolate(), i)) return false; |
1748 } | 1780 } |
1749 } | 1781 } |
1750 | 1782 |
1751 InstallExperimentalNativeFunctions(); | 1783 InstallExperimentalNativeFunctions(); |
1752 | 1784 |
1753 return true; | 1785 return true; |
1754 } | 1786 } |
1755 | 1787 |
1756 | 1788 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 isolate->factory()->NewExternalStringFromAscii(extension->source()); | 2014 isolate->factory()->NewExternalStringFromAscii(extension->source()); |
1983 bool result = CompileScriptCached( | 2015 bool result = CompileScriptCached( |
1984 CStrVector(extension->name()), | 2016 CStrVector(extension->name()), |
1985 source_code, | 2017 source_code, |
1986 isolate->bootstrapper()->extensions_cache(), | 2018 isolate->bootstrapper()->extensions_cache(), |
1987 extension, | 2019 extension, |
1988 Handle<Context>(isolate->context()), | 2020 Handle<Context>(isolate->context()), |
1989 false); | 2021 false); |
1990 ASSERT(isolate->has_pending_exception() != result); | 2022 ASSERT(isolate->has_pending_exception() != result); |
1991 if (!result) { | 2023 if (!result) { |
| 2024 // We print out the name of the extension that fail to install. |
| 2025 // When an error is thrown during bootstrapping we automatically print |
| 2026 // the line number at which this happened to the console in the isolate |
| 2027 // error throwing functionality. |
| 2028 OS::PrintError("Error installing extension '%s'.\n", |
| 2029 current->extension()->name()); |
1992 isolate->clear_pending_exception(); | 2030 isolate->clear_pending_exception(); |
1993 } | 2031 } |
1994 current->set_state(v8::INSTALLED); | 2032 current->set_state(v8::INSTALLED); |
1995 return result; | 2033 return result; |
1996 } | 2034 } |
1997 | 2035 |
1998 | 2036 |
1999 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) { | 2037 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) { |
2000 HandleScope scope; | 2038 HandleScope scope; |
2001 Factory* factory = builtins->GetIsolate()->factory(); | 2039 Factory* factory = builtins->GetIsolate()->factory(); |
2002 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { | 2040 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { |
2003 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); | 2041 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); |
2004 Handle<String> name = factory->LookupAsciiSymbol(Builtins::GetName(id)); | 2042 Handle<String> name = factory->LookupAsciiSymbol(Builtins::GetName(id)); |
2005 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name); | 2043 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name); |
2006 Handle<JSFunction> function | 2044 Handle<JSFunction> function |
2007 = Handle<JSFunction>(JSFunction::cast(function_object)); | 2045 = Handle<JSFunction>(JSFunction::cast(function_object)); |
2008 builtins->set_javascript_builtin(id, *function); | 2046 builtins->set_javascript_builtin(id, *function); |
2009 Handle<SharedFunctionInfo> shared | 2047 Handle<SharedFunctionInfo> shared |
2010 = Handle<SharedFunctionInfo>(function->shared()); | 2048 = Handle<SharedFunctionInfo>(function->shared()); |
2011 if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false; | 2049 if (!SharedFunctionInfo::EnsureCompiled(shared, CLEAR_EXCEPTION)) { |
| 2050 return false; |
| 2051 } |
2012 // Set the code object on the function object. | 2052 // Set the code object on the function object. |
2013 function->ReplaceCode(function->shared()->code()); | 2053 function->ReplaceCode(function->shared()->code()); |
2014 builtins->set_javascript_builtin_code(id, shared->code()); | 2054 builtins->set_javascript_builtin_code(id, shared->code()); |
2015 } | 2055 } |
2016 return true; | 2056 return true; |
2017 } | 2057 } |
2018 | 2058 |
2019 | 2059 |
2020 bool Genesis::ConfigureGlobalObjects( | 2060 bool Genesis::ConfigureGlobalObjects( |
2021 v8::Handle<v8::ObjectTemplate> global_proxy_template) { | 2061 v8::Handle<v8::ObjectTemplate> global_proxy_template) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 } | 2121 } |
2082 case CONSTANT_FUNCTION: { | 2122 case CONSTANT_FUNCTION: { |
2083 HandleScope inner; | 2123 HandleScope inner; |
2084 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2124 Handle<String> key = Handle<String>(descs->GetKey(i)); |
2085 Handle<JSFunction> fun = | 2125 Handle<JSFunction> fun = |
2086 Handle<JSFunction>(descs->GetConstantFunction(i)); | 2126 Handle<JSFunction>(descs->GetConstantFunction(i)); |
2087 SetLocalPropertyNoThrow(to, key, fun, details.attributes()); | 2127 SetLocalPropertyNoThrow(to, key, fun, details.attributes()); |
2088 break; | 2128 break; |
2089 } | 2129 } |
2090 case CALLBACKS: { | 2130 case CALLBACKS: { |
2091 LookupResult result; | 2131 LookupResult result(isolate()); |
2092 to->LocalLookup(descs->GetKey(i), &result); | 2132 to->LocalLookup(descs->GetKey(i), &result); |
2093 // If the property is already there we skip it | 2133 // If the property is already there we skip it |
2094 if (result.IsProperty()) continue; | 2134 if (result.IsProperty()) continue; |
2095 HandleScope inner; | 2135 HandleScope inner; |
2096 ASSERT(!to->HasFastProperties()); | 2136 ASSERT(!to->HasFastProperties()); |
2097 // Add to dictionary. | 2137 // Add to dictionary. |
2098 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2138 Handle<String> key = Handle<String>(descs->GetKey(i)); |
2099 Handle<Object> callbacks(descs->GetCallbacksObject(i)); | 2139 Handle<Object> callbacks(descs->GetCallbacksObject(i)); |
2100 PropertyDetails d = | 2140 PropertyDetails d = |
2101 PropertyDetails(details.attributes(), CALLBACKS, details.index()); | 2141 PropertyDetails(details.attributes(), CALLBACKS, details.index()); |
(...skipping 17 matching lines...) Expand all Loading... |
2119 } | 2159 } |
2120 } else { | 2160 } else { |
2121 Handle<StringDictionary> properties = | 2161 Handle<StringDictionary> properties = |
2122 Handle<StringDictionary>(from->property_dictionary()); | 2162 Handle<StringDictionary>(from->property_dictionary()); |
2123 int capacity = properties->Capacity(); | 2163 int capacity = properties->Capacity(); |
2124 for (int i = 0; i < capacity; i++) { | 2164 for (int i = 0; i < capacity; i++) { |
2125 Object* raw_key(properties->KeyAt(i)); | 2165 Object* raw_key(properties->KeyAt(i)); |
2126 if (properties->IsKey(raw_key)) { | 2166 if (properties->IsKey(raw_key)) { |
2127 ASSERT(raw_key->IsString()); | 2167 ASSERT(raw_key->IsString()); |
2128 // If the property is already there we skip it. | 2168 // If the property is already there we skip it. |
2129 LookupResult result; | 2169 LookupResult result(isolate()); |
2130 to->LocalLookup(String::cast(raw_key), &result); | 2170 to->LocalLookup(String::cast(raw_key), &result); |
2131 if (result.IsProperty()) continue; | 2171 if (result.IsProperty()) continue; |
2132 // Set the property. | 2172 // Set the property. |
2133 Handle<String> key = Handle<String>(String::cast(raw_key)); | 2173 Handle<String> key = Handle<String>(String::cast(raw_key)); |
2134 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); | 2174 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); |
2135 if (value->IsJSGlobalPropertyCell()) { | 2175 if (value->IsJSGlobalPropertyCell()) { |
2136 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value()); | 2176 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value()); |
2137 } | 2177 } |
2138 PropertyDetails details = properties->DetailsAt(i); | 2178 PropertyDetails details = properties->DetailsAt(i); |
2139 SetLocalPropertyNoThrow(to, key, value, details.attributes()); | 2179 SetLocalPropertyNoThrow(to, key, value, details.attributes()); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 return from + sizeof(NestingCounterType); | 2306 return from + sizeof(NestingCounterType); |
2267 } | 2307 } |
2268 | 2308 |
2269 | 2309 |
2270 // Called when the top-level V8 mutex is destroyed. | 2310 // Called when the top-level V8 mutex is destroyed. |
2271 void Bootstrapper::FreeThreadResources() { | 2311 void Bootstrapper::FreeThreadResources() { |
2272 ASSERT(!IsActive()); | 2312 ASSERT(!IsActive()); |
2273 } | 2313 } |
2274 | 2314 |
2275 } } // namespace v8::internal | 2315 } } // namespace v8::internal |
OLD | NEW |