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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 bool Object::IsDeoptimizationOutputData() { | 577 bool Object::IsDeoptimizationOutputData() { |
578 if (!IsFixedArray()) return false; | 578 if (!IsFixedArray()) return false; |
579 // There's actually no way to see the difference between a fixed array and | 579 // There's actually no way to see the difference between a fixed array and |
580 // a deoptimization data array. Since this is used for asserts we can check | 580 // a deoptimization data array. Since this is used for asserts we can check |
581 // that the length is plausible though. | 581 // that the length is plausible though. |
582 if (FixedArray::cast(this)->length() % 2 != 0) return false; | 582 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
583 return true; | 583 return true; |
584 } | 584 } |
585 | 585 |
586 | 586 |
| 587 bool Object::IsDependentCodes() { |
| 588 if (!IsFixedArray()) return false; |
| 589 // There's actually no way to see the difference between a fixed array and |
| 590 // a dependent codes array. |
| 591 return true; |
| 592 } |
| 593 |
| 594 |
587 bool Object::IsTypeFeedbackCells() { | 595 bool Object::IsTypeFeedbackCells() { |
588 if (!IsFixedArray()) return false; | 596 if (!IsFixedArray()) return false; |
589 // There's actually no way to see the difference between a fixed array and | 597 // There's actually no way to see the difference between a fixed array and |
590 // a cache cells array. Since this is used for asserts we can check that | 598 // a cache cells array. Since this is used for asserts we can check that |
591 // the length is plausible though. | 599 // the length is plausible though. |
592 if (FixedArray::cast(this)->length() % 2 != 0) return false; | 600 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
593 return true; | 601 return true; |
594 } | 602 } |
595 | 603 |
596 | 604 |
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 | 2375 |
2368 // ------------------------------------ | 2376 // ------------------------------------ |
2369 // Cast operations | 2377 // Cast operations |
2370 | 2378 |
2371 | 2379 |
2372 CAST_ACCESSOR(FixedArray) | 2380 CAST_ACCESSOR(FixedArray) |
2373 CAST_ACCESSOR(FixedDoubleArray) | 2381 CAST_ACCESSOR(FixedDoubleArray) |
2374 CAST_ACCESSOR(DescriptorArray) | 2382 CAST_ACCESSOR(DescriptorArray) |
2375 CAST_ACCESSOR(DeoptimizationInputData) | 2383 CAST_ACCESSOR(DeoptimizationInputData) |
2376 CAST_ACCESSOR(DeoptimizationOutputData) | 2384 CAST_ACCESSOR(DeoptimizationOutputData) |
| 2385 CAST_ACCESSOR(DependentCodes) |
2377 CAST_ACCESSOR(TypeFeedbackCells) | 2386 CAST_ACCESSOR(TypeFeedbackCells) |
2378 CAST_ACCESSOR(SymbolTable) | 2387 CAST_ACCESSOR(SymbolTable) |
2379 CAST_ACCESSOR(JSFunctionResultCache) | 2388 CAST_ACCESSOR(JSFunctionResultCache) |
2380 CAST_ACCESSOR(NormalizedMapCache) | 2389 CAST_ACCESSOR(NormalizedMapCache) |
2381 CAST_ACCESSOR(ScopeInfo) | 2390 CAST_ACCESSOR(ScopeInfo) |
2382 CAST_ACCESSOR(CompilationCacheTable) | 2391 CAST_ACCESSOR(CompilationCacheTable) |
2383 CAST_ACCESSOR(CodeCacheHashTable) | 2392 CAST_ACCESSOR(CodeCacheHashTable) |
2384 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) | 2393 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) |
2385 CAST_ACCESSOR(MapCache) | 2394 CAST_ACCESSOR(MapCache) |
2386 CAST_ACCESSOR(String) | 2395 CAST_ACCESSOR(String) |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3399 has_slow_elements_kind() || has_external_array_elements()); | 3408 has_slow_elements_kind() || has_external_array_elements()); |
3400 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); | 3409 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); |
3401 } | 3410 } |
3402 | 3411 |
3403 | 3412 |
3404 bool Map::is_observed() { | 3413 bool Map::is_observed() { |
3405 return IsObserved::decode(bit_field3()); | 3414 return IsObserved::decode(bit_field3()); |
3406 } | 3415 } |
3407 | 3416 |
3408 | 3417 |
| 3418 void Map::AddDependentCode(Handle<Code> code) { |
| 3419 Handle<DependentCodes> codes = |
| 3420 DependentCodes::Append(Handle<DependentCodes>(dependent_codes()), code); |
| 3421 if (*codes != dependent_codes()) { |
| 3422 set_dependent_codes(*codes); |
| 3423 } |
| 3424 } |
| 3425 |
| 3426 |
| 3427 int DependentCodes::number_of_codes() { |
| 3428 if (length() == 0) return 0; |
| 3429 return Smi::cast(get(kNumberOfCodesOffset))->value(); |
| 3430 } |
| 3431 |
| 3432 |
| 3433 void DependentCodes::set_number_of_codes(int value) { |
| 3434 set(kNumberOfCodesOffset, Smi::FromInt(value)); |
| 3435 } |
| 3436 |
| 3437 |
| 3438 Code* DependentCodes::code_at(int i) { |
| 3439 return Code::cast(get(kCodesOffset + i)); |
| 3440 } |
| 3441 |
| 3442 |
| 3443 void DependentCodes::set_code_at(int i, Code* value) { |
| 3444 set(kCodesOffset + i, value); |
| 3445 } |
| 3446 |
| 3447 |
| 3448 Object** DependentCodes::code_slot_at(int i) { |
| 3449 return HeapObject::RawField( |
| 3450 this, FixedArray::OffsetOfElementAt(kCodesOffset + i)); |
| 3451 } |
| 3452 |
| 3453 |
| 3454 void DependentCodes::clear_code_at(int i) { |
| 3455 set(kCodesOffset + i, Smi::FromInt(0), SKIP_WRITE_BARRIER); |
| 3456 } |
| 3457 |
| 3458 |
3409 void Code::set_flags(Code::Flags flags) { | 3459 void Code::set_flags(Code::Flags flags) { |
3410 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); | 3460 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); |
3411 // Make sure that all call stubs have an arguments count. | 3461 // Make sure that all call stubs have an arguments count. |
3412 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && | 3462 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && |
3413 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || | 3463 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || |
3414 ExtractArgumentsCountFromFlags(flags) >= 0); | 3464 ExtractArgumentsCountFromFlags(flags) >= 0); |
3415 WRITE_INT_FIELD(this, kFlagsOffset, flags); | 3465 WRITE_INT_FIELD(this, kFlagsOffset, flags); |
3416 } | 3466 } |
3417 | 3467 |
3418 | 3468 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3672 | 3722 |
3673 | 3723 |
3674 void Code::set_has_function_cache(bool flag) { | 3724 void Code::set_has_function_cache(bool flag) { |
3675 ASSERT(kind() == STUB); | 3725 ASSERT(kind() == STUB); |
3676 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 3726 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
3677 int updated = HasFunctionCacheField::update(previous, flag); | 3727 int updated = HasFunctionCacheField::update(previous, flag); |
3678 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 3728 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
3679 } | 3729 } |
3680 | 3730 |
3681 | 3731 |
| 3732 bool Code::marked_for_deoptimization() { |
| 3733 ASSERT(kind() == OPTIMIZED_FUNCTION); |
| 3734 return MarkedForDeoptimizationField::decode( |
| 3735 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
| 3736 } |
| 3737 |
| 3738 |
| 3739 void Code::set_marked_for_deoptimization(bool flag) { |
| 3740 ASSERT(kind() == OPTIMIZED_FUNCTION); |
| 3741 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
| 3742 int updated = MarkedForDeoptimizationField::update(previous, flag); |
| 3743 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
| 3744 } |
| 3745 |
| 3746 |
3682 bool Code::is_inline_cache_stub() { | 3747 bool Code::is_inline_cache_stub() { |
3683 Kind kind = this->kind(); | 3748 Kind kind = this->kind(); |
3684 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 3749 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
3685 } | 3750 } |
3686 | 3751 |
3687 | 3752 |
3688 bool Code::is_debug_break() { | 3753 bool Code::is_debug_break() { |
3689 return ic_state() == DEBUG_STUB && extra_ic_state() == DEBUG_BREAK; | 3754 return ic_state() == DEBUG_STUB && extra_ic_state() == DEBUG_BREAK; |
3690 } | 3755 } |
3691 | 3756 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4000 | 4065 |
4001 | 4066 |
4002 HeapObject* Map::UncheckedPrototypeTransitions() { | 4067 HeapObject* Map::UncheckedPrototypeTransitions() { |
4003 ASSERT(HasTransitionArray()); | 4068 ASSERT(HasTransitionArray()); |
4004 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); | 4069 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); |
4005 return unchecked_transition_array()->UncheckedPrototypeTransitions(); | 4070 return unchecked_transition_array()->UncheckedPrototypeTransitions(); |
4006 } | 4071 } |
4007 | 4072 |
4008 | 4073 |
4009 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 4074 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
| 4075 ACCESSORS(Map, dependent_codes, DependentCodes, kDependentCodesOffset) |
4010 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 4076 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
4011 | 4077 |
4012 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 4078 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
4013 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) | 4079 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) |
4014 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) | 4080 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) |
4015 | 4081 |
4016 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 4082 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
4017 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) | 4083 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) |
4018 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) | 4084 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) |
4019 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) | 4085 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) |
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5810 #undef WRITE_UINT32_FIELD | 5876 #undef WRITE_UINT32_FIELD |
5811 #undef READ_SHORT_FIELD | 5877 #undef READ_SHORT_FIELD |
5812 #undef WRITE_SHORT_FIELD | 5878 #undef WRITE_SHORT_FIELD |
5813 #undef READ_BYTE_FIELD | 5879 #undef READ_BYTE_FIELD |
5814 #undef WRITE_BYTE_FIELD | 5880 #undef WRITE_BYTE_FIELD |
5815 | 5881 |
5816 | 5882 |
5817 } } // namespace v8::internal | 5883 } } // namespace v8::internal |
5818 | 5884 |
5819 #endif // V8_OBJECTS_INL_H_ | 5885 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |