| 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 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3364 void Map::set_is_observed(bool is_observed) { | 3364 void Map::set_is_observed(bool is_observed) { |
| 3365 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); | 3365 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); |
| 3366 } | 3366 } |
| 3367 | 3367 |
| 3368 | 3368 |
| 3369 bool Map::is_observed() { | 3369 bool Map::is_observed() { |
| 3370 return IsObserved::decode(bit_field3()); | 3370 return IsObserved::decode(bit_field3()); |
| 3371 } | 3371 } |
| 3372 | 3372 |
| 3373 | 3373 |
| 3374 void Map::AddDependentCode(Handle<Code> code) { |
| 3375 Handle<FixedArray> codes = |
| 3376 DependentCodes::Append(Handle<FixedArray>(dependent_codes()), code); |
| 3377 if (*codes != dependent_codes()) { |
| 3378 set_dependent_codes(*codes); |
| 3379 } |
| 3380 } |
| 3381 |
| 3382 |
| 3383 int DependentCodes::number_of_codes(FixedArray* codes) { |
| 3384 if (codes->length() == 0) return 0; |
| 3385 return Smi::cast(codes->get(kNumberOfCodesOffset))->value(); |
| 3386 } |
| 3387 |
| 3388 |
| 3389 void DependentCodes::set_number_of_codes(FixedArray* codes, int value) { |
| 3390 codes->set(kNumberOfCodesOffset, Smi::FromInt(value)); |
| 3391 } |
| 3392 |
| 3393 |
| 3394 Code* DependentCodes::code(FixedArray* codes, int i) { |
| 3395 return Code::cast(codes->get(kCodesOffset + i)); |
| 3396 } |
| 3397 |
| 3398 |
| 3399 void DependentCodes::set_code(FixedArray* codes, int i, Code* value) { |
| 3400 codes->set(kCodesOffset + i, value); |
| 3401 } |
| 3402 |
| 3403 |
| 3404 Object** DependentCodes::code_slot(FixedArray* codes, int i) { |
| 3405 return HeapObject::RawField( |
| 3406 codes, FixedArray::OffsetOfElementAt(kCodesOffset + i)); |
| 3407 } |
| 3408 |
| 3409 |
| 3410 void DependentCodes::clear_code(FixedArray* codes, int i) { |
| 3411 codes->set(kCodesOffset + i, Smi::FromInt(0), SKIP_WRITE_BARRIER); |
| 3412 } |
| 3413 |
| 3414 |
| 3374 void Code::set_flags(Code::Flags flags) { | 3415 void Code::set_flags(Code::Flags flags) { |
| 3375 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); | 3416 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); |
| 3376 // Make sure that all call stubs have an arguments count. | 3417 // Make sure that all call stubs have an arguments count. |
| 3377 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && | 3418 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && |
| 3378 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || | 3419 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || |
| 3379 ExtractArgumentsCountFromFlags(flags) >= 0); | 3420 ExtractArgumentsCountFromFlags(flags) >= 0); |
| 3380 WRITE_INT_FIELD(this, kFlagsOffset, flags); | 3421 WRITE_INT_FIELD(this, kFlagsOffset, flags); |
| 3381 } | 3422 } |
| 3382 | 3423 |
| 3383 | 3424 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3636 | 3677 |
| 3637 | 3678 |
| 3638 void Code::set_has_function_cache(bool flag) { | 3679 void Code::set_has_function_cache(bool flag) { |
| 3639 ASSERT(kind() == STUB); | 3680 ASSERT(kind() == STUB); |
| 3640 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); | 3681 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
| 3641 int updated = HasFunctionCacheField::update(previous, flag); | 3682 int updated = HasFunctionCacheField::update(previous, flag); |
| 3642 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); | 3683 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
| 3643 } | 3684 } |
| 3644 | 3685 |
| 3645 | 3686 |
| 3687 bool Code::marked_for_deoptimization() { |
| 3688 ASSERT(kind() == OPTIMIZED_FUNCTION); |
| 3689 return MarkedForDeoptimizationField::decode( |
| 3690 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
| 3691 } |
| 3692 |
| 3693 |
| 3694 void Code::set_marked_for_deoptimization(bool flag) { |
| 3695 ASSERT(kind() == OPTIMIZED_FUNCTION); |
| 3696 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
| 3697 int updated = MarkedForDeoptimizationField::update(previous, flag); |
| 3698 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
| 3699 } |
| 3700 |
| 3701 |
| 3646 bool Code::is_inline_cache_stub() { | 3702 bool Code::is_inline_cache_stub() { |
| 3647 Kind kind = this->kind(); | 3703 Kind kind = this->kind(); |
| 3648 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 3704 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
| 3649 } | 3705 } |
| 3650 | 3706 |
| 3651 | 3707 |
| 3652 Code::Flags Code::ComputeFlags(Kind kind, | 3708 Code::Flags Code::ComputeFlags(Kind kind, |
| 3653 InlineCacheState ic_state, | 3709 InlineCacheState ic_state, |
| 3654 ExtraICState extra_ic_state, | 3710 ExtraICState extra_ic_state, |
| 3655 StubType type, | 3711 StubType type, |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3959 | 4015 |
| 3960 | 4016 |
| 3961 HeapObject* Map::UncheckedPrototypeTransitions() { | 4017 HeapObject* Map::UncheckedPrototypeTransitions() { |
| 3962 ASSERT(HasTransitionArray()); | 4018 ASSERT(HasTransitionArray()); |
| 3963 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); | 4019 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); |
| 3964 return unchecked_transition_array()->UncheckedPrototypeTransitions(); | 4020 return unchecked_transition_array()->UncheckedPrototypeTransitions(); |
| 3965 } | 4021 } |
| 3966 | 4022 |
| 3967 | 4023 |
| 3968 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 4024 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
| 4025 ACCESSORS(Map, dependent_codes, FixedArray, kDependentCodesOffset) |
| 3969 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 4026 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
| 3970 | 4027 |
| 3971 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 4028 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
| 3972 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) | 4029 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) |
| 3973 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) | 4030 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) |
| 3974 | 4031 |
| 3975 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 4032 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
| 3976 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) | 4033 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) |
| 3977 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) | 4034 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) |
| 3978 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) | 4035 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5757 #undef WRITE_UINT32_FIELD | 5814 #undef WRITE_UINT32_FIELD |
| 5758 #undef READ_SHORT_FIELD | 5815 #undef READ_SHORT_FIELD |
| 5759 #undef WRITE_SHORT_FIELD | 5816 #undef WRITE_SHORT_FIELD |
| 5760 #undef READ_BYTE_FIELD | 5817 #undef READ_BYTE_FIELD |
| 5761 #undef WRITE_BYTE_FIELD | 5818 #undef WRITE_BYTE_FIELD |
| 5762 | 5819 |
| 5763 | 5820 |
| 5764 } } // namespace v8::internal | 5821 } } // namespace v8::internal |
| 5765 | 5822 |
| 5766 #endif // V8_OBJECTS_INL_H_ | 5823 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |