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

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

Issue 164146: Merge r2636 to trunk (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 11 years, 4 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.cc ('k') | src/version.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 #define BOOL_ACCESSORS(holder, field, name, offset) \ 94 #define BOOL_ACCESSORS(holder, field, name, offset) \
95 bool holder::name() { \ 95 bool holder::name() { \
96 return BooleanBit::get(field(), offset); \ 96 return BooleanBit::get(field(), offset); \
97 } \ 97 } \
98 void holder::set_##name(bool value) { \ 98 void holder::set_##name(bool value) { \
99 set_##field(BooleanBit::set(field(), offset, value)); \ 99 set_##field(BooleanBit::set(field(), offset, value)); \
100 } 100 }
101 101
102 102
103 bool Object::IsInstanceOf(FunctionTemplateInfo* expected) {
104 // There is a constraint on the object; check.
105 if (!this->IsJSObject()) return false;
106 // Fetch the constructor function of the object.
107 Object* cons_obj = JSObject::cast(this)->map()->constructor();
108 if (!cons_obj->IsJSFunction()) return false;
109 JSFunction* fun = JSFunction::cast(cons_obj);
110 // Iterate through the chain of inheriting function templates to
111 // see if the required one occurs.
112 for (Object* type = fun->shared()->function_data();
113 type->IsFunctionTemplateInfo();
114 type = FunctionTemplateInfo::cast(type)->parent_template()) {
115 if (type == expected) return true;
116 }
117 // Didn't find the required type in the inheritance chain.
118 return false;
119 }
120
121
103 bool Object::IsSmi() { 122 bool Object::IsSmi() {
104 return HAS_SMI_TAG(this); 123 return HAS_SMI_TAG(this);
105 } 124 }
106 125
107 126
108 bool Object::IsHeapObject() { 127 bool Object::IsHeapObject() {
109 return HAS_HEAP_OBJECT_TAG(this); 128 return HAS_HEAP_OBJECT_TAG(this);
110 } 129 }
111 130
112 131
(...skipping 2716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 #undef WRITE_INT_FIELD 2848 #undef WRITE_INT_FIELD
2830 #undef READ_SHORT_FIELD 2849 #undef READ_SHORT_FIELD
2831 #undef WRITE_SHORT_FIELD 2850 #undef WRITE_SHORT_FIELD
2832 #undef READ_BYTE_FIELD 2851 #undef READ_BYTE_FIELD
2833 #undef WRITE_BYTE_FIELD 2852 #undef WRITE_BYTE_FIELD
2834 2853
2835 2854
2836 } } // namespace v8::internal 2855 } } // namespace v8::internal
2837 2856
2838 #endif // V8_OBJECTS_INL_H_ 2857 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698