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 4839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4850 | 4850 |
4851 object->set_properties(*fields); | 4851 object->set_properties(*fields); |
4852 ASSERT(object->IsJSObject()); | 4852 ASSERT(object->IsJSObject()); |
4853 | 4853 |
4854 // Check that it really works. | 4854 // Check that it really works. |
4855 ASSERT(object->HasFastProperties()); | 4855 ASSERT(object->HasFastProperties()); |
4856 } | 4856 } |
4857 | 4857 |
4858 | 4858 |
4859 void JSObject::ResetElements(Handle<JSObject> object) { | 4859 void JSObject::ResetElements(Handle<JSObject> object) { |
4860 if (object->map()->is_observed()) { | 4860 Heap* heap = object->GetIsolate()->heap(); |
4861 // Maintain invariant that observed elements are always in dictionary mode. | 4861 if (object->map() == heap->sloppy_arguments_elements_map()) { |
Toon Verwaest
2014/06/12 21:58:03
Are you sure this can ever happen? We never handle
Jakob Kummerow
2014/06/13 11:56:18
Agreed, I don't see how this can happen, and it do
| |
4862 Isolate* isolate = object->GetIsolate(); | 4862 FixedArray::cast(object->elements())->set( |
4863 Factory* factory = isolate->factory(); | 4863 1, heap->empty_slow_element_dictionary()); |
4864 Handle<SeededNumberDictionary> dictionary = | 4864 } else { |
4865 SeededNumberDictionary::New(isolate, 0); | 4865 object->set_elements(object->map()->GetInitialElements()); |
4866 if (object->map() == *factory->sloppy_arguments_elements_map()) { | |
4867 FixedArray::cast(object->elements())->set(1, *dictionary); | |
4868 } else { | |
4869 object->set_elements(*dictionary); | |
4870 } | |
4871 return; | |
4872 } | 4866 } |
4873 | |
4874 ElementsKind elements_kind = GetInitialFastElementsKind(); | |
4875 if (!FLAG_smi_only_arrays) { | |
4876 elements_kind = FastSmiToObjectElementsKind(elements_kind); | |
4877 } | |
4878 Handle<Map> map = JSObject::GetElementsTransitionMap(object, elements_kind); | |
4879 DisallowHeapAllocation no_gc; | |
4880 Handle<FixedArrayBase> elements(map->GetInitialElements()); | |
4881 JSObject::SetMapAndElements(object, map, elements); | |
4882 } | 4867 } |
4883 | 4868 |
4884 | 4869 |
4885 static Handle<SeededNumberDictionary> CopyFastElementsToDictionary( | 4870 static Handle<SeededNumberDictionary> CopyFastElementsToDictionary( |
4886 Handle<FixedArrayBase> array, | 4871 Handle<FixedArrayBase> array, |
4887 int length, | 4872 int length, |
4888 Handle<SeededNumberDictionary> dictionary) { | 4873 Handle<SeededNumberDictionary> dictionary) { |
4889 Isolate* isolate = array->GetIsolate(); | 4874 Isolate* isolate = array->GetIsolate(); |
4890 Factory* factory = isolate->factory(); | 4875 Factory* factory = isolate->factory(); |
4891 bool has_double_elements = array->IsFixedDoubleArray(); | 4876 bool has_double_elements = array->IsFixedDoubleArray(); |
(...skipping 12202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17094 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17079 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17095 static const char* error_messages_[] = { | 17080 static const char* error_messages_[] = { |
17096 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17081 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17097 }; | 17082 }; |
17098 #undef ERROR_MESSAGES_TEXTS | 17083 #undef ERROR_MESSAGES_TEXTS |
17099 return error_messages_[reason]; | 17084 return error_messages_[reason]; |
17100 } | 17085 } |
17101 | 17086 |
17102 | 17087 |
17103 } } // namespace v8::internal | 17088 } } // namespace v8::internal |
OLD | NEW |