| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 27 matching lines...) Expand all Loading... |
| 38 #include "elements.h" | 38 #include "elements.h" |
| 39 #include "objects.h" | 39 #include "objects.h" |
| 40 #include "contexts.h" | 40 #include "contexts.h" |
| 41 #include "conversions-inl.h" | 41 #include "conversions-inl.h" |
| 42 #include "heap.h" | 42 #include "heap.h" |
| 43 #include "isolate.h" | 43 #include "isolate.h" |
| 44 #include "property.h" | 44 #include "property.h" |
| 45 #include "spaces.h" | 45 #include "spaces.h" |
| 46 #include "store-buffer.h" | 46 #include "store-buffer.h" |
| 47 #include "v8memory.h" | 47 #include "v8memory.h" |
| 48 | 48 #include "factory.h" |
| 49 #include "incremental-marking.h" | 49 #include "incremental-marking.h" |
| 50 | 50 |
| 51 namespace v8 { | 51 namespace v8 { |
| 52 namespace internal { | 52 namespace internal { |
| 53 | 53 |
| 54 PropertyDetails::PropertyDetails(Smi* smi) { | 54 PropertyDetails::PropertyDetails(Smi* smi) { |
| 55 value_ = smi->value(); | 55 value_ = smi->value(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 bool Object::IsDeoptimizationOutputData() { | 547 bool Object::IsDeoptimizationOutputData() { |
| 548 if (!IsFixedArray()) return false; | 548 if (!IsFixedArray()) return false; |
| 549 // There's actually no way to see the difference between a fixed array and | 549 // There's actually no way to see the difference between a fixed array and |
| 550 // a deoptimization data array. Since this is used for asserts we can check | 550 // a deoptimization data array. Since this is used for asserts we can check |
| 551 // that the length is plausible though. | 551 // that the length is plausible though. |
| 552 if (FixedArray::cast(this)->length() % 2 != 0) return false; | 552 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
| 553 return true; | 553 return true; |
| 554 } | 554 } |
| 555 | 555 |
| 556 | 556 |
| 557 bool Object::IsTypeFeedbackCells() { |
| 558 if (!IsFixedArray()) return false; |
| 559 // There's actually no way to see the difference between a fixed array and |
| 560 // a cache cells array. Since this is used for asserts we can check that |
| 561 // the length is plausible though. |
| 562 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
| 563 return true; |
| 564 } |
| 565 |
| 566 |
| 557 bool Object::IsContext() { | 567 bool Object::IsContext() { |
| 558 if (Object::IsHeapObject()) { | 568 if (Object::IsHeapObject()) { |
| 559 Map* map = HeapObject::cast(this)->map(); | 569 Map* map = HeapObject::cast(this)->map(); |
| 560 Heap* heap = map->GetHeap(); | 570 Heap* heap = map->GetHeap(); |
| 561 return (map == heap->function_context_map() || | 571 return (map == heap->function_context_map() || |
| 562 map == heap->catch_context_map() || | 572 map == heap->catch_context_map() || |
| 563 map == heap->with_context_map() || | 573 map == heap->with_context_map() || |
| 564 map == heap->global_context_map() || | 574 map == heap->global_context_map() || |
| 565 map == heap->block_context_map()); | 575 map == heap->block_context_map()); |
| 566 } | 576 } |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 | 2104 |
| 2095 // ------------------------------------ | 2105 // ------------------------------------ |
| 2096 // Cast operations | 2106 // Cast operations |
| 2097 | 2107 |
| 2098 | 2108 |
| 2099 CAST_ACCESSOR(FixedArray) | 2109 CAST_ACCESSOR(FixedArray) |
| 2100 CAST_ACCESSOR(FixedDoubleArray) | 2110 CAST_ACCESSOR(FixedDoubleArray) |
| 2101 CAST_ACCESSOR(DescriptorArray) | 2111 CAST_ACCESSOR(DescriptorArray) |
| 2102 CAST_ACCESSOR(DeoptimizationInputData) | 2112 CAST_ACCESSOR(DeoptimizationInputData) |
| 2103 CAST_ACCESSOR(DeoptimizationOutputData) | 2113 CAST_ACCESSOR(DeoptimizationOutputData) |
| 2114 CAST_ACCESSOR(TypeFeedbackCells) |
| 2104 CAST_ACCESSOR(SymbolTable) | 2115 CAST_ACCESSOR(SymbolTable) |
| 2105 CAST_ACCESSOR(JSFunctionResultCache) | 2116 CAST_ACCESSOR(JSFunctionResultCache) |
| 2106 CAST_ACCESSOR(NormalizedMapCache) | 2117 CAST_ACCESSOR(NormalizedMapCache) |
| 2107 CAST_ACCESSOR(ScopeInfo) | 2118 CAST_ACCESSOR(ScopeInfo) |
| 2108 CAST_ACCESSOR(CompilationCacheTable) | 2119 CAST_ACCESSOR(CompilationCacheTable) |
| 2109 CAST_ACCESSOR(CodeCacheHashTable) | 2120 CAST_ACCESSOR(CodeCacheHashTable) |
| 2110 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) | 2121 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) |
| 2111 CAST_ACCESSOR(MapCache) | 2122 CAST_ACCESSOR(MapCache) |
| 2112 CAST_ACCESSOR(String) | 2123 CAST_ACCESSOR(String) |
| 2113 CAST_ACCESSOR(SeqString) | 2124 CAST_ACCESSOR(SeqString) |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3160 return READ_BYTE_FIELD(this, kToBooleanTypeOffset); | 3171 return READ_BYTE_FIELD(this, kToBooleanTypeOffset); |
| 3161 } | 3172 } |
| 3162 | 3173 |
| 3163 | 3174 |
| 3164 void Code::set_to_boolean_state(byte value) { | 3175 void Code::set_to_boolean_state(byte value) { |
| 3165 ASSERT(is_to_boolean_ic_stub()); | 3176 ASSERT(is_to_boolean_ic_stub()); |
| 3166 WRITE_BYTE_FIELD(this, kToBooleanTypeOffset, value); | 3177 WRITE_BYTE_FIELD(this, kToBooleanTypeOffset, value); |
| 3167 } | 3178 } |
| 3168 | 3179 |
| 3169 | 3180 |
| 3170 bool Code::has_function_cache() { | |
| 3171 ASSERT(kind() == STUB); | |
| 3172 return READ_BYTE_FIELD(this, kHasFunctionCacheOffset) != 0; | |
| 3173 } | |
| 3174 | |
| 3175 | |
| 3176 void Code::set_has_function_cache(bool flag) { | |
| 3177 ASSERT(kind() == STUB); | |
| 3178 WRITE_BYTE_FIELD(this, kHasFunctionCacheOffset, flag); | |
| 3179 } | |
| 3180 | |
| 3181 | |
| 3182 bool Code::is_inline_cache_stub() { | 3181 bool Code::is_inline_cache_stub() { |
| 3183 Kind kind = this->kind(); | 3182 Kind kind = this->kind(); |
| 3184 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 3183 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
| 3185 } | 3184 } |
| 3186 | 3185 |
| 3187 | 3186 |
| 3188 Code::Flags Code::ComputeFlags(Kind kind, | 3187 Code::Flags Code::ComputeFlags(Kind kind, |
| 3189 InlineCacheState ic_state, | 3188 InlineCacheState ic_state, |
| 3190 ExtraICState extra_ic_state, | 3189 ExtraICState extra_ic_state, |
| 3191 PropertyType type, | 3190 PropertyType type, |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4035 ASSERT(obj->IsJSMessageObject()); | 4034 ASSERT(obj->IsJSMessageObject()); |
| 4036 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); | 4035 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); |
| 4037 return reinterpret_cast<JSMessageObject*>(obj); | 4036 return reinterpret_cast<JSMessageObject*>(obj); |
| 4038 } | 4037 } |
| 4039 | 4038 |
| 4040 | 4039 |
| 4041 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 4040 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
| 4042 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) | 4041 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
| 4043 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) | 4042 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) |
| 4044 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 4043 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
| 4044 ACCESSORS(Code, type_feedback_cells, |
| 4045 TypeFeedbackCells, kTypeFeedbackCellsOffset) |
| 4045 ACCESSORS(Code, next_code_flushing_candidate, | 4046 ACCESSORS(Code, next_code_flushing_candidate, |
| 4046 Object, kNextCodeFlushingCandidateOffset) | 4047 Object, kNextCodeFlushingCandidateOffset) |
| 4047 | 4048 |
| 4048 | 4049 |
| 4049 byte* Code::instruction_start() { | 4050 byte* Code::instruction_start() { |
| 4050 return FIELD_ADDR(this, kHeaderSize); | 4051 return FIELD_ADDR(this, kHeaderSize); |
| 4051 } | 4052 } |
| 4052 | 4053 |
| 4053 | 4054 |
| 4054 byte* Code::instruction_end() { | 4055 byte* Code::instruction_end() { |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4678 return GetHeap()->CopyFixedArray(this); | 4679 return GetHeap()->CopyFixedArray(this); |
| 4679 } | 4680 } |
| 4680 | 4681 |
| 4681 | 4682 |
| 4682 MaybeObject* FixedDoubleArray::Copy() { | 4683 MaybeObject* FixedDoubleArray::Copy() { |
| 4683 if (length() == 0) return this; | 4684 if (length() == 0) return this; |
| 4684 return GetHeap()->CopyFixedDoubleArray(this); | 4685 return GetHeap()->CopyFixedDoubleArray(this); |
| 4685 } | 4686 } |
| 4686 | 4687 |
| 4687 | 4688 |
| 4689 void TypeFeedbackCells::SetAstId(int index, Smi* id) { |
| 4690 set(1 + index * 2, id); |
| 4691 } |
| 4692 |
| 4693 |
| 4694 Smi* TypeFeedbackCells::AstId(int index) { |
| 4695 return Smi::cast(get(1 + index * 2)); |
| 4696 } |
| 4697 |
| 4698 |
| 4699 void TypeFeedbackCells::SetCell(int index, JSGlobalPropertyCell* cell) { |
| 4700 set(index * 2, cell); |
| 4701 } |
| 4702 |
| 4703 |
| 4704 JSGlobalPropertyCell* TypeFeedbackCells::Cell(int index) { |
| 4705 return JSGlobalPropertyCell::cast(get(index * 2)); |
| 4706 } |
| 4707 |
| 4708 |
| 4709 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) { |
| 4710 return isolate->factory()->the_hole_value(); |
| 4711 } |
| 4712 |
| 4713 |
| 4714 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { |
| 4715 return isolate->factory()->undefined_value(); |
| 4716 } |
| 4717 |
| 4718 |
| 4719 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) { |
| 4720 return heap->raw_unchecked_the_hole_value(); |
| 4721 } |
| 4722 |
| 4723 |
| 4688 Relocatable::Relocatable(Isolate* isolate) { | 4724 Relocatable::Relocatable(Isolate* isolate) { |
| 4689 ASSERT(isolate == Isolate::Current()); | 4725 ASSERT(isolate == Isolate::Current()); |
| 4690 isolate_ = isolate; | 4726 isolate_ = isolate; |
| 4691 prev_ = isolate->relocatable_top(); | 4727 prev_ = isolate->relocatable_top(); |
| 4692 isolate->set_relocatable_top(this); | 4728 isolate->set_relocatable_top(this); |
| 4693 } | 4729 } |
| 4694 | 4730 |
| 4695 | 4731 |
| 4696 Relocatable::~Relocatable() { | 4732 Relocatable::~Relocatable() { |
| 4697 ASSERT(isolate_ == Isolate::Current()); | 4733 ASSERT(isolate_ == Isolate::Current()); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4785 #undef WRITE_INT_FIELD | 4821 #undef WRITE_INT_FIELD |
| 4786 #undef READ_SHORT_FIELD | 4822 #undef READ_SHORT_FIELD |
| 4787 #undef WRITE_SHORT_FIELD | 4823 #undef WRITE_SHORT_FIELD |
| 4788 #undef READ_BYTE_FIELD | 4824 #undef READ_BYTE_FIELD |
| 4789 #undef WRITE_BYTE_FIELD | 4825 #undef WRITE_BYTE_FIELD |
| 4790 | 4826 |
| 4791 | 4827 |
| 4792 } } // namespace v8::internal | 4828 } } // namespace v8::internal |
| 4793 | 4829 |
| 4794 #endif // V8_OBJECTS_INL_H_ | 4830 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |