Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 | 2 |
| 3 #include <stdlib.h> | 3 #include <stdlib.h> |
| 4 | 4 |
| 5 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "execution.h" | 7 #include "execution.h" |
| 8 #include "factory.h" | 8 #include "factory.h" |
| 9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
| 10 #include "global-handles.h" | 10 #include "global-handles.h" |
| 11 #include "cctest.h" | 11 #include "cctest.h" |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 | 665 |
| 666 // Allocate the object. | 666 // Allocate the object. |
| 667 Handle<JSObject> object = FACTORY->NewJSObject(function); | 667 Handle<JSObject> object = FACTORY->NewJSObject(function); |
| 668 Handle<JSArray> array = Handle<JSArray>::cast(object); | 668 Handle<JSArray> array = Handle<JSArray>::cast(object); |
| 669 // We just initialized the VM, no heap allocation failure yet. | 669 // We just initialized the VM, no heap allocation failure yet. |
| 670 Object* ok = array->Initialize(0)->ToObjectChecked(); | 670 Object* ok = array->Initialize(0)->ToObjectChecked(); |
| 671 | 671 |
| 672 // Set array length to 0. | 672 // Set array length to 0. |
| 673 ok = array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked(); | 673 ok = array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked(); |
| 674 CHECK_EQ(Smi::FromInt(0), array->length()); | 674 CHECK_EQ(Smi::FromInt(0), array->length()); |
| 675 CHECK(array->HasFastElements()); // Must be in fast mode. | 675 // Must be in fast mode. |
| 676 CHECK(array->HasFastElements() || array->HasFastSmiOnlyElements()); | |
|
Sven Panne
2011/09/16 09:19:32
This disjunction occurs quite frequently, perhaps
danno
2011/09/21 14:32:04
Done.
| |
| 676 | 677 |
| 677 // array[length] = name. | 678 // array[length] = name. |
| 678 ok = array->SetElement(0, *name, kNonStrictMode, true)->ToObjectChecked(); | 679 ok = array->SetElement(0, *name, kNonStrictMode, true)->ToObjectChecked(); |
| 679 CHECK_EQ(Smi::FromInt(1), array->length()); | 680 CHECK_EQ(Smi::FromInt(1), array->length()); |
| 680 CHECK_EQ(array->GetElement(0), *name); | 681 CHECK_EQ(array->GetElement(0), *name); |
| 681 | 682 |
| 682 // Set array length with larger than smi value. | 683 // Set array length with larger than smi value. |
| 683 Handle<Object> length = | 684 Handle<Object> length = |
| 684 FACTORY->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1); | 685 FACTORY->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1); |
| 685 ok = array->SetElementsLength(*length)->ToObjectChecked(); | 686 ok = array->SetElementsLength(*length)->ToObjectChecked(); |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1320 CHECK(helper.b_found()); | 1321 CHECK(helper.b_found()); |
| 1321 } | 1322 } |
| 1322 // ...but is now unreachable. | 1323 // ...but is now unreachable. |
| 1323 { | 1324 { |
| 1324 HeapIteratorTestHelper helper(a_saved, *b); | 1325 HeapIteratorTestHelper helper(a_saved, *b); |
| 1325 helper.IterateHeap(HeapIterator::kFilterUnreachable); | 1326 helper.IterateHeap(HeapIterator::kFilterUnreachable); |
| 1326 CHECK(!helper.a_found()); | 1327 CHECK(!helper.a_found()); |
| 1327 CHECK(helper.b_found()); | 1328 CHECK(helper.b_found()); |
| 1328 } | 1329 } |
| 1329 } | 1330 } |
| OLD | NEW |