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 4393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4404 | 4404 |
4405 object->set_properties(*fields); | 4405 object->set_properties(*fields); |
4406 DCHECK(object->IsJSObject()); | 4406 DCHECK(object->IsJSObject()); |
4407 | 4407 |
4408 // Check that it really works. | 4408 // Check that it really works. |
4409 DCHECK(object->HasFastProperties()); | 4409 DCHECK(object->HasFastProperties()); |
4410 } | 4410 } |
4411 | 4411 |
4412 | 4412 |
4413 void JSObject::ResetElements(Handle<JSObject> object) { | 4413 void JSObject::ResetElements(Handle<JSObject> object) { |
4414 Heap* heap = object->GetIsolate()->heap(); | 4414 Isolate* isolate = object->GetIsolate(); |
4415 CHECK(object->map() != heap->sloppy_arguments_elements_map()); | 4415 CHECK(object->map() != isolate->heap()->sloppy_arguments_elements_map()); |
4416 object->set_elements(object->map()->GetInitialElements()); | 4416 if (object->map()->has_dictionary_elements()) { |
| 4417 Handle<SeededNumberDictionary> new_elements = |
| 4418 SeededNumberDictionary::New(isolate, 0); |
| 4419 object->set_elements(*new_elements); |
| 4420 } else { |
| 4421 object->set_elements(object->map()->GetInitialElements()); |
| 4422 } |
4417 } | 4423 } |
4418 | 4424 |
4419 | 4425 |
4420 static Handle<SeededNumberDictionary> CopyFastElementsToDictionary( | 4426 static Handle<SeededNumberDictionary> CopyFastElementsToDictionary( |
4421 Handle<FixedArrayBase> array, | 4427 Handle<FixedArrayBase> array, |
4422 int length, | 4428 int length, |
4423 Handle<SeededNumberDictionary> dictionary) { | 4429 Handle<SeededNumberDictionary> dictionary) { |
4424 Isolate* isolate = array->GetIsolate(); | 4430 Isolate* isolate = array->GetIsolate(); |
4425 Factory* factory = isolate->factory(); | 4431 Factory* factory = isolate->factory(); |
4426 bool has_double_elements = array->IsFixedDoubleArray(); | 4432 bool has_double_elements = array->IsFixedDoubleArray(); |
(...skipping 11983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16410 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16416 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16411 static const char* error_messages_[] = { | 16417 static const char* error_messages_[] = { |
16412 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16418 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16413 }; | 16419 }; |
16414 #undef ERROR_MESSAGES_TEXTS | 16420 #undef ERROR_MESSAGES_TEXTS |
16415 return error_messages_[reason]; | 16421 return error_messages_[reason]; |
16416 } | 16422 } |
16417 | 16423 |
16418 | 16424 |
16419 } } // namespace v8::internal | 16425 } } // namespace v8::internal |
OLD | NEW |