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

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

Issue 10876067: Introduce global contexts to represent lexical global scope(s). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Sven's comments. Created 8 years, 3 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-debug.cc ('k') | src/runtime.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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()) return false;
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 } 580 map == heap->global_context_map());
581 return false;
582 } 581 }
583 582
584 583
585 bool Object::IsNativeContext() { 584 bool Object::IsNativeContext() {
586 return Object::IsHeapObject() && 585 return Object::IsHeapObject() &&
587 HeapObject::cast(this)->map() == 586 HeapObject::cast(this)->map() ==
588 HeapObject::cast(this)->GetHeap()->native_context_map(); 587 HeapObject::cast(this)->GetHeap()->native_context_map();
589 } 588 }
590 589
591 590
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() { 591 bool Object::IsScopeInfo() {
600 return Object::IsHeapObject() && 592 return Object::IsHeapObject() &&
601 HeapObject::cast(this)->map() == 593 HeapObject::cast(this)->map() ==
602 HeapObject::cast(this)->GetHeap()->scope_info_map(); 594 HeapObject::cast(this)->GetHeap()->scope_info_map();
603 } 595 }
604 596
605 597
606 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) 598 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE)
607 599
608 600
(...skipping 4771 matching lines...) Expand 10 before | Expand all | Expand 10 after
5380 #undef WRITE_UINT32_FIELD 5372 #undef WRITE_UINT32_FIELD
5381 #undef READ_SHORT_FIELD 5373 #undef READ_SHORT_FIELD
5382 #undef WRITE_SHORT_FIELD 5374 #undef WRITE_SHORT_FIELD
5383 #undef READ_BYTE_FIELD 5375 #undef READ_BYTE_FIELD
5384 #undef WRITE_BYTE_FIELD 5376 #undef WRITE_BYTE_FIELD
5385 5377
5386 5378
5387 } } // namespace v8::internal 5379 } } // namespace v8::internal
5388 5380
5389 #endif // V8_OBJECTS_INL_H_ 5381 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698