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

Side by Side Diff: src/objects.cc

Issue 173963002: Remove all uses of field-tracking flags that do not make decisions but are subject to existing info… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More flags removed Created 6 years, 9 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/json-parser.h ('k') | src/objects-inl.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 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 2346
2347 bool Map::InstancesNeedRewriting(Map* target, 2347 bool Map::InstancesNeedRewriting(Map* target,
2348 int target_number_of_fields, 2348 int target_number_of_fields,
2349 int target_inobject, 2349 int target_inobject,
2350 int target_unused) { 2350 int target_unused) {
2351 // If fields were added (or removed), rewrite the instance. 2351 // If fields were added (or removed), rewrite the instance.
2352 int number_of_fields = NumberOfFields(); 2352 int number_of_fields = NumberOfFields();
2353 ASSERT(target_number_of_fields >= number_of_fields); 2353 ASSERT(target_number_of_fields >= number_of_fields);
2354 if (target_number_of_fields != number_of_fields) return true; 2354 if (target_number_of_fields != number_of_fields) return true;
2355 2355
2356 if (FLAG_track_double_fields) { 2356 // If smi descriptors were replaced by double descriptors, rewrite.
2357 // If smi descriptors were replaced by double descriptors, rewrite. 2357 DescriptorArray* old_desc = instance_descriptors();
2358 DescriptorArray* old_desc = instance_descriptors(); 2358 DescriptorArray* new_desc = target->instance_descriptors();
2359 DescriptorArray* new_desc = target->instance_descriptors(); 2359 int limit = NumberOfOwnDescriptors();
2360 int limit = NumberOfOwnDescriptors(); 2360 for (int i = 0; i < limit; i++) {
2361 for (int i = 0; i < limit; i++) { 2361 if (new_desc->GetDetails(i).representation().IsDouble() &&
2362 if (new_desc->GetDetails(i).representation().IsDouble() && 2362 !old_desc->GetDetails(i).representation().IsDouble()) {
2363 !old_desc->GetDetails(i).representation().IsDouble()) { 2363 return true;
2364 return true;
2365 }
2366 } 2364 }
2367 } 2365 }
2368 2366
2369 // If no fields were added, and no inobject properties were removed, setting 2367 // If no fields were added, and no inobject properties were removed, setting
2370 // the map is sufficient. 2368 // the map is sufficient.
2371 if (target_inobject == inobject_properties()) return false; 2369 if (target_inobject == inobject_properties()) return false;
2372 // In-object slack tracking may have reduced the object size of the new map. 2370 // In-object slack tracking may have reduced the object size of the new map.
2373 // In that case, succeed if all existing fields were inobject, and they still 2371 // In that case, succeed if all existing fields were inobject, and they still
2374 // fit within the new inobject size. 2372 // fit within the new inobject size.
2375 ASSERT(target_inobject < inobject_properties()); 2373 ASSERT(target_inobject < inobject_properties());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 if (old_details.type() == CALLBACKS) { 2425 if (old_details.type() == CALLBACKS) {
2428 ASSERT(details.representation().IsTagged()); 2426 ASSERT(details.representation().IsTagged());
2429 continue; 2427 continue;
2430 } 2428 }
2431 ASSERT(old_details.type() == CONSTANT || 2429 ASSERT(old_details.type() == CONSTANT ||
2432 old_details.type() == FIELD); 2430 old_details.type() == FIELD);
2433 Object* raw_value = old_details.type() == CONSTANT 2431 Object* raw_value = old_details.type() == CONSTANT
2434 ? old_descriptors->GetValue(i) 2432 ? old_descriptors->GetValue(i)
2435 : object->RawFastPropertyAt(old_descriptors->GetFieldIndex(i)); 2433 : object->RawFastPropertyAt(old_descriptors->GetFieldIndex(i));
2436 Handle<Object> value(raw_value, isolate); 2434 Handle<Object> value(raw_value, isolate);
2437 if (FLAG_track_double_fields && 2435 if (!old_details.representation().IsDouble() &&
2438 !old_details.representation().IsDouble() &&
2439 details.representation().IsDouble()) { 2436 details.representation().IsDouble()) {
2440 if (old_details.representation().IsNone()) { 2437 if (old_details.representation().IsNone()) {
2441 value = handle(Smi::FromInt(0), isolate); 2438 value = handle(Smi::FromInt(0), isolate);
2442 } 2439 }
2443 value = NewStorageFor(isolate, value, details.representation()); 2440 value = NewStorageFor(isolate, value, details.representation());
2444 } 2441 }
2445 ASSERT(!(FLAG_track_double_fields && 2442 ASSERT(!(details.representation().IsDouble() && value->IsSmi()));
2446 details.representation().IsDouble() &&
2447 value->IsSmi()));
2448 int target_index = new_descriptors->GetFieldIndex(i) - inobject; 2443 int target_index = new_descriptors->GetFieldIndex(i) - inobject;
2449 if (target_index < 0) target_index += total_size; 2444 if (target_index < 0) target_index += total_size;
2450 array->set(target_index, *value); 2445 array->set(target_index, *value);
2451 } 2446 }
2452 2447
2453 // From here on we cannot fail and we shouldn't GC anymore. 2448 // From here on we cannot fail and we shouldn't GC anymore.
2454 DisallowHeapAllocation no_allocation; 2449 DisallowHeapAllocation no_allocation;
2455 2450
2456 // Copy (real) inobject properties. If necessary, stop at number_of_fields to 2451 // Copy (real) inobject properties. If necessary, stop at number_of_fields to
2457 // avoid overwriting |one_pointer_filler_map|. 2452 // avoid overwriting |one_pointer_filler_map|.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 new_map->NumberOfOwnDescriptors(), 2535 new_map->NumberOfOwnDescriptors(),
2541 new_map->NumberOfOwnDescriptors(), 2536 new_map->NumberOfOwnDescriptors(),
2542 details.type() == CONSTANT && store_mode == FORCE_FIELD, 2537 details.type() == CONSTANT && store_mode == FORCE_FIELD,
2543 Representation::Tagged(), Representation::Tagged()); 2538 Representation::Tagged(), Representation::Tagged());
2544 } 2539 }
2545 return new_map; 2540 return new_map;
2546 } 2541 }
2547 2542
2548 2543
2549 void Map::DeprecateTransitionTree() { 2544 void Map::DeprecateTransitionTree() {
2550 if (!FLAG_track_fields) return;
2551 if (is_deprecated()) return; 2545 if (is_deprecated()) return;
2552 if (HasTransitionArray()) { 2546 if (HasTransitionArray()) {
2553 TransitionArray* transitions = this->transitions(); 2547 TransitionArray* transitions = this->transitions();
2554 for (int i = 0; i < transitions->number_of_transitions(); i++) { 2548 for (int i = 0; i < transitions->number_of_transitions(); i++) {
2555 transitions->GetTarget(i)->DeprecateTransitionTree(); 2549 transitions->GetTarget(i)->DeprecateTransitionTree();
2556 } 2550 }
2557 } 2551 }
2558 deprecate(); 2552 deprecate();
2559 dependent_code()->DeoptimizeDependentCodeGroup( 2553 dependent_code()->DeoptimizeDependentCodeGroup(
2560 GetIsolate(), DependentCode::kTransitionGroup); 2554 GetIsolate(), DependentCode::kTransitionGroup);
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3964 lookup->type() == CONSTANT) { 3958 lookup->type() == CONSTANT) {
3965 JSObject::GeneralizeFieldRepresentation(handle(lookup->holder()), 3959 JSObject::GeneralizeFieldRepresentation(handle(lookup->holder()),
3966 lookup->GetDescriptorIndex(), 3960 lookup->GetDescriptorIndex(),
3967 value->OptimalRepresentation(), 3961 value->OptimalRepresentation(),
3968 FORCE_FIELD); 3962 FORCE_FIELD);
3969 DescriptorArray* desc = lookup->holder()->map()->instance_descriptors(); 3963 DescriptorArray* desc = lookup->holder()->map()->instance_descriptors();
3970 int descriptor = lookup->GetDescriptorIndex(); 3964 int descriptor = lookup->GetDescriptorIndex();
3971 representation = desc->GetDetails(descriptor).representation(); 3965 representation = desc->GetDetails(descriptor).representation();
3972 } 3966 }
3973 3967
3974 if (FLAG_track_double_fields && representation.IsDouble()) { 3968 if (representation.IsDouble()) {
3975 HeapNumber* storage = HeapNumber::cast(lookup->holder()->RawFastPropertyAt( 3969 HeapNumber* storage = HeapNumber::cast(lookup->holder()->RawFastPropertyAt(
3976 lookup->GetFieldIndex().field_index())); 3970 lookup->GetFieldIndex().field_index()));
3977 storage->set_value(value->Number()); 3971 storage->set_value(value->Number());
3978 return; 3972 return;
3979 } 3973 }
3980 3974
3981 lookup->holder()->FastPropertyAtPut( 3975 lookup->holder()->FastPropertyAtPut(
3982 lookup->GetFieldIndex().field_index(), *value); 3976 lookup->GetFieldIndex().field_index(), *value);
3983 } 3977 }
3984 3978
(...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after
6652 } 6646 }
6653 6647
6654 6648
6655 Object* JSObject::SlowReverseLookup(Object* value) { 6649 Object* JSObject::SlowReverseLookup(Object* value) {
6656 if (HasFastProperties()) { 6650 if (HasFastProperties()) {
6657 int number_of_own_descriptors = map()->NumberOfOwnDescriptors(); 6651 int number_of_own_descriptors = map()->NumberOfOwnDescriptors();
6658 DescriptorArray* descs = map()->instance_descriptors(); 6652 DescriptorArray* descs = map()->instance_descriptors();
6659 for (int i = 0; i < number_of_own_descriptors; i++) { 6653 for (int i = 0; i < number_of_own_descriptors; i++) {
6660 if (descs->GetType(i) == FIELD) { 6654 if (descs->GetType(i) == FIELD) {
6661 Object* property = RawFastPropertyAt(descs->GetFieldIndex(i)); 6655 Object* property = RawFastPropertyAt(descs->GetFieldIndex(i));
6662 if (FLAG_track_double_fields && 6656 if (descs->GetDetails(i).representation().IsDouble()) {
6663 descs->GetDetails(i).representation().IsDouble()) {
6664 ASSERT(property->IsHeapNumber()); 6657 ASSERT(property->IsHeapNumber());
6665 if (value->IsNumber() && property->Number() == value->Number()) { 6658 if (value->IsNumber() && property->Number() == value->Number()) {
6666 return descs->GetKey(i); 6659 return descs->GetKey(i);
6667 } 6660 }
6668 } else if (property == value) { 6661 } else if (property == value) {
6669 return descs->GetKey(i); 6662 return descs->GetKey(i);
6670 } 6663 }
6671 } else if (descs->GetType(i) == CONSTANT) { 6664 } else if (descs->GetType(i) == CONSTANT) {
6672 if (descs->GetConstant(i) == value) { 6665 if (descs->GetConstant(i) == value) {
6673 return descs->GetKey(i); 6666 return descs->GetKey(i);
(...skipping 9810 matching lines...) Expand 10 before | Expand all | Expand 10 after
16484 #define ERROR_MESSAGES_TEXTS(C, T) T, 16477 #define ERROR_MESSAGES_TEXTS(C, T) T,
16485 static const char* error_messages_[] = { 16478 static const char* error_messages_[] = {
16486 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16479 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16487 }; 16480 };
16488 #undef ERROR_MESSAGES_TEXTS 16481 #undef ERROR_MESSAGES_TEXTS
16489 return error_messages_[reason]; 16482 return error_messages_[reason];
16490 } 16483 }
16491 16484
16492 16485
16493 } } // namespace v8::internal 16486 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/json-parser.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698