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

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: 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
« no previous file with comments | « src/objects.cc ('k') | src/objects-visiting-inl.h » ('j') | 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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(kNumberOfCodesIndex))->value();
3430 }
3431
3432
3433 void DependentCodes::set_number_of_codes(int value) {
3434 set(kNumberOfCodesIndex, Smi::FromInt(value));
3435 }
3436
3437
3438 Code* DependentCodes::code_at(int i) {
3439 return Code::cast(get(kCodesIndex + i));
3440 }
3441
3442
3443 void DependentCodes::set_code_at(int i, Code* value) {
3444 set(kCodesIndex + i, value);
3445 }
3446
3447
3448 Object** DependentCodes::code_slot_at(int i) {
3449 return HeapObject::RawField(
3450 this, FixedArray::OffsetOfElementAt(kCodesIndex + i));
3451 }
3452
3453
3454 void DependentCodes::clear_code_at(int i) {
3455 set_undefined(kCodesIndex + i);
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
3676 3726
3677 3727
3678 void Code::set_has_function_cache(bool flag) { 3728 void Code::set_has_function_cache(bool flag) {
3679 ASSERT(kind() == STUB); 3729 ASSERT(kind() == STUB);
3680 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); 3730 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3681 int updated = HasFunctionCacheField::update(previous, flag); 3731 int updated = HasFunctionCacheField::update(previous, flag);
3682 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); 3732 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3683 } 3733 }
3684 3734
3685 3735
3736 bool Code::marked_for_deoptimization() {
3737 ASSERT(kind() == OPTIMIZED_FUNCTION);
3738 return MarkedForDeoptimizationField::decode(
3739 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
3740 }
3741
3742
3743 void Code::set_marked_for_deoptimization(bool flag) {
3744 ASSERT(kind() == OPTIMIZED_FUNCTION);
3745 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
3746 int updated = MarkedForDeoptimizationField::update(previous, flag);
3747 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
3748 }
3749
3750
3686 bool Code::is_inline_cache_stub() { 3751 bool Code::is_inline_cache_stub() {
3687 Kind kind = this->kind(); 3752 Kind kind = this->kind();
3688 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; 3753 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND;
3689 } 3754 }
3690 3755
3691 3756
3692 bool Code::is_debug_break() { 3757 bool Code::is_debug_break() {
3693 return ic_state() == DEBUG_STUB && extra_ic_state() == DEBUG_BREAK; 3758 return ic_state() == DEBUG_STUB && extra_ic_state() == DEBUG_BREAK;
3694 } 3759 }
3695 3760
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
4004 4069
4005 4070
4006 HeapObject* Map::UncheckedPrototypeTransitions() { 4071 HeapObject* Map::UncheckedPrototypeTransitions() {
4007 ASSERT(HasTransitionArray()); 4072 ASSERT(HasTransitionArray());
4008 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); 4073 ASSERT(unchecked_transition_array()->HasPrototypeTransitions());
4009 return unchecked_transition_array()->UncheckedPrototypeTransitions(); 4074 return unchecked_transition_array()->UncheckedPrototypeTransitions();
4010 } 4075 }
4011 4076
4012 4077
4013 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) 4078 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
4079 ACCESSORS(Map, dependent_codes, DependentCodes, kDependentCodesOffset)
4014 ACCESSORS(Map, constructor, Object, kConstructorOffset) 4080 ACCESSORS(Map, constructor, Object, kConstructorOffset)
4015 4081
4016 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) 4082 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
4017 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) 4083 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
4018 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) 4084 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
4019 4085
4020 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) 4086 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
4021 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) 4087 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset)
4022 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) 4088 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
4023 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) 4089 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after
5817 #undef WRITE_UINT32_FIELD 5883 #undef WRITE_UINT32_FIELD
5818 #undef READ_SHORT_FIELD 5884 #undef READ_SHORT_FIELD
5819 #undef WRITE_SHORT_FIELD 5885 #undef WRITE_SHORT_FIELD
5820 #undef READ_BYTE_FIELD 5886 #undef READ_BYTE_FIELD
5821 #undef WRITE_BYTE_FIELD 5887 #undef WRITE_BYTE_FIELD
5822 5888
5823 5889
5824 } } // namespace v8::internal 5890 } } // namespace v8::internal
5825 5891
5826 #endif // V8_OBJECTS_INL_H_ 5892 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698