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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 | 1031 |
1032 // Allocate the object. | 1032 // Allocate the object. |
1033 Handle<Object> element; | 1033 Handle<Object> element; |
1034 Handle<JSObject> object = factory->NewJSObject(function); | 1034 Handle<JSObject> object = factory->NewJSObject(function); |
1035 Handle<JSArray> array = Handle<JSArray>::cast(object); | 1035 Handle<JSArray> array = Handle<JSArray>::cast(object); |
1036 // We just initialized the VM, no heap allocation failure yet. | 1036 // We just initialized the VM, no heap allocation failure yet. |
1037 JSArray::Initialize(array, 0); | 1037 JSArray::Initialize(array, 0); |
1038 | 1038 |
1039 // Set array length to 0. | 1039 // Set array length to 0. |
1040 JSArray::SetLength(array, 0); | 1040 JSArray::SetLength(array, 0); |
1041 CHECK_EQ(Smi::kZero, array->length()); | 1041 CHECK_EQ(Smi::FromInt(0), array->length()); |
1042 // Must be in fast mode. | 1042 // Must be in fast mode. |
1043 CHECK(array->HasFastSmiOrObjectElements()); | 1043 CHECK(array->HasFastSmiOrObjectElements()); |
1044 | 1044 |
1045 // array[length] = name. | 1045 // array[length] = name. |
1046 JSReceiver::SetElement(isolate, array, 0, name, SLOPPY).Check(); | 1046 JSReceiver::SetElement(isolate, array, 0, name, SLOPPY).Check(); |
1047 CHECK_EQ(Smi::FromInt(1), array->length()); | 1047 CHECK_EQ(Smi::FromInt(1), array->length()); |
1048 element = i::Object::GetElement(isolate, array, 0).ToHandleChecked(); | 1048 element = i::Object::GetElement(isolate, array, 0).ToHandleChecked(); |
1049 CHECK_EQ(*element, *name); | 1049 CHECK_EQ(*element, *name); |
1050 | 1050 |
1051 // Set array length with larger than smi value. | 1051 // Set array length with larger than smi value. |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 } | 1537 } |
1538 | 1538 |
1539 // Simulate incremental marking so that the function is enqueued as | 1539 // Simulate incremental marking so that the function is enqueued as |
1540 // code flushing candidate. | 1540 // code flushing candidate. |
1541 heap::SimulateIncrementalMarking(heap); | 1541 heap::SimulateIncrementalMarking(heap); |
1542 | 1542 |
1543 // Enable the debugger and add a breakpoint while incremental marking | 1543 // Enable the debugger and add a breakpoint while incremental marking |
1544 // is running so that incremental marking aborts and code flushing is | 1544 // is running so that incremental marking aborts and code flushing is |
1545 // disabled. | 1545 // disabled. |
1546 int position = function->shared()->start_position(); | 1546 int position = function->shared()->start_position(); |
1547 Handle<Object> breakpoint_object(Smi::kZero, isolate); | 1547 Handle<Object> breakpoint_object(Smi::FromInt(0), isolate); |
1548 EnableDebugger(CcTest::isolate()); | 1548 EnableDebugger(CcTest::isolate()); |
1549 isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); | 1549 isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); |
1550 isolate->debug()->ClearBreakPoint(breakpoint_object); | 1550 isolate->debug()->ClearBreakPoint(breakpoint_object); |
1551 DisableDebugger(CcTest::isolate()); | 1551 DisableDebugger(CcTest::isolate()); |
1552 | 1552 |
1553 // Force optimization now that code flushing is disabled. | 1553 // Force optimization now that code flushing is disabled. |
1554 { v8::HandleScope scope(CcTest::isolate()); | 1554 { v8::HandleScope scope(CcTest::isolate()); |
1555 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); | 1555 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); |
1556 } | 1556 } |
1557 | 1557 |
(...skipping 5511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7069 SlotSet::FREE_EMPTY_BUCKETS); | 7069 SlotSet::FREE_EMPTY_BUCKETS); |
7070 slots[chunk->area_end() - kPointerSize] = false; | 7070 slots[chunk->area_end() - kPointerSize] = false; |
7071 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7071 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7072 CHECK(slots[addr]); | 7072 CHECK(slots[addr]); |
7073 return KEEP_SLOT; | 7073 return KEEP_SLOT; |
7074 }); | 7074 }); |
7075 } | 7075 } |
7076 | 7076 |
7077 } // namespace internal | 7077 } // namespace internal |
7078 } // namespace v8 | 7078 } // namespace v8 |
OLD | NEW |