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

Side by Side Diff: src/objects-inl.h

Issue 12224035: Generalize map dependent codes array to allow multiple dependency groups. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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
« src/objects-debug.cc ('K') | « src/objects-debug.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3418 has_slow_elements_kind() || has_external_array_elements()); 3418 has_slow_elements_kind() || has_external_array_elements());
3419 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); 3419 set_bit_field3(IsObserved::update(bit_field3(), is_observed));
3420 } 3420 }
3421 3421
3422 3422
3423 bool Map::is_observed() { 3423 bool Map::is_observed() {
3424 return IsObserved::decode(bit_field3()); 3424 return IsObserved::decode(bit_field3());
3425 } 3425 }
3426 3426
3427 3427
3428 void Map::AddDependentCode(Handle<Code> code) { 3428 void Map::AddDependentCode(DependentCodes::DependencyGroup group,
3429 Handle<Code> code) {
3429 Handle<DependentCodes> codes = 3430 Handle<DependentCodes> codes =
3430 DependentCodes::Append(Handle<DependentCodes>(dependent_codes()), code); 3431 DependentCodes::Insert(Handle<DependentCodes>(dependent_codes()),
3432 group, code);
3431 if (*codes != dependent_codes()) { 3433 if (*codes != dependent_codes()) {
3432 set_dependent_codes(*codes); 3434 set_dependent_codes(*codes);
3433 } 3435 }
3434 } 3436 }
3435 3437
3436 3438
3437 int DependentCodes::number_of_codes() { 3439 int DependentCodes::number_of_codes(DependencyGroup group) {
3438 if (length() == 0) return 0; 3440 if (length() == 0) return 0;
3439 return Smi::cast(get(kNumberOfCodesIndex))->value(); 3441 return Smi::cast(get(group))->value();
3440 } 3442 }
3441 3443
3442 3444
3443 void DependentCodes::set_number_of_codes(int value) { 3445 void DependentCodes::set_number_of_codes(DependencyGroup group, int value) {
3444 set(kNumberOfCodesIndex, Smi::FromInt(value)); 3446 set(group, Smi::FromInt(value));
3445 } 3447 }
3446 3448
3447 3449
3448 Code* DependentCodes::code_at(int i) { 3450 Code* DependentCodes::code_at(int i) {
3449 return Code::cast(get(kCodesIndex + i)); 3451 return Code::cast(get(kCodesStartIndex + i));
3450 } 3452 }
3451 3453
3452 3454
3453 void DependentCodes::set_code_at(int i, Code* value) { 3455 void DependentCodes::set_code_at(int i, Code* value) {
3454 set(kCodesIndex + i, value); 3456 set(kCodesStartIndex + i, value);
3455 } 3457 }
3456 3458
3457 3459
3458 Object** DependentCodes::code_slot_at(int i) { 3460 Object** DependentCodes::code_slot_at(int i) {
3459 return HeapObject::RawField( 3461 return HeapObject::RawField(
3460 this, FixedArray::OffsetOfElementAt(kCodesIndex + i)); 3462 this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i));
3461 } 3463 }
3462 3464
3463 3465
3464 void DependentCodes::clear_code_at(int i) { 3466 void DependentCodes::clear_code_at(int i) {
3465 set_undefined(kCodesIndex + i); 3467 set_undefined(kCodesStartIndex + i);
3466 } 3468 }
3467 3469
3468 3470
3471 void DependentCodes::ComputeGroupStartIndexes(GroupStartIndexes starts) {
3472 starts[0] = 0;
3473 for (int g = 1; g <= kGroupCount; g++) {
3474 int count = number_of_codes(static_cast<DependencyGroup>(g - 1));
3475 starts[g] = starts[g - 1] + count;
3476 }
3477 }
3478
3479
3480 void DependentCodes::ExtendGroup(DependencyGroup group) {
3481 GroupStartIndexes starts;
3482 ComputeGroupStartIndexes(starts);
3483 for (int g = kGroupCount - 2; g > group; g--) {
3484 set_code_at(starts[g + 1], code_at(starts[g]));
3485 }
3486 }
3487
3488
3469 void Code::set_flags(Code::Flags flags) { 3489 void Code::set_flags(Code::Flags flags) {
3470 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); 3490 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1);
3471 // Make sure that all call stubs have an arguments count. 3491 // Make sure that all call stubs have an arguments count.
3472 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && 3492 ASSERT((ExtractKindFromFlags(flags) != CALL_IC &&
3473 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || 3493 ExtractKindFromFlags(flags) != KEYED_CALL_IC) ||
3474 ExtractArgumentsCountFromFlags(flags) >= 0); 3494 ExtractArgumentsCountFromFlags(flags) >= 0);
3475 WRITE_INT_FIELD(this, kFlagsOffset, flags); 3495 WRITE_INT_FIELD(this, kFlagsOffset, flags);
3476 } 3496 }
3477 3497
3478 3498
(...skipping 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after
5890 #undef WRITE_UINT32_FIELD 5910 #undef WRITE_UINT32_FIELD
5891 #undef READ_SHORT_FIELD 5911 #undef READ_SHORT_FIELD
5892 #undef WRITE_SHORT_FIELD 5912 #undef WRITE_SHORT_FIELD
5893 #undef READ_BYTE_FIELD 5913 #undef READ_BYTE_FIELD
5894 #undef WRITE_BYTE_FIELD 5914 #undef WRITE_BYTE_FIELD
5895 5915
5896 5916
5897 } } // namespace v8::internal 5917 } } // namespace v8::internal
5898 5918
5899 #endif // V8_OBJECTS_INL_H_ 5919 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects-debug.cc ('K') | « src/objects-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698