Chromium Code Reviews| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 if (!IsFixedArray()) return false; | 561 if (!IsFixedArray()) return false; |
| 562 // There's actually no way to see the difference between a fixed array and | 562 // There's actually no way to see the difference between a fixed array and |
| 563 // a cache cells array. Since this is used for asserts we can check that | 563 // a cache cells array. Since this is used for asserts we can check that |
| 564 // the length is plausible though. | 564 // the length is plausible though. |
| 565 if (FixedArray::cast(this)->length() % 2 != 0) return false; | 565 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
| 566 return true; | 566 return true; |
| 567 } | 567 } |
| 568 | 568 |
| 569 | 569 |
| 570 bool Object::IsContext() { | 570 bool Object::IsContext() { |
| 571 if (Object::IsHeapObject()) { | 571 if (Object::IsHeapObject()) { |
|
Sven Panne
2012/08/27 06:24:54
Using 'if (!Object::IsHeapObject()) return false;'
rossberg
2012/08/27 09:07:16
Done.
| |
| 572 Map* map = HeapObject::cast(this)->map(); | 572 Map* map = HeapObject::cast(this)->map(); |
| 573 Heap* heap = map->GetHeap(); | 573 Heap* heap = map->GetHeap(); |
| 574 return (map == heap->function_context_map() || | 574 return (map == heap->function_context_map() || |
| 575 map == heap->catch_context_map() || | 575 map == heap->catch_context_map() || |
| 576 map == heap->with_context_map() || | 576 map == heap->with_context_map() || |
| 577 map == heap->native_context_map() || | 577 map == heap->native_context_map() || |
| 578 map == heap->block_context_map() || | 578 map == heap->block_context_map() || |
| 579 map == heap->module_context_map()); | 579 map == heap->module_context_map() || |
| 580 map == heap->global_context_map()); | |
| 580 } | 581 } |
| 581 return false; | 582 return false; |
| 582 } | 583 } |
| 583 | 584 |
| 584 | 585 |
| 585 bool Object::IsNativeContext() { | 586 bool Object::IsNativeContext() { |
| 586 return Object::IsHeapObject() && | 587 return Object::IsHeapObject() && |
| 587 HeapObject::cast(this)->map() == | 588 HeapObject::cast(this)->map() == |
| 588 HeapObject::cast(this)->GetHeap()->native_context_map(); | 589 HeapObject::cast(this)->GetHeap()->native_context_map(); |
| 589 } | 590 } |
| 590 | 591 |
| 591 | 592 |
| 592 bool Object::IsModuleContext() { | |
| 593 return Object::IsHeapObject() && | |
| 594 HeapObject::cast(this)->map() == | |
| 595 HeapObject::cast(this)->GetHeap()->module_context_map(); | |
| 596 } | |
| 597 | |
| 598 | |
| 599 bool Object::IsScopeInfo() { | 593 bool Object::IsScopeInfo() { |
| 600 return Object::IsHeapObject() && | 594 return Object::IsHeapObject() && |
| 601 HeapObject::cast(this)->map() == | 595 HeapObject::cast(this)->map() == |
| 602 HeapObject::cast(this)->GetHeap()->scope_info_map(); | 596 HeapObject::cast(this)->GetHeap()->scope_info_map(); |
| 603 } | 597 } |
| 604 | 598 |
| 605 | 599 |
| 606 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) | 600 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) |
| 607 | 601 |
| 608 | 602 |
| (...skipping 4771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5380 #undef WRITE_UINT32_FIELD | 5374 #undef WRITE_UINT32_FIELD |
| 5381 #undef READ_SHORT_FIELD | 5375 #undef READ_SHORT_FIELD |
| 5382 #undef WRITE_SHORT_FIELD | 5376 #undef WRITE_SHORT_FIELD |
| 5383 #undef READ_BYTE_FIELD | 5377 #undef READ_BYTE_FIELD |
| 5384 #undef WRITE_BYTE_FIELD | 5378 #undef WRITE_BYTE_FIELD |
| 5385 | 5379 |
| 5386 | 5380 |
| 5387 } } // namespace v8::internal | 5381 } } // namespace v8::internal |
| 5388 | 5382 |
| 5389 #endif // V8_OBJECTS_INL_H_ | 5383 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |