| 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 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3556 set_bit_field3(IsShared::update(bit_field3(), value)); | 3556 set_bit_field3(IsShared::update(bit_field3(), value)); |
| 3557 } | 3557 } |
| 3558 | 3558 |
| 3559 | 3559 |
| 3560 bool Map::is_shared() { | 3560 bool Map::is_shared() { |
| 3561 return IsShared::decode(bit_field3()); | 3561 return IsShared::decode(bit_field3()); |
| 3562 } | 3562 } |
| 3563 | 3563 |
| 3564 | 3564 |
| 3565 void Map::set_dictionary_map(bool value) { | 3565 void Map::set_dictionary_map(bool value) { |
| 3566 if (value) mark_unstable(); |
| 3566 set_bit_field3(DictionaryMap::update(bit_field3(), value)); | 3567 set_bit_field3(DictionaryMap::update(bit_field3(), value)); |
| 3567 } | 3568 } |
| 3568 | 3569 |
| 3569 | 3570 |
| 3570 bool Map::is_dictionary_map() { | 3571 bool Map::is_dictionary_map() { |
| 3571 return DictionaryMap::decode(bit_field3()); | 3572 return DictionaryMap::decode(bit_field3()); |
| 3572 } | 3573 } |
| 3573 | 3574 |
| 3574 | 3575 |
| 3575 Code::Flags Code::flags() { | 3576 Code::Flags Code::flags() { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3619 void Map::freeze() { | 3620 void Map::freeze() { |
| 3620 set_bit_field3(IsFrozen::update(bit_field3(), true)); | 3621 set_bit_field3(IsFrozen::update(bit_field3(), true)); |
| 3621 } | 3622 } |
| 3622 | 3623 |
| 3623 | 3624 |
| 3624 bool Map::is_frozen() { | 3625 bool Map::is_frozen() { |
| 3625 return IsFrozen::decode(bit_field3()); | 3626 return IsFrozen::decode(bit_field3()); |
| 3626 } | 3627 } |
| 3627 | 3628 |
| 3628 | 3629 |
| 3630 void Map::mark_unstable() { |
| 3631 set_bit_field3(IsUnstable::update(bit_field3(), true)); |
| 3632 } |
| 3633 |
| 3634 |
| 3635 bool Map::is_stable() { |
| 3636 return !IsUnstable::decode(bit_field3()); |
| 3637 } |
| 3638 |
| 3639 |
| 3629 bool Map::has_code_cache() { | 3640 bool Map::has_code_cache() { |
| 3630 return code_cache() != GetIsolate()->heap()->empty_fixed_array(); | 3641 return code_cache() != GetIsolate()->heap()->empty_fixed_array(); |
| 3631 } | 3642 } |
| 3632 | 3643 |
| 3633 | 3644 |
| 3634 bool Map::CanBeDeprecated() { | 3645 bool Map::CanBeDeprecated() { |
| 3635 int descriptor = LastAdded(); | 3646 int descriptor = LastAdded(); |
| 3636 for (int i = 0; i <= descriptor; i++) { | 3647 for (int i = 0; i <= descriptor; i++) { |
| 3637 PropertyDetails details = instance_descriptors()->GetDetails(i); | 3648 PropertyDetails details = instance_descriptors()->GetDetails(i); |
| 3638 if (FLAG_track_fields && details.representation().IsNone()) { | 3649 if (FLAG_track_fields && details.representation().IsNone()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3650 } | 3661 } |
| 3651 if (FLAG_track_fields && details.type() == CONSTANT) { | 3662 if (FLAG_track_fields && details.type() == CONSTANT) { |
| 3652 return true; | 3663 return true; |
| 3653 } | 3664 } |
| 3654 } | 3665 } |
| 3655 return false; | 3666 return false; |
| 3656 } | 3667 } |
| 3657 | 3668 |
| 3658 | 3669 |
| 3659 void Map::NotifyLeafMapLayoutChange() { | 3670 void Map::NotifyLeafMapLayoutChange() { |
| 3660 dependent_code()->DeoptimizeDependentCodeGroup( | 3671 if (is_stable()) { |
| 3661 GetIsolate(), | 3672 mark_unstable(); |
| 3662 DependentCode::kPrototypeCheckGroup); | 3673 dependent_code()->DeoptimizeDependentCodeGroup( |
| 3674 GetIsolate(), |
| 3675 DependentCode::kPrototypeCheckGroup); |
| 3676 } |
| 3663 } | 3677 } |
| 3664 | 3678 |
| 3665 | 3679 |
| 3666 bool Map::CanOmitPrototypeChecks() { | 3680 bool Map::CanOmitPrototypeChecks() { |
| 3667 return !HasTransitionArray() && !is_dictionary_map() && | 3681 return is_stable() && FLAG_omit_prototype_checks_for_leaf_maps; |
| 3668 FLAG_omit_prototype_checks_for_leaf_maps; | |
| 3669 } | 3682 } |
| 3670 | 3683 |
| 3671 | 3684 |
| 3672 bool Map::CanOmitMapChecks() { | 3685 bool Map::CanOmitMapChecks() { |
| 3673 return !HasTransitionArray() && !is_dictionary_map() && | 3686 return is_stable() && FLAG_omit_map_checks_for_leaf_maps; |
| 3674 FLAG_omit_map_checks_for_leaf_maps; | |
| 3675 } | 3687 } |
| 3676 | 3688 |
| 3677 | 3689 |
| 3678 int DependentCode::number_of_entries(DependencyGroup group) { | 3690 int DependentCode::number_of_entries(DependencyGroup group) { |
| 3679 if (length() == 0) return 0; | 3691 if (length() == 0) return 0; |
| 3680 return Smi::cast(get(group))->value(); | 3692 return Smi::cast(get(group))->value(); |
| 3681 } | 3693 } |
| 3682 | 3694 |
| 3683 | 3695 |
| 3684 void DependentCode::set_number_of_entries(DependencyGroup group, int value) { | 3696 void DependentCode::set_number_of_entries(DependencyGroup group, int value) { |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4250 } | 4262 } |
| 4251 | 4263 |
| 4252 | 4264 |
| 4253 bool Map::HasTransitionArray() { | 4265 bool Map::HasTransitionArray() { |
| 4254 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 4266 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); |
| 4255 return object->IsTransitionArray(); | 4267 return object->IsTransitionArray(); |
| 4256 } | 4268 } |
| 4257 | 4269 |
| 4258 | 4270 |
| 4259 Map* Map::elements_transition_map() { | 4271 Map* Map::elements_transition_map() { |
| 4260 return transitions()->elements_transition(); | 4272 int index = transitions()->Search(GetHeap()->elements_transition_symbol()); |
| 4273 return transitions()->GetTarget(index); |
| 4261 } | 4274 } |
| 4262 | 4275 |
| 4263 | 4276 |
| 4264 bool Map::CanHaveMoreTransitions() { | 4277 bool Map::CanHaveMoreTransitions() { |
| 4265 if (!HasTransitionArray()) return true; | 4278 if (!HasTransitionArray()) return true; |
| 4266 return FixedArray::SizeFor(transitions()->length() + | 4279 return FixedArray::SizeFor(transitions()->length() + |
| 4267 TransitionArray::kTransitionSize) | 4280 TransitionArray::kTransitionSize) |
| 4268 <= Page::kMaxNonCodeHeapObjectSize; | 4281 <= Page::kMaxNonCodeHeapObjectSize; |
| 4269 } | 4282 } |
| 4270 | 4283 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4281 transitions()->SetTarget(transition_index, target); | 4294 transitions()->SetTarget(transition_index, target); |
| 4282 } | 4295 } |
| 4283 | 4296 |
| 4284 | 4297 |
| 4285 Map* Map::GetTransition(int transition_index) { | 4298 Map* Map::GetTransition(int transition_index) { |
| 4286 return transitions()->GetTarget(transition_index); | 4299 return transitions()->GetTarget(transition_index); |
| 4287 } | 4300 } |
| 4288 | 4301 |
| 4289 | 4302 |
| 4290 MaybeObject* Map::set_elements_transition_map(Map* transitioned_map) { | 4303 MaybeObject* Map::set_elements_transition_map(Map* transitioned_map) { |
| 4291 MaybeObject* allow_elements = EnsureHasTransitionArray(this); | 4304 TransitionArray* transitions; |
| 4292 if (allow_elements->IsFailure()) return allow_elements; | 4305 MaybeObject* maybe_transitions = AddTransition( |
| 4293 transitions()->set_elements_transition(transitioned_map); | 4306 GetHeap()->elements_transition_symbol(), |
| 4294 return this; | 4307 transitioned_map, |
| 4308 FULL_TRANSITION); |
| 4309 if (!maybe_transitions->To(&transitions)) return maybe_transitions; |
| 4310 set_transitions(transitions); |
| 4311 return transitions; |
| 4295 } | 4312 } |
| 4296 | 4313 |
| 4297 | 4314 |
| 4298 FixedArray* Map::GetPrototypeTransitions() { | 4315 FixedArray* Map::GetPrototypeTransitions() { |
| 4299 if (!HasTransitionArray()) return GetHeap()->empty_fixed_array(); | 4316 if (!HasTransitionArray()) return GetHeap()->empty_fixed_array(); |
| 4300 if (!transitions()->HasPrototypeTransitions()) { | 4317 if (!transitions()->HasPrototypeTransitions()) { |
| 4301 return GetHeap()->empty_fixed_array(); | 4318 return GetHeap()->empty_fixed_array(); |
| 4302 } | 4319 } |
| 4303 return transitions()->GetPrototypeTransitions(); | 4320 return transitions()->GetPrototypeTransitions(); |
| 4304 } | 4321 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4475 | 4492 |
| 4476 ACCESSORS(Script, source, Object, kSourceOffset) | 4493 ACCESSORS(Script, source, Object, kSourceOffset) |
| 4477 ACCESSORS(Script, name, Object, kNameOffset) | 4494 ACCESSORS(Script, name, Object, kNameOffset) |
| 4478 ACCESSORS(Script, id, Smi, kIdOffset) | 4495 ACCESSORS(Script, id, Smi, kIdOffset) |
| 4479 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) | 4496 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) |
| 4480 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) | 4497 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) |
| 4481 ACCESSORS(Script, data, Object, kDataOffset) | 4498 ACCESSORS(Script, data, Object, kDataOffset) |
| 4482 ACCESSORS(Script, context_data, Object, kContextOffset) | 4499 ACCESSORS(Script, context_data, Object, kContextOffset) |
| 4483 ACCESSORS(Script, wrapper, Foreign, kWrapperOffset) | 4500 ACCESSORS(Script, wrapper, Foreign, kWrapperOffset) |
| 4484 ACCESSORS_TO_SMI(Script, type, kTypeOffset) | 4501 ACCESSORS_TO_SMI(Script, type, kTypeOffset) |
| 4485 ACCESSORS_TO_SMI(Script, compilation_type, kCompilationTypeOffset) | |
| 4486 ACCESSORS_TO_SMI(Script, compilation_state, kCompilationStateOffset) | |
| 4487 ACCESSORS(Script, line_ends, Object, kLineEndsOffset) | 4502 ACCESSORS(Script, line_ends, Object, kLineEndsOffset) |
| 4488 ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset) | 4503 ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset) |
| 4489 ACCESSORS_TO_SMI(Script, eval_from_instructions_offset, | 4504 ACCESSORS_TO_SMI(Script, eval_from_instructions_offset, |
| 4490 kEvalFrominstructionsOffsetOffset) | 4505 kEvalFrominstructionsOffsetOffset) |
| 4506 ACCESSORS_TO_SMI(Script, flags, kFlagsOffset) |
| 4507 BOOL_ACCESSORS(Script, flags, is_shared_cross_origin, kIsSharedCrossOriginBit) |
| 4508 |
| 4509 Script::CompilationType Script::compilation_type() { |
| 4510 return BooleanBit::get(flags(), kCompilationTypeBit) ? |
| 4511 COMPILATION_TYPE_EVAL : COMPILATION_TYPE_HOST; |
| 4512 } |
| 4513 void Script::set_compilation_type(CompilationType type) { |
| 4514 set_flags(BooleanBit::set(flags(), kCompilationTypeBit, |
| 4515 type == COMPILATION_TYPE_EVAL)); |
| 4516 } |
| 4517 Script::CompilationState Script::compilation_state() { |
| 4518 return BooleanBit::get(flags(), kCompilationStateBit) ? |
| 4519 COMPILATION_STATE_COMPILED : COMPILATION_STATE_INITIAL; |
| 4520 } |
| 4521 void Script::set_compilation_state(CompilationState state) { |
| 4522 set_flags(BooleanBit::set(flags(), kCompilationStateBit, |
| 4523 state == COMPILATION_STATE_COMPILED)); |
| 4524 } |
| 4525 |
| 4491 | 4526 |
| 4492 #ifdef ENABLE_DEBUGGER_SUPPORT | 4527 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 4493 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) | 4528 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) |
| 4494 ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex) | 4529 ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex) |
| 4495 ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex) | 4530 ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex) |
| 4496 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) | 4531 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) |
| 4497 | 4532 |
| 4498 ACCESSORS_TO_SMI(BreakPointInfo, code_position, kCodePositionIndex) | 4533 ACCESSORS_TO_SMI(BreakPointInfo, code_position, kCodePositionIndex) |
| 4499 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex) | 4534 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex) |
| 4500 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex) | 4535 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex) |
| (...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6207 #undef WRITE_UINT32_FIELD | 6242 #undef WRITE_UINT32_FIELD |
| 6208 #undef READ_SHORT_FIELD | 6243 #undef READ_SHORT_FIELD |
| 6209 #undef WRITE_SHORT_FIELD | 6244 #undef WRITE_SHORT_FIELD |
| 6210 #undef READ_BYTE_FIELD | 6245 #undef READ_BYTE_FIELD |
| 6211 #undef WRITE_BYTE_FIELD | 6246 #undef WRITE_BYTE_FIELD |
| 6212 | 6247 |
| 6213 | 6248 |
| 6214 } } // namespace v8::internal | 6249 } } // namespace v8::internal |
| 6215 | 6250 |
| 6216 #endif // V8_OBJECTS_INL_H_ | 6251 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |