Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: src/objects-inl.h

Issue 209473006: Ensure that we don't mark weak heap references in the constant pool array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: replace with CHECK Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 } 2277 }
2278 2278
2279 2279
2280 void FixedDoubleArray::FillWithHoles(int from, int to) { 2280 void FixedDoubleArray::FillWithHoles(int from, int to) {
2281 for (int i = from; i < to; i++) { 2281 for (int i = from; i < to; i++) {
2282 set_the_hole(i); 2282 set_the_hole(i);
2283 } 2283 }
2284 } 2284 }
2285 2285
2286 2286
2287 SMI_ACCESSORS( 2287 void ConstantPoolArray::set_weak_object_state(
2288 ConstantPoolArray, first_code_ptr_index, kFirstCodePointerIndexOffset) 2288 ConstantPoolArray::WeakObjectState state) {
2289 SMI_ACCESSORS( 2289 int old_layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
2290 ConstantPoolArray, first_heap_ptr_index, kFirstHeapPointerIndexOffset) 2290 int new_layout_field = WeakObjectStateField::update(old_layout_field, state);
2291 SMI_ACCESSORS( 2291 WRITE_INT_FIELD(this, kArrayLayoutOffset, new_layout_field);
2292 ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset) 2292 }
2293
2294
2295 ConstantPoolArray::WeakObjectState ConstantPoolArray::get_weak_object_state() {
2296 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
2297 return WeakObjectStateField::decode(layout_field);
2298 }
2293 2299
2294 2300
2295 int ConstantPoolArray::first_int64_index() { 2301 int ConstantPoolArray::first_int64_index() {
2296 return 0; 2302 return 0;
2297 } 2303 }
2298 2304
2299 2305
2306 int ConstantPoolArray::first_code_ptr_index() {
2307 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
2308 return first_int64_index() +
2309 NumberOfInt64EntriesField::decode(layout_field);
2310 }
2311
2312
2313 int ConstantPoolArray::first_heap_ptr_index() {
2314 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
2315 return first_code_ptr_index() +
2316 NumberOfCodePtrEntriesField::decode(layout_field);
2317 }
2318
2319
2320 int ConstantPoolArray::first_int32_index() {
2321 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset);
2322 return first_heap_ptr_index() +
2323 NumberOfHeapPtrEntriesField::decode(layout_field);
2324 }
2325
2326
2300 int ConstantPoolArray::count_of_int64_entries() { 2327 int ConstantPoolArray::count_of_int64_entries() {
2301 return first_code_ptr_index(); 2328 return first_code_ptr_index();
2302 } 2329 }
2303 2330
2304 2331
2305 int ConstantPoolArray::count_of_code_ptr_entries() { 2332 int ConstantPoolArray::count_of_code_ptr_entries() {
2306 return first_heap_ptr_index() - first_code_ptr_index(); 2333 return first_heap_ptr_index() - first_code_ptr_index();
2307 } 2334 }
2308 2335
2309 2336
2310 int ConstantPoolArray::count_of_heap_ptr_entries() { 2337 int ConstantPoolArray::count_of_heap_ptr_entries() {
2311 return first_int32_index() - first_heap_ptr_index(); 2338 return first_int32_index() - first_heap_ptr_index();
2312 } 2339 }
2313 2340
2314 2341
2315 int ConstantPoolArray::count_of_int32_entries() { 2342 int ConstantPoolArray::count_of_int32_entries() {
2316 return length() - first_int32_index(); 2343 return length() - first_int32_index();
2317 } 2344 }
2318 2345
2319 2346
2320 void ConstantPoolArray::SetEntryCounts(int number_of_int64_entries, 2347 void ConstantPoolArray::Init(int number_of_int64_entries,
2321 int number_of_code_ptr_entries, 2348 int number_of_code_ptr_entries,
2322 int number_of_heap_ptr_entries, 2349 int number_of_heap_ptr_entries,
2323 int number_of_int32_entries) { 2350 int number_of_int32_entries) {
2324 int current_index = number_of_int64_entries; 2351 set_length(number_of_int64_entries +
2325 set_first_code_ptr_index(current_index); 2352 number_of_code_ptr_entries +
2326 current_index += number_of_code_ptr_entries; 2353 number_of_heap_ptr_entries +
2327 set_first_heap_ptr_index(current_index); 2354 number_of_int32_entries);
2328 current_index += number_of_heap_ptr_entries; 2355 int layout_field =
2329 set_first_int32_index(current_index); 2356 NumberOfInt64EntriesField::encode(number_of_int64_entries) |
2330 current_index += number_of_int32_entries; 2357 NumberOfCodePtrEntriesField::encode(number_of_code_ptr_entries) |
2331 set_length(current_index); 2358 NumberOfHeapPtrEntriesField::encode(number_of_heap_ptr_entries) |
2359 WeakObjectStateField::encode(NO_WEAK_OBJECTS);
2360 WRITE_INT_FIELD(this, kArrayLayoutOffset, layout_field);
2332 } 2361 }
2333 2362
2334 2363
2335 int64_t ConstantPoolArray::get_int64_entry(int index) { 2364 int64_t ConstantPoolArray::get_int64_entry(int index) {
2336 ASSERT(map() == GetHeap()->constant_pool_array_map()); 2365 ASSERT(map() == GetHeap()->constant_pool_array_map());
2337 ASSERT(index >= 0 && index < first_code_ptr_index()); 2366 ASSERT(index >= 0 && index < first_code_ptr_index());
2338 return READ_INT64_FIELD(this, OffsetOfElementAt(index)); 2367 return READ_INT64_FIELD(this, OffsetOfElementAt(index));
2339 } 2368 }
2340 2369
2341 double ConstantPoolArray::get_int64_entry_as_double(int index) { 2370 double ConstantPoolArray::get_int64_entry_as_double(int index) {
(...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after
4726 } 4755 }
4727 4756
4728 4757
4729 Object* Code::GetObjectFromEntryAddress(Address location_of_address) { 4758 Object* Code::GetObjectFromEntryAddress(Address location_of_address) {
4730 return HeapObject:: 4759 return HeapObject::
4731 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize); 4760 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize);
4732 } 4761 }
4733 4762
4734 4763
4735 bool Code::IsWeakObjectInOptimizedCode(Object* object) { 4764 bool Code::IsWeakObjectInOptimizedCode(Object* object) {
4736 ASSERT(is_optimized_code());
4737 if (object->IsMap()) { 4765 if (object->IsMap()) {
4738 return Map::cast(object)->CanTransition() && 4766 return Map::cast(object)->CanTransition() &&
4739 FLAG_collect_maps && 4767 FLAG_collect_maps &&
4740 FLAG_weak_embedded_maps_in_optimized_code; 4768 FLAG_weak_embedded_maps_in_optimized_code;
4741 } 4769 }
4742 if (object->IsJSObject() || 4770 if (object->IsJSObject() ||
4743 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) { 4771 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) {
4744 return FLAG_weak_embedded_objects_in_optimized_code; 4772 return FLAG_weak_embedded_objects_in_optimized_code;
4745 } 4773 }
4746 return false; 4774 return false;
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
6924 #undef READ_UINT32_FIELD 6952 #undef READ_UINT32_FIELD
6925 #undef WRITE_UINT32_FIELD 6953 #undef WRITE_UINT32_FIELD
6926 #undef READ_SHORT_FIELD 6954 #undef READ_SHORT_FIELD
6927 #undef WRITE_SHORT_FIELD 6955 #undef WRITE_SHORT_FIELD
6928 #undef READ_BYTE_FIELD 6956 #undef READ_BYTE_FIELD
6929 #undef WRITE_BYTE_FIELD 6957 #undef WRITE_BYTE_FIELD
6930 6958
6931 } } // namespace v8::internal 6959 } } // namespace v8::internal
6932 6960
6933 #endif // V8_OBJECTS_INL_H_ 6961 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698