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

Side by Side Diff: src/objects.cc

Issue 236343005: Revert "Handlify Runtime::InitializeIntrinsicFunctionNames." (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 | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 if (object->IsGlobalObject()) { 626 if (object->IsGlobalObject()) {
627 Handle<PropertyCell> cell(PropertyCell::cast( 627 Handle<PropertyCell> cell(PropertyCell::cast(
628 property_dictionary->ValueAt(result->GetDictionaryEntry()))); 628 property_dictionary->ValueAt(result->GetDictionaryEntry())));
629 PropertyCell::SetValueInferType(cell, value); 629 PropertyCell::SetValueInferType(cell, value);
630 } else { 630 } else {
631 property_dictionary->ValueAtPut(result->GetDictionaryEntry(), *value); 631 property_dictionary->ValueAtPut(result->GetDictionaryEntry(), *value);
632 } 632 }
633 } 633 }
634 634
635 635
636 // TODO(mstarzinger): Temporary wrapper until handlified.
637 static Handle<NameDictionary> NameDictionaryAdd(Handle<NameDictionary> dict,
638 Handle<Name> name,
639 Handle<Object> value,
640 PropertyDetails details) {
641 CALL_HEAP_FUNCTION(dict->GetIsolate(),
642 dict->Add(*name, *value, details),
643 NameDictionary);
644 }
645
646
636 void JSObject::SetNormalizedProperty(Handle<JSObject> object, 647 void JSObject::SetNormalizedProperty(Handle<JSObject> object,
637 Handle<Name> name, 648 Handle<Name> name,
638 Handle<Object> value, 649 Handle<Object> value,
639 PropertyDetails details) { 650 PropertyDetails details) {
640 ASSERT(!object->HasFastProperties()); 651 ASSERT(!object->HasFastProperties());
641 Handle<NameDictionary> property_dictionary(object->property_dictionary()); 652 Handle<NameDictionary> property_dictionary(object->property_dictionary());
642 653
643 if (!name->IsUniqueName()) { 654 if (!name->IsUniqueName()) {
644 name = object->GetIsolate()->factory()->InternalizeString( 655 name = object->GetIsolate()->factory()->InternalizeString(
645 Handle<String>::cast(name)); 656 Handle<String>::cast(name));
646 } 657 }
647 658
648 int entry = property_dictionary->FindEntry(*name); 659 int entry = property_dictionary->FindEntry(*name);
649 if (entry == NameDictionary::kNotFound) { 660 if (entry == NameDictionary::kNotFound) {
650 Handle<Object> store_value = value; 661 Handle<Object> store_value = value;
651 if (object->IsGlobalObject()) { 662 if (object->IsGlobalObject()) {
652 store_value = object->GetIsolate()->factory()->NewPropertyCell(value); 663 store_value = object->GetIsolate()->factory()->NewPropertyCell(value);
653 } 664 }
654 665
655 property_dictionary = 666 property_dictionary =
656 NameDictionary::Add(property_dictionary, name, store_value, details); 667 NameDictionaryAdd(property_dictionary, name, store_value, details);
657 object->set_properties(*property_dictionary); 668 object->set_properties(*property_dictionary);
658 return; 669 return;
659 } 670 }
660 671
661 PropertyDetails original_details = property_dictionary->DetailsAt(entry); 672 PropertyDetails original_details = property_dictionary->DetailsAt(entry);
662 int enumeration_index; 673 int enumeration_index;
663 // Preserve the enumeration index unless the property was deleted. 674 // Preserve the enumeration index unless the property was deleted.
664 if (original_details.IsDeleted()) { 675 if (original_details.IsDeleted()) {
665 enumeration_index = property_dictionary->NextEnumerationIndex(); 676 enumeration_index = property_dictionary->NextEnumerationIndex();
666 property_dictionary->SetNextEnumerationIndex(enumeration_index + 1); 677 property_dictionary->SetNextEnumerationIndex(enumeration_index + 1);
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 PropertyDetails details = PropertyDetails(attributes, NORMAL, index); 1937 PropertyDetails details = PropertyDetails(attributes, NORMAL, index);
1927 dict->SetNextEnumerationIndex(index + 1); 1938 dict->SetNextEnumerationIndex(index + 1);
1928 dict->SetEntry(entry, *name, *cell, details); 1939 dict->SetEntry(entry, *name, *cell, details);
1929 return; 1940 return;
1930 } 1941 }
1931 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value); 1942 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value);
1932 PropertyCell::SetValueInferType(cell, value); 1943 PropertyCell::SetValueInferType(cell, value);
1933 value = cell; 1944 value = cell;
1934 } 1945 }
1935 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); 1946 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0);
1936 Handle<NameDictionary> result = 1947 Handle<NameDictionary> result = NameDictionaryAdd(dict, name, value, details);
1937 NameDictionary::Add(dict, name, value, details);
1938 if (*dict != *result) object->set_properties(*result); 1948 if (*dict != *result) object->set_properties(*result);
1939 } 1949 }
1940 1950
1941 1951
1942 MaybeHandle<Object> JSObject::AddProperty( 1952 MaybeHandle<Object> JSObject::AddProperty(
1943 Handle<JSObject> object, 1953 Handle<JSObject> object,
1944 Handle<Name> name, 1954 Handle<Name> name,
1945 Handle<Object> value, 1955 Handle<Object> value,
1946 PropertyAttributes attributes, 1956 PropertyAttributes attributes,
1947 StrictMode strict_mode, 1957 StrictMode strict_mode,
(...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after
4486 4496
4487 Handle<DescriptorArray> descs(map->instance_descriptors()); 4497 Handle<DescriptorArray> descs(map->instance_descriptors());
4488 for (int i = 0; i < real_size; i++) { 4498 for (int i = 0; i < real_size; i++) {
4489 PropertyDetails details = descs->GetDetails(i); 4499 PropertyDetails details = descs->GetDetails(i);
4490 switch (details.type()) { 4500 switch (details.type()) {
4491 case CONSTANT: { 4501 case CONSTANT: {
4492 Handle<Name> key(descs->GetKey(i)); 4502 Handle<Name> key(descs->GetKey(i));
4493 Handle<Object> value(descs->GetConstant(i), isolate); 4503 Handle<Object> value(descs->GetConstant(i), isolate);
4494 PropertyDetails d = PropertyDetails( 4504 PropertyDetails d = PropertyDetails(
4495 details.attributes(), NORMAL, i + 1); 4505 details.attributes(), NORMAL, i + 1);
4496 dictionary = NameDictionary::Add(dictionary, key, value, d); 4506 dictionary = NameDictionaryAdd(dictionary, key, value, d);
4497 break; 4507 break;
4498 } 4508 }
4499 case FIELD: { 4509 case FIELD: {
4500 Handle<Name> key(descs->GetKey(i)); 4510 Handle<Name> key(descs->GetKey(i));
4501 Handle<Object> value( 4511 Handle<Object> value(
4502 object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate); 4512 object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate);
4503 PropertyDetails d = 4513 PropertyDetails d =
4504 PropertyDetails(details.attributes(), NORMAL, i + 1); 4514 PropertyDetails(details.attributes(), NORMAL, i + 1);
4505 dictionary = NameDictionary::Add(dictionary, key, value, d); 4515 dictionary = NameDictionaryAdd(dictionary, key, value, d);
4506 break; 4516 break;
4507 } 4517 }
4508 case CALLBACKS: { 4518 case CALLBACKS: {
4509 Handle<Name> key(descs->GetKey(i)); 4519 Handle<Name> key(descs->GetKey(i));
4510 Handle<Object> value(descs->GetCallbacksObject(i), isolate); 4520 Handle<Object> value(descs->GetCallbacksObject(i), isolate);
4511 PropertyDetails d = PropertyDetails( 4521 PropertyDetails d = PropertyDetails(
4512 details.attributes(), CALLBACKS, i + 1); 4522 details.attributes(), CALLBACKS, i + 1);
4513 dictionary = NameDictionary::Add(dictionary, key, value, d); 4523 dictionary = NameDictionaryAdd(dictionary, key, value, d);
4514 break; 4524 break;
4515 } 4525 }
4516 case INTERCEPTOR: 4526 case INTERCEPTOR:
4517 break; 4527 break;
4518 case HANDLER: 4528 case HANDLER:
4519 case NORMAL: 4529 case NORMAL:
4520 case NONEXISTENT: 4530 case NONEXISTENT:
4521 UNREACHABLE(); 4531 UNREACHABLE();
4522 break; 4532 break;
4523 } 4533 }
(...skipping 9767 matching lines...) Expand 10 before | Expand all | Expand 10 after
14291 template 14301 template
14292 int Dictionary<SeededNumberDictionaryShape, uint32_t>::NumberOfEnumElements(); 14302 int Dictionary<SeededNumberDictionaryShape, uint32_t>::NumberOfEnumElements();
14293 14303
14294 template 14304 template
14295 int Dictionary<NameDictionaryShape, Name*>::NumberOfEnumElements(); 14305 int Dictionary<NameDictionaryShape, Name*>::NumberOfEnumElements();
14296 14306
14297 template 14307 template
14298 int HashTable<SeededNumberDictionaryShape, uint32_t>::FindEntry(uint32_t); 14308 int HashTable<SeededNumberDictionaryShape, uint32_t>::FindEntry(uint32_t);
14299 14309
14300 14310
14301 Handle<NameDictionary> NameDictionary::Add(Handle<NameDictionary> dict,
14302 Handle<Name> name,
14303 Handle<Object> value,
14304 PropertyDetails details) {
14305 CALL_HEAP_FUNCTION(dict->GetIsolate(),
14306 Handle<Dictionary>::cast(dict)->Add(
14307 *name, *value, details),
14308 NameDictionary);
14309 }
14310
14311
14312 Handle<Object> JSObject::PrepareSlowElementsForSort( 14311 Handle<Object> JSObject::PrepareSlowElementsForSort(
14313 Handle<JSObject> object, uint32_t limit) { 14312 Handle<JSObject> object, uint32_t limit) {
14314 CALL_HEAP_FUNCTION(object->GetIsolate(), 14313 CALL_HEAP_FUNCTION(object->GetIsolate(),
14315 object->PrepareSlowElementsForSort(limit), 14314 object->PrepareSlowElementsForSort(limit),
14316 Object); 14315 Object);
14317 } 14316 }
14318 14317
14319 14318
14320 // Collates undefined and unexisting elements below limit from position 14319 // Collates undefined and unexisting elements below limit from position
14321 // zero of the elements. The object stays in Dictionary mode. 14320 // zero of the elements. The object stays in Dictionary mode.
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
14833 Handle<JSGlobalObject> global, 14832 Handle<JSGlobalObject> global,
14834 Handle<Name> name) { 14833 Handle<Name> name) {
14835 ASSERT(!global->HasFastProperties()); 14834 ASSERT(!global->HasFastProperties());
14836 int entry = global->property_dictionary()->FindEntry(*name); 14835 int entry = global->property_dictionary()->FindEntry(*name);
14837 if (entry == NameDictionary::kNotFound) { 14836 if (entry == NameDictionary::kNotFound) {
14838 Isolate* isolate = global->GetIsolate(); 14837 Isolate* isolate = global->GetIsolate();
14839 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell( 14838 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(
14840 isolate->factory()->the_hole_value()); 14839 isolate->factory()->the_hole_value());
14841 PropertyDetails details(NONE, NORMAL, 0); 14840 PropertyDetails details(NONE, NORMAL, 0);
14842 details = details.AsDeleted(); 14841 details = details.AsDeleted();
14843 Handle<NameDictionary> dictionary = NameDictionary::Add( 14842 Handle<NameDictionary> dictionary = NameDictionaryAdd(
14844 handle(global->property_dictionary()), name, cell, details); 14843 handle(global->property_dictionary()), name, cell, details);
14845 global->set_properties(*dictionary); 14844 global->set_properties(*dictionary);
14846 return cell; 14845 return cell;
14847 } else { 14846 } else {
14848 Object* value = global->property_dictionary()->ValueAt(entry); 14847 Object* value = global->property_dictionary()->ValueAt(entry);
14849 ASSERT(value->IsPropertyCell()); 14848 ASSERT(value->IsPropertyCell());
14850 return handle(PropertyCell::cast(value)); 14849 return handle(PropertyCell::cast(value));
14851 } 14850 }
14852 } 14851 }
14853 14852
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
16500 #define ERROR_MESSAGES_TEXTS(C, T) T, 16499 #define ERROR_MESSAGES_TEXTS(C, T) T,
16501 static const char* error_messages_[] = { 16500 static const char* error_messages_[] = {
16502 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16501 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16503 }; 16502 };
16504 #undef ERROR_MESSAGES_TEXTS 16503 #undef ERROR_MESSAGES_TEXTS
16505 return error_messages_[reason]; 16504 return error_messages_[reason];
16506 } 16505 }
16507 16506
16508 16507
16509 } } // namespace v8::internal 16508 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698