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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 delete[] str; | 966 delete[] str; |
967 | 967 |
968 // Add a Map object to look for. | 968 // Add a Map object to look for. |
969 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); | 969 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); |
970 | 970 |
971 CHECK_EQ(objs_count, next_objs_index); | 971 CHECK_EQ(objs_count, next_objs_index); |
972 CHECK_EQ(objs_count, ObjectsFoundInHeap(CcTest::heap(), objs, objs_count)); | 972 CHECK_EQ(objs_count, ObjectsFoundInHeap(CcTest::heap(), objs, objs_count)); |
973 } | 973 } |
974 | 974 |
975 | 975 |
| 976 TEST(EmptyHandleEscapeFrom) { |
| 977 CcTest::InitializeVM(); |
| 978 |
| 979 v8::HandleScope scope(CcTest::isolate()); |
| 980 Handle<JSObject> runaway; |
| 981 |
| 982 { |
| 983 v8::EscapableHandleScope nested(CcTest::isolate()); |
| 984 Handle<JSObject> empty; |
| 985 runaway = empty.EscapeFrom(&nested); |
| 986 } |
| 987 |
| 988 CHECK(runaway.is_null()); |
| 989 } |
| 990 |
| 991 |
976 static int LenFromSize(int size) { | 992 static int LenFromSize(int size) { |
977 return (size - FixedArray::kHeaderSize) / kPointerSize; | 993 return (size - FixedArray::kHeaderSize) / kPointerSize; |
978 } | 994 } |
979 | 995 |
980 | 996 |
981 TEST(Regression39128) { | 997 TEST(Regression39128) { |
982 // Test case for crbug.com/39128. | 998 // Test case for crbug.com/39128. |
983 CcTest::InitializeVM(); | 999 CcTest::InitializeVM(); |
984 Isolate* isolate = CcTest::i_isolate(); | 1000 Isolate* isolate = CcTest::i_isolate(); |
985 TestHeap* heap = CcTest::test_heap(); | 1001 TestHeap* heap = CcTest::test_heap(); |
(...skipping 5051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6037 array->address(), | 6053 array->address(), |
6038 array->address() + array->Size()); | 6054 array->address() + array->Size()); |
6039 DCHECK(reinterpret_cast<void*>(buffer->Get(1)) == | 6055 DCHECK(reinterpret_cast<void*>(buffer->Get(1)) == |
6040 HeapObject::RawField(heap->empty_fixed_array(), | 6056 HeapObject::RawField(heap->empty_fixed_array(), |
6041 FixedArrayBase::kLengthOffset)); | 6057 FixedArrayBase::kLengthOffset)); |
6042 DCHECK(reinterpret_cast<void*>(buffer->Get(2)) == | 6058 DCHECK(reinterpret_cast<void*>(buffer->Get(2)) == |
6043 HeapObject::RawField(heap->empty_fixed_array(), | 6059 HeapObject::RawField(heap->empty_fixed_array(), |
6044 FixedArrayBase::kLengthOffset)); | 6060 FixedArrayBase::kLengthOffset)); |
6045 delete buffer; | 6061 delete buffer; |
6046 } | 6062 } |
OLD | NEW |