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 4712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4723 | 4723 |
4724 object->set_properties(*fields); | 4724 object->set_properties(*fields); |
4725 DCHECK(object->IsJSObject()); | 4725 DCHECK(object->IsJSObject()); |
4726 | 4726 |
4727 // Check that it really works. | 4727 // Check that it really works. |
4728 DCHECK(object->HasFastProperties()); | 4728 DCHECK(object->HasFastProperties()); |
4729 } | 4729 } |
4730 | 4730 |
4731 | 4731 |
4732 void JSObject::ResetElements(Handle<JSObject> object) { | 4732 void JSObject::ResetElements(Handle<JSObject> object) { |
4733 Heap* heap = object->GetIsolate()->heap(); | 4733 Isolate* isolate = object->GetIsolate(); |
4734 CHECK(object->map() != heap->sloppy_arguments_elements_map()); | 4734 CHECK(object->map() != isolate->heap()->sloppy_arguments_elements_map()); |
4735 object->set_elements(object->map()->GetInitialElements()); | 4735 if (object->map()->has_dictionary_elements()) { |
| 4736 Handle<SeededNumberDictionary> new_elements = |
| 4737 SeededNumberDictionary::New(isolate, 0); |
| 4738 object->set_elements(*new_elements); |
| 4739 } else { |
| 4740 object->set_elements(object->map()->GetInitialElements()); |
| 4741 } |
4736 } | 4742 } |
4737 | 4743 |
4738 | 4744 |
4739 static Handle<SeededNumberDictionary> CopyFastElementsToDictionary( | 4745 static Handle<SeededNumberDictionary> CopyFastElementsToDictionary( |
4740 Handle<FixedArrayBase> array, | 4746 Handle<FixedArrayBase> array, |
4741 int length, | 4747 int length, |
4742 Handle<SeededNumberDictionary> dictionary) { | 4748 Handle<SeededNumberDictionary> dictionary) { |
4743 Isolate* isolate = array->GetIsolate(); | 4749 Isolate* isolate = array->GetIsolate(); |
4744 Factory* factory = isolate->factory(); | 4750 Factory* factory = isolate->factory(); |
4745 bool has_double_elements = array->IsFixedDoubleArray(); | 4751 bool has_double_elements = array->IsFixedDoubleArray(); |
(...skipping 12191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16937 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16943 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16938 static const char* error_messages_[] = { | 16944 static const char* error_messages_[] = { |
16939 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16945 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16940 }; | 16946 }; |
16941 #undef ERROR_MESSAGES_TEXTS | 16947 #undef ERROR_MESSAGES_TEXTS |
16942 return error_messages_[reason]; | 16948 return error_messages_[reason]; |
16943 } | 16949 } |
16944 | 16950 |
16945 | 16951 |
16946 } } // namespace v8::internal | 16952 } } // namespace v8::internal |
OLD | NEW |