OLD | NEW |
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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 bool Object::IsDeoptimizationOutputData() { | 582 bool Object::IsDeoptimizationOutputData() { |
583 if (!IsFixedArray()) return false; | 583 if (!IsFixedArray()) return false; |
584 // There's actually no way to see the difference between a fixed array and | 584 // There's actually no way to see the difference between a fixed array and |
585 // a deoptimization data array. Since this is used for asserts we can check | 585 // a deoptimization data array. Since this is used for asserts we can check |
586 // that the length is plausible though. | 586 // that the length is plausible though. |
587 if (FixedArray::cast(this)->length() % 2 != 0) return false; | 587 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
588 return true; | 588 return true; |
589 } | 589 } |
590 | 590 |
591 | 591 |
592 bool Object::IsDependentCodes() { | 592 bool Object::IsDependentCode() { |
593 if (!IsFixedArray()) return false; | 593 if (!IsFixedArray()) return false; |
594 // There's actually no way to see the difference between a fixed array and | 594 // There's actually no way to see the difference between a fixed array and |
595 // a dependent codes array. | 595 // a dependent codes array. |
596 return true; | 596 return true; |
597 } | 597 } |
598 | 598 |
599 | 599 |
600 bool Object::IsTypeFeedbackCells() { | 600 bool Object::IsTypeFeedbackCells() { |
601 if (!IsFixedArray()) return false; | 601 if (!IsFixedArray()) return false; |
602 // There's actually no way to see the difference between a fixed array and | 602 // There's actually no way to see the difference between a fixed array and |
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2390 | 2390 |
2391 // ------------------------------------ | 2391 // ------------------------------------ |
2392 // Cast operations | 2392 // Cast operations |
2393 | 2393 |
2394 | 2394 |
2395 CAST_ACCESSOR(FixedArray) | 2395 CAST_ACCESSOR(FixedArray) |
2396 CAST_ACCESSOR(FixedDoubleArray) | 2396 CAST_ACCESSOR(FixedDoubleArray) |
2397 CAST_ACCESSOR(DescriptorArray) | 2397 CAST_ACCESSOR(DescriptorArray) |
2398 CAST_ACCESSOR(DeoptimizationInputData) | 2398 CAST_ACCESSOR(DeoptimizationInputData) |
2399 CAST_ACCESSOR(DeoptimizationOutputData) | 2399 CAST_ACCESSOR(DeoptimizationOutputData) |
2400 CAST_ACCESSOR(DependentCodes) | 2400 CAST_ACCESSOR(DependentCode) |
2401 CAST_ACCESSOR(TypeFeedbackCells) | 2401 CAST_ACCESSOR(TypeFeedbackCells) |
2402 CAST_ACCESSOR(SymbolTable) | 2402 CAST_ACCESSOR(SymbolTable) |
2403 CAST_ACCESSOR(JSFunctionResultCache) | 2403 CAST_ACCESSOR(JSFunctionResultCache) |
2404 CAST_ACCESSOR(NormalizedMapCache) | 2404 CAST_ACCESSOR(NormalizedMapCache) |
2405 CAST_ACCESSOR(ScopeInfo) | 2405 CAST_ACCESSOR(ScopeInfo) |
2406 CAST_ACCESSOR(CompilationCacheTable) | 2406 CAST_ACCESSOR(CompilationCacheTable) |
2407 CAST_ACCESSOR(CodeCacheHashTable) | 2407 CAST_ACCESSOR(CodeCacheHashTable) |
2408 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) | 2408 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) |
2409 CAST_ACCESSOR(MapCache) | 2409 CAST_ACCESSOR(MapCache) |
2410 CAST_ACCESSOR(String) | 2410 CAST_ACCESSOR(String) |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3424 has_slow_elements_kind() || has_external_array_elements()); | 3424 has_slow_elements_kind() || has_external_array_elements()); |
3425 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); | 3425 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); |
3426 } | 3426 } |
3427 | 3427 |
3428 | 3428 |
3429 bool Map::is_observed() { | 3429 bool Map::is_observed() { |
3430 return IsObserved::decode(bit_field3()); | 3430 return IsObserved::decode(bit_field3()); |
3431 } | 3431 } |
3432 | 3432 |
3433 | 3433 |
3434 void Map::AddDependentCode(Handle<Code> code) { | 3434 void Map::NotifyObjectLayoutChange() { |
3435 Handle<DependentCodes> codes = | 3435 dependent_code()->DeoptimizeDependentCodeGroup( |
3436 DependentCodes::Append(Handle<DependentCodes>(dependent_codes()), code); | 3436 DependentCode::kPrototypeCheckGroup); |
3437 if (*codes != dependent_codes()) { | 3437 } |
3438 set_dependent_codes(*codes); | 3438 |
| 3439 |
| 3440 bool Map::CanOmitPrototypeChecks() { |
| 3441 return !HasTransitionArray() && !is_dictionary_map(); |
| 3442 } |
| 3443 |
| 3444 |
| 3445 void Map::AddDependentCode(DependentCode::DependencyGroup group, |
| 3446 Handle<Code> code) { |
| 3447 Handle<DependentCode> codes = |
| 3448 DependentCode::Insert(Handle<DependentCode>(dependent_code()), |
| 3449 group, code); |
| 3450 if (*codes != dependent_code()) { |
| 3451 set_dependent_code(*codes); |
3439 } | 3452 } |
3440 } | 3453 } |
3441 | 3454 |
3442 | 3455 |
3443 int DependentCodes::number_of_codes() { | 3456 int DependentCode::number_of_entries(DependencyGroup group) { |
3444 if (length() == 0) return 0; | 3457 if (length() == 0) return 0; |
3445 return Smi::cast(get(kNumberOfCodesIndex))->value(); | 3458 return Smi::cast(get(group))->value(); |
3446 } | 3459 } |
3447 | 3460 |
3448 | 3461 |
3449 void DependentCodes::set_number_of_codes(int value) { | 3462 void DependentCode::set_number_of_entries(DependencyGroup group, int value) { |
3450 set(kNumberOfCodesIndex, Smi::FromInt(value)); | 3463 set(group, Smi::FromInt(value)); |
3451 } | 3464 } |
3452 | 3465 |
3453 | 3466 |
3454 Code* DependentCodes::code_at(int i) { | 3467 Code* DependentCode::code_at(int i) { |
3455 return Code::cast(get(kCodesIndex + i)); | 3468 return Code::cast(get(kCodesStartIndex + i)); |
3456 } | 3469 } |
3457 | 3470 |
3458 | 3471 |
3459 void DependentCodes::set_code_at(int i, Code* value) { | 3472 void DependentCode::set_code_at(int i, Code* value) { |
3460 set(kCodesIndex + i, value); | 3473 set(kCodesStartIndex + i, value); |
3461 } | 3474 } |
3462 | 3475 |
3463 | 3476 |
3464 Object** DependentCodes::code_slot_at(int i) { | 3477 Object** DependentCode::code_slot_at(int i) { |
3465 return HeapObject::RawField( | 3478 return HeapObject::RawField( |
3466 this, FixedArray::OffsetOfElementAt(kCodesIndex + i)); | 3479 this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i)); |
3467 } | 3480 } |
3468 | 3481 |
3469 | 3482 |
3470 void DependentCodes::clear_code_at(int i) { | 3483 void DependentCode::clear_code_at(int i) { |
3471 set_undefined(kCodesIndex + i); | 3484 set_undefined(kCodesStartIndex + i); |
3472 } | 3485 } |
3473 | 3486 |
3474 | 3487 |
| 3488 void DependentCode::ExtendGroup(DependencyGroup group) { |
| 3489 GroupStartIndexes starts(this); |
| 3490 for (int g = kGroupCount - 1; g > group; g--) { |
| 3491 if (starts.at(g) < starts.at(g + 1)) { |
| 3492 set_code_at(starts.at(g + 1), code_at(starts.at(g))); |
| 3493 } |
| 3494 } |
| 3495 } |
| 3496 |
| 3497 |
3475 void Code::set_flags(Code::Flags flags) { | 3498 void Code::set_flags(Code::Flags flags) { |
3476 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); | 3499 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); |
3477 // Make sure that all call stubs have an arguments count. | 3500 // Make sure that all call stubs have an arguments count. |
3478 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && | 3501 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && |
3479 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || | 3502 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || |
3480 ExtractArgumentsCountFromFlags(flags) >= 0); | 3503 ExtractArgumentsCountFromFlags(flags) >= 0); |
3481 WRITE_INT_FIELD(this, kFlagsOffset, flags); | 3504 WRITE_INT_FIELD(this, kFlagsOffset, flags); |
3482 } | 3505 } |
3483 | 3506 |
3484 | 3507 |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4087 | 4110 |
4088 | 4111 |
4089 HeapObject* Map::UncheckedPrototypeTransitions() { | 4112 HeapObject* Map::UncheckedPrototypeTransitions() { |
4090 ASSERT(HasTransitionArray()); | 4113 ASSERT(HasTransitionArray()); |
4091 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); | 4114 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); |
4092 return unchecked_transition_array()->UncheckedPrototypeTransitions(); | 4115 return unchecked_transition_array()->UncheckedPrototypeTransitions(); |
4093 } | 4116 } |
4094 | 4117 |
4095 | 4118 |
4096 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 4119 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
4097 ACCESSORS(Map, dependent_codes, DependentCodes, kDependentCodesOffset) | 4120 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset) |
4098 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 4121 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
4099 | 4122 |
4100 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 4123 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
4101 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) | 4124 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) |
4102 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) | 4125 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) |
4103 | 4126 |
4104 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 4127 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
4105 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) | 4128 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) |
4106 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) | 4129 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) |
4107 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) | 4130 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) |
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5902 #undef WRITE_UINT32_FIELD | 5925 #undef WRITE_UINT32_FIELD |
5903 #undef READ_SHORT_FIELD | 5926 #undef READ_SHORT_FIELD |
5904 #undef WRITE_SHORT_FIELD | 5927 #undef WRITE_SHORT_FIELD |
5905 #undef READ_BYTE_FIELD | 5928 #undef READ_BYTE_FIELD |
5906 #undef WRITE_BYTE_FIELD | 5929 #undef WRITE_BYTE_FIELD |
5907 | 5930 |
5908 | 5931 |
5909 } } // namespace v8::internal | 5932 } } // namespace v8::internal |
5910 | 5933 |
5911 #endif // V8_OBJECTS_INL_H_ | 5934 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |