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

Side by Side Diff: src/objects.cc

Issue 236823003: Reland "Handlify Runtime::InitializeIntrinsicFunctionNames." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 if (object->IsGlobalObject()) { 622 if (object->IsGlobalObject()) {
623 Handle<PropertyCell> cell(PropertyCell::cast( 623 Handle<PropertyCell> cell(PropertyCell::cast(
624 property_dictionary->ValueAt(result->GetDictionaryEntry()))); 624 property_dictionary->ValueAt(result->GetDictionaryEntry())));
625 PropertyCell::SetValueInferType(cell, value); 625 PropertyCell::SetValueInferType(cell, value);
626 } else { 626 } else {
627 property_dictionary->ValueAtPut(result->GetDictionaryEntry(), *value); 627 property_dictionary->ValueAtPut(result->GetDictionaryEntry(), *value);
628 } 628 }
629 } 629 }
630 630
631 631
632 // TODO(mstarzinger): Temporary wrapper until handlified.
633 static Handle<NameDictionary> NameDictionaryAdd(Handle<NameDictionary> dict,
634 Handle<Name> name,
635 Handle<Object> value,
636 PropertyDetails details) {
637 CALL_HEAP_FUNCTION(dict->GetIsolate(),
638 dict->Add(*name, *value, details),
639 NameDictionary);
640 }
641
642
643 void JSObject::SetNormalizedProperty(Handle<JSObject> object, 632 void JSObject::SetNormalizedProperty(Handle<JSObject> object,
644 Handle<Name> name, 633 Handle<Name> name,
645 Handle<Object> value, 634 Handle<Object> value,
646 PropertyDetails details) { 635 PropertyDetails details) {
647 ASSERT(!object->HasFastProperties()); 636 ASSERT(!object->HasFastProperties());
648 Handle<NameDictionary> property_dictionary(object->property_dictionary()); 637 Handle<NameDictionary> property_dictionary(object->property_dictionary());
649 638
650 if (!name->IsUniqueName()) { 639 if (!name->IsUniqueName()) {
651 name = object->GetIsolate()->factory()->InternalizeString( 640 name = object->GetIsolate()->factory()->InternalizeString(
652 Handle<String>::cast(name)); 641 Handle<String>::cast(name));
653 } 642 }
654 643
655 int entry = property_dictionary->FindEntry(*name); 644 int entry = property_dictionary->FindEntry(*name);
656 if (entry == NameDictionary::kNotFound) { 645 if (entry == NameDictionary::kNotFound) {
657 Handle<Object> store_value = value; 646 Handle<Object> store_value = value;
658 if (object->IsGlobalObject()) { 647 if (object->IsGlobalObject()) {
659 store_value = object->GetIsolate()->factory()->NewPropertyCell(value); 648 store_value = object->GetIsolate()->factory()->NewPropertyCell(value);
660 } 649 }
661 650
662 property_dictionary = 651 property_dictionary = NameDictionary::AddNameEntry(
663 NameDictionaryAdd(property_dictionary, name, store_value, details); 652 property_dictionary, name, store_value, details);
664 object->set_properties(*property_dictionary); 653 object->set_properties(*property_dictionary);
665 return; 654 return;
666 } 655 }
667 656
668 PropertyDetails original_details = property_dictionary->DetailsAt(entry); 657 PropertyDetails original_details = property_dictionary->DetailsAt(entry);
669 int enumeration_index; 658 int enumeration_index;
670 // Preserve the enumeration index unless the property was deleted. 659 // Preserve the enumeration index unless the property was deleted.
671 if (original_details.IsDeleted()) { 660 if (original_details.IsDeleted()) {
672 enumeration_index = property_dictionary->NextEnumerationIndex(); 661 enumeration_index = property_dictionary->NextEnumerationIndex();
673 property_dictionary->SetNextEnumerationIndex(enumeration_index + 1); 662 property_dictionary->SetNextEnumerationIndex(enumeration_index + 1);
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 PropertyDetails details = PropertyDetails(attributes, NORMAL, index); 1922 PropertyDetails details = PropertyDetails(attributes, NORMAL, index);
1934 dict->SetNextEnumerationIndex(index + 1); 1923 dict->SetNextEnumerationIndex(index + 1);
1935 dict->SetEntry(entry, *name, *cell, details); 1924 dict->SetEntry(entry, *name, *cell, details);
1936 return; 1925 return;
1937 } 1926 }
1938 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value); 1927 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value);
1939 PropertyCell::SetValueInferType(cell, value); 1928 PropertyCell::SetValueInferType(cell, value);
1940 value = cell; 1929 value = cell;
1941 } 1930 }
1942 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); 1931 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0);
1943 Handle<NameDictionary> result = NameDictionaryAdd(dict, name, value, details); 1932 Handle<NameDictionary> result =
1933 NameDictionary::AddNameEntry(dict, name, value, details);
1944 if (*dict != *result) object->set_properties(*result); 1934 if (*dict != *result) object->set_properties(*result);
1945 } 1935 }
1946 1936
1947 1937
1948 MaybeHandle<Object> JSObject::AddProperty( 1938 MaybeHandle<Object> JSObject::AddProperty(
1949 Handle<JSObject> object, 1939 Handle<JSObject> object,
1950 Handle<Name> name, 1940 Handle<Name> name,
1951 Handle<Object> value, 1941 Handle<Object> value,
1952 PropertyAttributes attributes, 1942 PropertyAttributes attributes,
1953 StrictMode strict_mode, 1943 StrictMode strict_mode,
(...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after
4492 4482
4493 Handle<DescriptorArray> descs(map->instance_descriptors()); 4483 Handle<DescriptorArray> descs(map->instance_descriptors());
4494 for (int i = 0; i < real_size; i++) { 4484 for (int i = 0; i < real_size; i++) {
4495 PropertyDetails details = descs->GetDetails(i); 4485 PropertyDetails details = descs->GetDetails(i);
4496 switch (details.type()) { 4486 switch (details.type()) {
4497 case CONSTANT: { 4487 case CONSTANT: {
4498 Handle<Name> key(descs->GetKey(i)); 4488 Handle<Name> key(descs->GetKey(i));
4499 Handle<Object> value(descs->GetConstant(i), isolate); 4489 Handle<Object> value(descs->GetConstant(i), isolate);
4500 PropertyDetails d = PropertyDetails( 4490 PropertyDetails d = PropertyDetails(
4501 details.attributes(), NORMAL, i + 1); 4491 details.attributes(), NORMAL, i + 1);
4502 dictionary = NameDictionaryAdd(dictionary, key, value, d); 4492 dictionary = NameDictionary::AddNameEntry(dictionary, key, value, d);
4503 break; 4493 break;
4504 } 4494 }
4505 case FIELD: { 4495 case FIELD: {
4506 Handle<Name> key(descs->GetKey(i)); 4496 Handle<Name> key(descs->GetKey(i));
4507 Handle<Object> value( 4497 Handle<Object> value(
4508 object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate); 4498 object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate);
4509 PropertyDetails d = 4499 PropertyDetails d =
4510 PropertyDetails(details.attributes(), NORMAL, i + 1); 4500 PropertyDetails(details.attributes(), NORMAL, i + 1);
4511 dictionary = NameDictionaryAdd(dictionary, key, value, d); 4501 dictionary = NameDictionary::AddNameEntry(dictionary, key, value, d);
4512 break; 4502 break;
4513 } 4503 }
4514 case CALLBACKS: { 4504 case CALLBACKS: {
4515 Handle<Name> key(descs->GetKey(i)); 4505 Handle<Name> key(descs->GetKey(i));
4516 Handle<Object> value(descs->GetCallbacksObject(i), isolate); 4506 Handle<Object> value(descs->GetCallbacksObject(i), isolate);
4517 PropertyDetails d = PropertyDetails( 4507 PropertyDetails d = PropertyDetails(
4518 details.attributes(), CALLBACKS, i + 1); 4508 details.attributes(), CALLBACKS, i + 1);
4519 dictionary = NameDictionaryAdd(dictionary, key, value, d); 4509 dictionary = NameDictionary::AddNameEntry(dictionary, key, value, d);
4520 break; 4510 break;
4521 } 4511 }
4522 case INTERCEPTOR: 4512 case INTERCEPTOR:
4523 break; 4513 break;
4524 case HANDLER: 4514 case HANDLER:
4525 case NORMAL: 4515 case NORMAL:
4526 case NONEXISTENT: 4516 case NONEXISTENT:
4527 UNREACHABLE(); 4517 UNREACHABLE();
4528 break; 4518 break;
4529 } 4519 }
(...skipping 9754 matching lines...) Expand 10 before | Expand all | Expand 10 after
14284 template 14274 template
14285 int Dictionary<SeededNumberDictionaryShape, uint32_t>::NumberOfEnumElements(); 14275 int Dictionary<SeededNumberDictionaryShape, uint32_t>::NumberOfEnumElements();
14286 14276
14287 template 14277 template
14288 int Dictionary<NameDictionaryShape, Name*>::NumberOfEnumElements(); 14278 int Dictionary<NameDictionaryShape, Name*>::NumberOfEnumElements();
14289 14279
14290 template 14280 template
14291 int HashTable<SeededNumberDictionaryShape, uint32_t>::FindEntry(uint32_t); 14281 int HashTable<SeededNumberDictionaryShape, uint32_t>::FindEntry(uint32_t);
14292 14282
14293 14283
14284 Handle<NameDictionary> NameDictionary::AddNameEntry(Handle<NameDictionary> dict,
14285 Handle<Name> name,
14286 Handle<Object> value,
14287 PropertyDetails details) {
14288 CALL_HEAP_FUNCTION(dict->GetIsolate(),
14289 dict->Add(*name, *value, details),
14290 NameDictionary);
14291 }
14292
14293
14294 Handle<Object> JSObject::PrepareSlowElementsForSort( 14294 Handle<Object> JSObject::PrepareSlowElementsForSort(
14295 Handle<JSObject> object, uint32_t limit) { 14295 Handle<JSObject> object, uint32_t limit) {
14296 CALL_HEAP_FUNCTION(object->GetIsolate(), 14296 CALL_HEAP_FUNCTION(object->GetIsolate(),
14297 object->PrepareSlowElementsForSort(limit), 14297 object->PrepareSlowElementsForSort(limit),
14298 Object); 14298 Object);
14299 } 14299 }
14300 14300
14301 14301
14302 // Collates undefined and unexisting elements below limit from position 14302 // Collates undefined and unexisting elements below limit from position
14303 // zero of the elements. The object stays in Dictionary mode. 14303 // zero of the elements. The object stays in Dictionary mode.
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
14815 Handle<JSGlobalObject> global, 14815 Handle<JSGlobalObject> global,
14816 Handle<Name> name) { 14816 Handle<Name> name) {
14817 ASSERT(!global->HasFastProperties()); 14817 ASSERT(!global->HasFastProperties());
14818 int entry = global->property_dictionary()->FindEntry(*name); 14818 int entry = global->property_dictionary()->FindEntry(*name);
14819 if (entry == NameDictionary::kNotFound) { 14819 if (entry == NameDictionary::kNotFound) {
14820 Isolate* isolate = global->GetIsolate(); 14820 Isolate* isolate = global->GetIsolate();
14821 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell( 14821 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(
14822 isolate->factory()->the_hole_value()); 14822 isolate->factory()->the_hole_value());
14823 PropertyDetails details(NONE, NORMAL, 0); 14823 PropertyDetails details(NONE, NORMAL, 0);
14824 details = details.AsDeleted(); 14824 details = details.AsDeleted();
14825 Handle<NameDictionary> dictionary = NameDictionaryAdd( 14825 Handle<NameDictionary> dictionary = NameDictionary::AddNameEntry(
14826 handle(global->property_dictionary()), name, cell, details); 14826 handle(global->property_dictionary()), name, cell, details);
14827 global->set_properties(*dictionary); 14827 global->set_properties(*dictionary);
14828 return cell; 14828 return cell;
14829 } else { 14829 } else {
14830 Object* value = global->property_dictionary()->ValueAt(entry); 14830 Object* value = global->property_dictionary()->ValueAt(entry);
14831 ASSERT(value->IsPropertyCell()); 14831 ASSERT(value->IsPropertyCell());
14832 return handle(PropertyCell::cast(value)); 14832 return handle(PropertyCell::cast(value));
14833 } 14833 }
14834 } 14834 }
14835 14835
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
16482 #define ERROR_MESSAGES_TEXTS(C, T) T, 16482 #define ERROR_MESSAGES_TEXTS(C, T) T,
16483 static const char* error_messages_[] = { 16483 static const char* error_messages_[] = {
16484 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16484 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16485 }; 16485 };
16486 #undef ERROR_MESSAGES_TEXTS 16486 #undef ERROR_MESSAGES_TEXTS
16487 return error_messages_[reason]; 16487 return error_messages_[reason];
16488 } 16488 }
16489 16489
16490 16490
16491 } } // namespace v8::internal 16491 } } // 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