| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 Handle<String> name = factory->InternalizeUtf8String("Array"); | 749 Handle<String> name = factory->InternalizeUtf8String("Array"); |
| 750 Object* raw_object = CcTest::i_isolate()->context()->global_object()-> | 750 Object* raw_object = CcTest::i_isolate()->context()->global_object()-> |
| 751 GetProperty(*name)->ToObjectChecked(); | 751 GetProperty(*name)->ToObjectChecked(); |
| 752 Handle<JSFunction> function = Handle<JSFunction>( | 752 Handle<JSFunction> function = Handle<JSFunction>( |
| 753 JSFunction::cast(raw_object)); | 753 JSFunction::cast(raw_object)); |
| 754 | 754 |
| 755 // Allocate the object. | 755 // Allocate the object. |
| 756 Handle<JSObject> object = factory->NewJSObject(function); | 756 Handle<JSObject> object = factory->NewJSObject(function); |
| 757 Handle<JSArray> array = Handle<JSArray>::cast(object); | 757 Handle<JSArray> array = Handle<JSArray>::cast(object); |
| 758 // We just initialized the VM, no heap allocation failure yet. | 758 // We just initialized the VM, no heap allocation failure yet. |
| 759 array->Initialize(0)->ToObjectChecked(); | 759 JSArray::Initialize(array, 0); |
| 760 | 760 |
| 761 // Set array length to 0. | 761 // Set array length to 0. |
| 762 array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked(); | 762 array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked(); |
| 763 CHECK_EQ(Smi::FromInt(0), array->length()); | 763 CHECK_EQ(Smi::FromInt(0), array->length()); |
| 764 // Must be in fast mode. | 764 // Must be in fast mode. |
| 765 CHECK(array->HasFastSmiOrObjectElements()); | 765 CHECK(array->HasFastSmiOrObjectElements()); |
| 766 | 766 |
| 767 // array[length] = name. | 767 // array[length] = name. |
| 768 JSReceiver::SetElement(array, 0, name, NONE, SLOPPY); | 768 JSReceiver::SetElement(array, 0, name, NONE, SLOPPY); |
| 769 CHECK_EQ(Smi::FromInt(1), array->length()); | 769 CHECK_EQ(Smi::FromInt(1), array->length()); |
| (...skipping 2964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3734 v8::Handle<v8::Object> global = CcTest::global(); | 3734 v8::Handle<v8::Object> global = CcTest::global(); |
| 3735 v8::Handle<v8::Function> g = | 3735 v8::Handle<v8::Function> g = |
| 3736 v8::Handle<v8::Function>::Cast(global->Get(v8_str("crash"))); | 3736 v8::Handle<v8::Function>::Cast(global->Get(v8_str("crash"))); |
| 3737 v8::Handle<v8::Value> args1[] = { v8_num(1) }; | 3737 v8::Handle<v8::Value> args1[] = { v8_num(1) }; |
| 3738 heap->DisableInlineAllocation(); | 3738 heap->DisableInlineAllocation(); |
| 3739 heap->set_allocation_timeout(1); | 3739 heap->set_allocation_timeout(1); |
| 3740 g->Call(global, 1, args1); | 3740 g->Call(global, 1, args1); |
| 3741 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); | 3741 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 3742 } | 3742 } |
| 3743 #endif | 3743 #endif |
| OLD | NEW |