Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 516 // There's actually no way to see the difference between a fixed array and | 516 // There's actually no way to see the difference between a fixed array and |
| 517 // a deoptimization data array. Since this is used for asserts we can check | 517 // a deoptimization data array. Since this is used for asserts we can check |
| 518 // that the length is plausible though. | 518 // that the length is plausible though. |
| 519 if (FixedArray::cast(this)->length() % 2 != 0) return false; | 519 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
| 520 return true; | 520 return true; |
| 521 } | 521 } |
| 522 | 522 |
| 523 | 523 |
| 524 bool Object::IsContext() { | 524 bool Object::IsContext() { |
| 525 if (Object::IsHeapObject()) { | 525 if (Object::IsHeapObject()) { |
| 526 Heap* heap = HeapObject::cast(this)->GetHeap(); | 526 Map* map = HeapObject::cast(this)->map(); |
| 527 return (HeapObject::cast(this)->map() == heap->context_map() || | 527 Heap* heap = map->GetHeap(); |
| 528 HeapObject::cast(this)->map() == heap->catch_context_map() || | 528 return (map == heap->function_context_map() || |
| 529 HeapObject::cast(this)->map() == heap->global_context_map()); | 529 map == heap->catch_context_map() || |
| 530 map == heap->with_context_map() || | |
| 531 map == heap->global_context_map()); | |
| 530 } | 532 } |
| 531 return false; | 533 return false; |
| 532 } | 534 } |
| 533 | 535 |
| 534 | 536 |
| 535 bool Object::IsCatchContext() { | |
|
Kevin Millikin (Chromium)
2011/06/08 16:35:52
We only ever ask this of Contexts, so I just moved
| |
| 536 return Object::IsHeapObject() && | |
| 537 HeapObject::cast(this)->map() == | |
| 538 HeapObject::cast(this)->GetHeap()->catch_context_map(); | |
| 539 } | |
| 540 | |
| 541 | |
| 542 bool Object::IsGlobalContext() { | 537 bool Object::IsGlobalContext() { |
| 543 return Object::IsHeapObject() && | 538 return Object::IsHeapObject() && |
| 544 HeapObject::cast(this)->map() == | 539 HeapObject::cast(this)->map() == |
| 545 HeapObject::cast(this)->GetHeap()->global_context_map(); | 540 HeapObject::cast(this)->GetHeap()->global_context_map(); |
| 546 } | 541 } |
| 547 | 542 |
| 548 | 543 |
| 549 bool Object::IsJSFunction() { | 544 bool Object::IsJSFunction() { |
| 550 return Object::IsHeapObject() | 545 return Object::IsHeapObject() |
| 551 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE; | 546 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE; |
| (...skipping 3754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4306 #undef WRITE_INT_FIELD | 4301 #undef WRITE_INT_FIELD |
| 4307 #undef READ_SHORT_FIELD | 4302 #undef READ_SHORT_FIELD |
| 4308 #undef WRITE_SHORT_FIELD | 4303 #undef WRITE_SHORT_FIELD |
| 4309 #undef READ_BYTE_FIELD | 4304 #undef READ_BYTE_FIELD |
| 4310 #undef WRITE_BYTE_FIELD | 4305 #undef WRITE_BYTE_FIELD |
| 4311 | 4306 |
| 4312 | 4307 |
| 4313 } } // namespace v8::internal | 4308 } } // namespace v8::internal |
| 4314 | 4309 |
| 4315 #endif // V8_OBJECTS_INL_H_ | 4310 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |