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

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

Issue 7737036: Reorganize object type enum, such that proxies are no longer in the middle (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Erik's comments. Created 9 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.h ('k') | src/x64/full-codegen-x64.cc » ('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 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 502 }
503 503
504 504
505 Failure* Failure::cast(MaybeObject* obj) { 505 Failure* Failure::cast(MaybeObject* obj) {
506 ASSERT(HAS_FAILURE_TAG(obj)); 506 ASSERT(HAS_FAILURE_TAG(obj));
507 return reinterpret_cast<Failure*>(obj); 507 return reinterpret_cast<Failure*>(obj);
508 } 508 }
509 509
510 510
511 bool Object::IsJSReceiver() { 511 bool Object::IsJSReceiver() {
512 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
512 return IsHeapObject() && 513 return IsHeapObject() &&
513 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE; 514 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE;
514 } 515 }
515 516
516 517
517 bool Object::IsJSObject() { 518 bool Object::IsJSObject() {
518 return IsJSReceiver() && !IsJSProxy(); 519 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE);
520 return IsHeapObject() &&
521 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE;
519 } 522 }
520 523
521 524
522 bool Object::IsJSProxy() { 525 bool Object::IsJSProxy() {
523 return Object::IsHeapObject() && 526 if (!Object::IsHeapObject()) return false;
524 (HeapObject::cast(this)->map()->instance_type() == JS_PROXY_TYPE || 527 InstanceType type = HeapObject::cast(this)->map()->instance_type();
525 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE); 528 return FIRST_JS_PROXY_TYPE <= type && type <= LAST_JS_PROXY_TYPE;
526 } 529 }
527 530
528 531
529 bool Object::IsJSFunctionProxy() { 532 bool Object::IsJSFunctionProxy() {
530 return Object::IsHeapObject() && 533 return Object::IsHeapObject() &&
531 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE; 534 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE;
532 } 535 }
533 536
534 537
535 bool Object::IsJSWeakMap() { 538 bool Object::IsJSWeakMap() {
(...skipping 4146 matching lines...) Expand 10 before | Expand all | Expand 10 after
4682 #undef WRITE_INT_FIELD 4685 #undef WRITE_INT_FIELD
4683 #undef READ_SHORT_FIELD 4686 #undef READ_SHORT_FIELD
4684 #undef WRITE_SHORT_FIELD 4687 #undef WRITE_SHORT_FIELD
4685 #undef READ_BYTE_FIELD 4688 #undef READ_BYTE_FIELD
4686 #undef WRITE_BYTE_FIELD 4689 #undef WRITE_BYTE_FIELD
4687 4690
4688 4691
4689 } } // namespace v8::internal 4692 } } // namespace v8::internal
4690 4693
4691 #endif // V8_OBJECTS_INL_H_ 4694 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698