| 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::NotifyLeafMapLayoutChange() { |
| 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 FLAG_omit_prototype_checks_for_leaf_maps; |
| 3443 } |
| 3444 |
| 3445 |
| 3446 void Map::AddDependentCode(DependentCode::DependencyGroup group, |
| 3447 Handle<Code> code) { |
| 3448 Handle<DependentCode> codes = |
| 3449 DependentCode::Insert(Handle<DependentCode>(dependent_code()), |
| 3450 group, code); |
| 3451 if (*codes != dependent_code()) { |
| 3452 set_dependent_code(*codes); |
| 3439 } | 3453 } |
| 3440 } | 3454 } |
| 3441 | 3455 |
| 3442 | 3456 |
| 3443 int DependentCodes::number_of_codes() { | 3457 int DependentCode::number_of_entries(DependencyGroup group) { |
| 3444 if (length() == 0) return 0; | 3458 if (length() == 0) return 0; |
| 3445 return Smi::cast(get(kNumberOfCodesIndex))->value(); | 3459 return Smi::cast(get(group))->value(); |
| 3446 } | 3460 } |
| 3447 | 3461 |
| 3448 | 3462 |
| 3449 void DependentCodes::set_number_of_codes(int value) { | 3463 void DependentCode::set_number_of_entries(DependencyGroup group, int value) { |
| 3450 set(kNumberOfCodesIndex, Smi::FromInt(value)); | 3464 set(group, Smi::FromInt(value)); |
| 3451 } | 3465 } |
| 3452 | 3466 |
| 3453 | 3467 |
| 3454 Code* DependentCodes::code_at(int i) { | 3468 Code* DependentCode::code_at(int i) { |
| 3455 return Code::cast(get(kCodesIndex + i)); | 3469 return Code::cast(get(kCodesStartIndex + i)); |
| 3456 } | 3470 } |
| 3457 | 3471 |
| 3458 | 3472 |
| 3459 void DependentCodes::set_code_at(int i, Code* value) { | 3473 void DependentCode::set_code_at(int i, Code* value) { |
| 3460 set(kCodesIndex + i, value); | 3474 set(kCodesStartIndex + i, value); |
| 3461 } | 3475 } |
| 3462 | 3476 |
| 3463 | 3477 |
| 3464 Object** DependentCodes::code_slot_at(int i) { | 3478 Object** DependentCode::code_slot_at(int i) { |
| 3465 return HeapObject::RawField( | 3479 return HeapObject::RawField( |
| 3466 this, FixedArray::OffsetOfElementAt(kCodesIndex + i)); | 3480 this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i)); |
| 3467 } | 3481 } |
| 3468 | 3482 |
| 3469 | 3483 |
| 3470 void DependentCodes::clear_code_at(int i) { | 3484 void DependentCode::clear_code_at(int i) { |
| 3471 set_undefined(kCodesIndex + i); | 3485 set_undefined(kCodesStartIndex + i); |
| 3472 } | 3486 } |
| 3473 | 3487 |
| 3474 | 3488 |
| 3489 void DependentCode::ExtendGroup(DependencyGroup group) { |
| 3490 GroupStartIndexes starts(this); |
| 3491 for (int g = kGroupCount - 1; g > group; g--) { |
| 3492 if (starts.at(g) < starts.at(g + 1)) { |
| 3493 set_code_at(starts.at(g + 1), code_at(starts.at(g))); |
| 3494 } |
| 3495 } |
| 3496 } |
| 3497 |
| 3498 |
| 3475 void Code::set_flags(Code::Flags flags) { | 3499 void Code::set_flags(Code::Flags flags) { |
| 3476 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); | 3500 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); |
| 3477 // Make sure that all call stubs have an arguments count. | 3501 // Make sure that all call stubs have an arguments count. |
| 3478 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && | 3502 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && |
| 3479 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || | 3503 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || |
| 3480 ExtractArgumentsCountFromFlags(flags) >= 0); | 3504 ExtractArgumentsCountFromFlags(flags) >= 0); |
| 3481 WRITE_INT_FIELD(this, kFlagsOffset, flags); | 3505 WRITE_INT_FIELD(this, kFlagsOffset, flags); |
| 3482 } | 3506 } |
| 3483 | 3507 |
| 3484 | 3508 |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4087 | 4111 |
| 4088 | 4112 |
| 4089 HeapObject* Map::UncheckedPrototypeTransitions() { | 4113 HeapObject* Map::UncheckedPrototypeTransitions() { |
| 4090 ASSERT(HasTransitionArray()); | 4114 ASSERT(HasTransitionArray()); |
| 4091 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); | 4115 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); |
| 4092 return unchecked_transition_array()->UncheckedPrototypeTransitions(); | 4116 return unchecked_transition_array()->UncheckedPrototypeTransitions(); |
| 4093 } | 4117 } |
| 4094 | 4118 |
| 4095 | 4119 |
| 4096 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 4120 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
| 4097 ACCESSORS(Map, dependent_codes, DependentCodes, kDependentCodesOffset) | 4121 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset) |
| 4098 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 4122 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
| 4099 | 4123 |
| 4100 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 4124 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
| 4101 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) | 4125 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) |
| 4102 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) | 4126 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) |
| 4103 | 4127 |
| 4104 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 4128 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
| 4105 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) | 4129 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) |
| 4106 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) | 4130 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) |
| 4107 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) | 4131 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) |
| (...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5902 #undef WRITE_UINT32_FIELD | 5926 #undef WRITE_UINT32_FIELD |
| 5903 #undef READ_SHORT_FIELD | 5927 #undef READ_SHORT_FIELD |
| 5904 #undef WRITE_SHORT_FIELD | 5928 #undef WRITE_SHORT_FIELD |
| 5905 #undef READ_BYTE_FIELD | 5929 #undef READ_BYTE_FIELD |
| 5906 #undef WRITE_BYTE_FIELD | 5930 #undef WRITE_BYTE_FIELD |
| 5907 | 5931 |
| 5908 | 5932 |
| 5909 } } // namespace v8::internal | 5933 } } // namespace v8::internal |
| 5910 | 5934 |
| 5911 #endif // V8_OBJECTS_INL_H_ | 5935 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |