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

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

Issue 11575007: Make embedded maps in optimized code weak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix skipping of maps in visitors. Created 7 years, 11 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
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 bool Object::IsDeoptimizationOutputData() { 567 bool Object::IsDeoptimizationOutputData() {
568 if (!IsFixedArray()) return false; 568 if (!IsFixedArray()) return false;
569 // There's actually no way to see the difference between a fixed array and 569 // There's actually no way to see the difference between a fixed array and
570 // a deoptimization data array. Since this is used for asserts we can check 570 // a deoptimization data array. Since this is used for asserts we can check
571 // that the length is plausible though. 571 // that the length is plausible though.
572 if (FixedArray::cast(this)->length() % 2 != 0) return false; 572 if (FixedArray::cast(this)->length() % 2 != 0) return false;
573 return true; 573 return true;
574 } 574 }
575 575
576 576
577 bool Object::IsDependentCodes() {
578 if (!IsFixedArray()) return false;
579 // There's actually no way to see the difference between a fixed array and
580 // a dependent codes array.
581 return true;
582 }
583
584
577 bool Object::IsTypeFeedbackCells() { 585 bool Object::IsTypeFeedbackCells() {
578 if (!IsFixedArray()) return false; 586 if (!IsFixedArray()) return false;
579 // There's actually no way to see the difference between a fixed array and 587 // There's actually no way to see the difference between a fixed array and
580 // a cache cells array. Since this is used for asserts we can check that 588 // a cache cells array. Since this is used for asserts we can check that
581 // the length is plausible though. 589 // the length is plausible though.
582 if (FixedArray::cast(this)->length() % 2 != 0) return false; 590 if (FixedArray::cast(this)->length() % 2 != 0) return false;
583 return true; 591 return true;
584 } 592 }
585 593
586 594
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 2359
2352 // ------------------------------------ 2360 // ------------------------------------
2353 // Cast operations 2361 // Cast operations
2354 2362
2355 2363
2356 CAST_ACCESSOR(FixedArray) 2364 CAST_ACCESSOR(FixedArray)
2357 CAST_ACCESSOR(FixedDoubleArray) 2365 CAST_ACCESSOR(FixedDoubleArray)
2358 CAST_ACCESSOR(DescriptorArray) 2366 CAST_ACCESSOR(DescriptorArray)
2359 CAST_ACCESSOR(DeoptimizationInputData) 2367 CAST_ACCESSOR(DeoptimizationInputData)
2360 CAST_ACCESSOR(DeoptimizationOutputData) 2368 CAST_ACCESSOR(DeoptimizationOutputData)
2369 CAST_ACCESSOR(DependentCodes)
2361 CAST_ACCESSOR(TypeFeedbackCells) 2370 CAST_ACCESSOR(TypeFeedbackCells)
2362 CAST_ACCESSOR(SymbolTable) 2371 CAST_ACCESSOR(SymbolTable)
2363 CAST_ACCESSOR(JSFunctionResultCache) 2372 CAST_ACCESSOR(JSFunctionResultCache)
2364 CAST_ACCESSOR(NormalizedMapCache) 2373 CAST_ACCESSOR(NormalizedMapCache)
2365 CAST_ACCESSOR(ScopeInfo) 2374 CAST_ACCESSOR(ScopeInfo)
2366 CAST_ACCESSOR(CompilationCacheTable) 2375 CAST_ACCESSOR(CompilationCacheTable)
2367 CAST_ACCESSOR(CodeCacheHashTable) 2376 CAST_ACCESSOR(CodeCacheHashTable)
2368 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) 2377 CAST_ACCESSOR(PolymorphicCodeCacheHashTable)
2369 CAST_ACCESSOR(MapCache) 2378 CAST_ACCESSOR(MapCache)
2370 CAST_ACCESSOR(String) 2379 CAST_ACCESSOR(String)
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
3364 void Map::set_is_observed(bool is_observed) { 3373 void Map::set_is_observed(bool is_observed) {
3365 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); 3374 set_bit_field3(IsObserved::update(bit_field3(), is_observed));
3366 } 3375 }
3367 3376
3368 3377
3369 bool Map::is_observed() { 3378 bool Map::is_observed() {
3370 return IsObserved::decode(bit_field3()); 3379 return IsObserved::decode(bit_field3());
3371 } 3380 }
3372 3381
3373 3382
3383 void Map::AddDependentCode(Handle<Code> code) {
3384 Handle<DependentCodes> codes =
3385 DependentCodes::Append(Handle<DependentCodes>(dependent_codes()), code);
3386 if (*codes != dependent_codes()) {
3387 set_dependent_codes(*codes);
3388 }
3389 }
3390
3391
3392 int DependentCodes::number_of_codes() {
3393 if (length() == 0) return 0;
3394 return Smi::cast(get(kNumberOfCodesOffset))->value();
3395 }
3396
3397
3398 void DependentCodes::set_number_of_codes(int value) {
3399 set(kNumberOfCodesOffset, Smi::FromInt(value));
3400 }
3401
3402
3403 Code* DependentCodes::code_at(int i) {
3404 return Code::cast(get(kCodesOffset + i));
3405 }
3406
3407
3408 void DependentCodes::set_code_at(int i, Code* value) {
3409 set(kCodesOffset + i, value);
3410 }
3411
3412
3413 Object** DependentCodes::code_slot_at(int i) {
3414 return HeapObject::RawField(
3415 this, FixedArray::OffsetOfElementAt(kCodesOffset + i));
3416 }
3417
3418
3419 void DependentCodes::clear_code_at(int i) {
3420 set(kCodesOffset + i, Smi::FromInt(0), SKIP_WRITE_BARRIER);
3421 }
3422
3423
3374 void Code::set_flags(Code::Flags flags) { 3424 void Code::set_flags(Code::Flags flags) {
3375 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); 3425 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1);
3376 // Make sure that all call stubs have an arguments count. 3426 // Make sure that all call stubs have an arguments count.
3377 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && 3427 ASSERT((ExtractKindFromFlags(flags) != CALL_IC &&
3378 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || 3428 ExtractKindFromFlags(flags) != KEYED_CALL_IC) ||
3379 ExtractArgumentsCountFromFlags(flags) >= 0); 3429 ExtractArgumentsCountFromFlags(flags) >= 0);
3380 WRITE_INT_FIELD(this, kFlagsOffset, flags); 3430 WRITE_INT_FIELD(this, kFlagsOffset, flags);
3381 } 3431 }
3382 3432
3383 3433
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3636 3686
3637 3687
3638 void Code::set_has_function_cache(bool flag) { 3688 void Code::set_has_function_cache(bool flag) {
3639 ASSERT(kind() == STUB); 3689 ASSERT(kind() == STUB);
3640 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); 3690 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3641 int updated = HasFunctionCacheField::update(previous, flag); 3691 int updated = HasFunctionCacheField::update(previous, flag);
3642 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); 3692 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3643 } 3693 }
3644 3694
3645 3695
3696 bool Code::marked_for_deoptimization() {
3697 ASSERT(kind() == OPTIMIZED_FUNCTION);
3698 return MarkedForDeoptimizationField::decode(
3699 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
3700 }
3701
3702
3703 void Code::set_marked_for_deoptimization(bool flag) {
3704 ASSERT(kind() == OPTIMIZED_FUNCTION);
3705 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3706 int updated = MarkedForDeoptimizationField::update(previous, flag);
3707 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3708 }
3709
3710
3646 bool Code::is_inline_cache_stub() { 3711 bool Code::is_inline_cache_stub() {
3647 Kind kind = this->kind(); 3712 Kind kind = this->kind();
3648 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; 3713 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND;
3649 } 3714 }
3650 3715
3651 3716
3652 Code::Flags Code::ComputeFlags(Kind kind, 3717 Code::Flags Code::ComputeFlags(Kind kind,
3653 InlineCacheState ic_state, 3718 InlineCacheState ic_state,
3654 ExtraICState extra_ic_state, 3719 ExtraICState extra_ic_state,
3655 StubType type, 3720 StubType type,
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
3959 4024
3960 4025
3961 HeapObject* Map::UncheckedPrototypeTransitions() { 4026 HeapObject* Map::UncheckedPrototypeTransitions() {
3962 ASSERT(HasTransitionArray()); 4027 ASSERT(HasTransitionArray());
3963 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); 4028 ASSERT(unchecked_transition_array()->HasPrototypeTransitions());
3964 return unchecked_transition_array()->UncheckedPrototypeTransitions(); 4029 return unchecked_transition_array()->UncheckedPrototypeTransitions();
3965 } 4030 }
3966 4031
3967 4032
3968 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) 4033 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
4034 ACCESSORS(Map, dependent_codes, DependentCodes, kDependentCodesOffset)
3969 ACCESSORS(Map, constructor, Object, kConstructorOffset) 4035 ACCESSORS(Map, constructor, Object, kConstructorOffset)
3970 4036
3971 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) 4037 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
3972 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) 4038 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
3973 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) 4039 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
3974 4040
3975 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) 4041 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
3976 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) 4042 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset)
3977 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) 4043 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
3978 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) 4044 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after
5757 #undef WRITE_UINT32_FIELD 5823 #undef WRITE_UINT32_FIELD
5758 #undef READ_SHORT_FIELD 5824 #undef READ_SHORT_FIELD
5759 #undef WRITE_SHORT_FIELD 5825 #undef WRITE_SHORT_FIELD
5760 #undef READ_BYTE_FIELD 5826 #undef READ_BYTE_FIELD
5761 #undef WRITE_BYTE_FIELD 5827 #undef WRITE_BYTE_FIELD
5762 5828
5763 5829
5764 } } // namespace v8::internal 5830 } } // namespace v8::internal
5765 5831
5766 #endif // V8_OBJECTS_INL_H_ 5832 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698