Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 if (!fun->shared()->IsApiFunction()) | 775 if (!fun->shared()->IsApiFunction()) |
| 776 return true; | 776 return true; |
| 777 // If the object is fully fast case and has the same map it was | 777 // If the object is fully fast case and has the same map it was |
| 778 // created with then no changes can have been made to it. | 778 // created with then no changes can have been made to it. |
| 779 return map() != fun->initial_map() | 779 return map() != fun->initial_map() |
| 780 || !HasFastObjectElements() | 780 || !HasFastObjectElements() |
| 781 || !HasFastProperties(); | 781 || !HasFastProperties(); |
| 782 } | 782 } |
| 783 | 783 |
| 784 | 784 |
| 785 #if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ <= 4) | |
| 786 // Work around bad optimization by GCC 4.4.6 on PPC Linux | |
| 787 #pragma GCC optimize "O0" | |
|
danno
2014/07/29 13:24:08
Please use this style of guard with the GCC detect
| |
| 788 #endif | |
| 785 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, | 789 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, |
| 786 Handle<Object> object, | 790 Handle<Object> object, |
| 787 Handle<Object> receiver, | 791 Handle<Object> receiver, |
| 788 uint32_t index) { | 792 uint32_t index) { |
| 789 if (object->IsUndefined()) { | 793 if (object->IsUndefined()) { |
| 790 // TODO(verwaest): Why is this check here? | 794 // TODO(verwaest): Why is this check here? |
| 791 UNREACHABLE(); | 795 UNREACHABLE(); |
| 792 return isolate->factory()->undefined_value(); | 796 return isolate->factory()->undefined_value(); |
| 793 } | 797 } |
| 794 | 798 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 829 ASSIGN_RETURN_ON_EXCEPTION( | 833 ASSIGN_RETURN_ON_EXCEPTION( |
| 830 isolate, result, | 834 isolate, result, |
| 831 js_object->GetElementsAccessor()->Get(receiver, js_object, index), | 835 js_object->GetElementsAccessor()->Get(receiver, js_object, index), |
| 832 Object); | 836 Object); |
| 833 if (!result->IsTheHole()) return result; | 837 if (!result->IsTheHole()) return result; |
| 834 } | 838 } |
| 835 } | 839 } |
| 836 | 840 |
| 837 return isolate->factory()->undefined_value(); | 841 return isolate->factory()->undefined_value(); |
| 838 } | 842 } |
| 843 #if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ <= 4) | |
| 844 #pragma GCC reset_options | |
| 845 #endif | |
| 839 | 846 |
| 840 | 847 |
| 841 Map* Object::GetRootMap(Isolate* isolate) { | 848 Map* Object::GetRootMap(Isolate* isolate) { |
| 842 DisallowHeapAllocation no_alloc; | 849 DisallowHeapAllocation no_alloc; |
| 843 if (IsSmi()) { | 850 if (IsSmi()) { |
| 844 Context* context = isolate->context()->native_context(); | 851 Context* context = isolate->context()->native_context(); |
| 845 return context->number_function()->initial_map(); | 852 return context->number_function()->initial_map(); |
| 846 } | 853 } |
| 847 | 854 |
| 848 HeapObject* heap_object = HeapObject::cast(this); | 855 HeapObject* heap_object = HeapObject::cast(this); |
| (...skipping 8815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9664 int properties = mode == CLEAR_INOBJECT_PROPERTIES | 9671 int properties = mode == CLEAR_INOBJECT_PROPERTIES |
| 9665 ? 0 : other->inobject_properties(); | 9672 ? 0 : other->inobject_properties(); |
| 9666 return CheckEquivalent(this, other) && inobject_properties() == properties; | 9673 return CheckEquivalent(this, other) && inobject_properties() == properties; |
| 9667 } | 9674 } |
| 9668 | 9675 |
| 9669 | 9676 |
| 9670 void ConstantPoolArray::ConstantPoolIterateBody(ObjectVisitor* v) { | 9677 void ConstantPoolArray::ConstantPoolIterateBody(ObjectVisitor* v) { |
| 9671 // Unfortunately the serializer relies on pointers within an object being | 9678 // Unfortunately the serializer relies on pointers within an object being |
| 9672 // visited in-order, so we have to iterate both the code and heap pointers in | 9679 // visited in-order, so we have to iterate both the code and heap pointers in |
| 9673 // the small section before doing so in the extended section. | 9680 // the small section before doing so in the extended section. |
| 9681 WeakObjectState state = get_weak_object_state(); | |
| 9674 for (int s = 0; s <= final_section(); ++s) { | 9682 for (int s = 0; s <= final_section(); ++s) { |
| 9675 LayoutSection section = static_cast<LayoutSection>(s); | 9683 LayoutSection section = static_cast<LayoutSection>(s); |
| 9676 ConstantPoolArray::Iterator code_iter(this, ConstantPoolArray::CODE_PTR, | 9684 ConstantPoolArray::Iterator code_iter(this, ConstantPoolArray::CODE_PTR, |
| 9677 section); | 9685 section); |
| 9678 while (!code_iter.is_finished()) { | 9686 while (!code_iter.is_finished()) { |
| 9679 v->VisitCodeEntry(reinterpret_cast<Address>( | 9687 v->VisitCodeEntry(reinterpret_cast<Address>( |
| 9680 RawFieldOfElementAt(code_iter.next_index()))); | 9688 RawFieldOfElementAt(code_iter.next_index()))); |
| 9681 } | 9689 } |
| 9682 | 9690 |
| 9683 ConstantPoolArray::Iterator heap_iter(this, ConstantPoolArray::HEAP_PTR, | 9691 ConstantPoolArray::Iterator heap_iter(this, ConstantPoolArray::HEAP_PTR, |
| 9684 section); | 9692 section); |
| 9685 while (!heap_iter.is_finished()) { | 9693 while (!heap_iter.is_finished()) { |
| 9686 v->VisitPointer(RawFieldOfElementAt(heap_iter.next_index())); | 9694 v->VisitConstantPoolEmbeddedPointer( |
| 9695 RawFieldOfElementAt(heap_iter.next_index()), state); | |
| 9687 } | 9696 } |
| 9688 } | 9697 } |
| 9689 } | 9698 } |
| 9690 | 9699 |
| 9691 | 9700 |
| 9692 void ConstantPoolArray::ClearPtrEntries(Isolate* isolate) { | 9701 void ConstantPoolArray::ClearPtrEntries(Isolate* isolate) { |
| 9693 Type type[] = { CODE_PTR, HEAP_PTR }; | 9702 Type type[] = { CODE_PTR, HEAP_PTR }; |
| 9694 Address default_value[] = { | 9703 Address default_value[] = { |
| 9695 isolate->builtins()->builtin(Builtins::kIllegal)->entry(), | 9704 isolate->builtins()->builtin(Builtins::kIllegal)->entry(), |
| 9696 reinterpret_cast<Address>(isolate->heap()->undefined_value()) }; | 9705 reinterpret_cast<Address>(isolate->heap()->undefined_value()) }; |
| (...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11522 os << "\n"; | 11531 os << "\n"; |
| 11523 } | 11532 } |
| 11524 #endif | 11533 #endif |
| 11525 } | 11534 } |
| 11526 | 11535 |
| 11527 os << "RelocInfo (size = " << relocation_size() << ")\n"; | 11536 os << "RelocInfo (size = " << relocation_size() << ")\n"; |
| 11528 for (RelocIterator it(this); !it.done(); it.next()) { | 11537 for (RelocIterator it(this); !it.done(); it.next()) { |
| 11529 it.rinfo()->Print(GetIsolate(), os); | 11538 it.rinfo()->Print(GetIsolate(), os); |
| 11530 } | 11539 } |
| 11531 os << "\n"; | 11540 os << "\n"; |
| 11541 | |
| 11542 if (FLAG_enable_ool_constant_pool) { | |
| 11543 ConstantPoolArray *pool = constant_pool(); | |
| 11544 if (pool->length()) { | |
| 11545 os << "Constant Pool\n"; | |
| 11546 pool->Print(os); | |
| 11547 os << "\n"; | |
| 11548 } | |
| 11549 } | |
| 11532 } | 11550 } |
| 11533 #endif // ENABLE_DISASSEMBLER | 11551 #endif // ENABLE_DISASSEMBLER |
| 11534 | 11552 |
| 11535 | 11553 |
| 11536 Handle<FixedArray> JSObject::SetFastElementsCapacityAndLength( | 11554 Handle<FixedArray> JSObject::SetFastElementsCapacityAndLength( |
| 11537 Handle<JSObject> object, | 11555 Handle<JSObject> object, |
| 11538 int capacity, | 11556 int capacity, |
| 11539 int length, | 11557 int length, |
| 11540 SetFastElementsCapacitySmiMode smi_mode) { | 11558 SetFastElementsCapacitySmiMode smi_mode) { |
| 11541 // We should never end in here with a pixel or external array. | 11559 // We should never end in here with a pixel or external array. |
| (...skipping 5400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16942 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16960 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16943 static const char* error_messages_[] = { | 16961 static const char* error_messages_[] = { |
| 16944 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16962 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16945 }; | 16963 }; |
| 16946 #undef ERROR_MESSAGES_TEXTS | 16964 #undef ERROR_MESSAGES_TEXTS |
| 16947 return error_messages_[reason]; | 16965 return error_messages_[reason]; |
| 16948 } | 16966 } |
| 16949 | 16967 |
| 16950 | 16968 |
| 16951 } } // namespace v8::internal | 16969 } } // namespace v8::internal |
| OLD | NEW |