OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 // buffer that is plenty big enough for any floating point number, then | 1179 // buffer that is plenty big enough for any floating point number, then |
1180 // print that using vsnprintf (which may truncate but never allocate if | 1180 // print that using vsnprintf (which may truncate but never allocate if |
1181 // there is no more space in the buffer). | 1181 // there is no more space in the buffer). |
1182 EmbeddedVector<char, 100> buffer; | 1182 EmbeddedVector<char, 100> buffer; |
1183 OS::SNPrintF(buffer, "%.16g", Number()); | 1183 OS::SNPrintF(buffer, "%.16g", Number()); |
1184 accumulator->Add("%s", buffer.start()); | 1184 accumulator->Add("%s", buffer.start()); |
1185 } | 1185 } |
1186 | 1186 |
1187 | 1187 |
1188 String* JSObject::class_name() { | 1188 String* JSObject::class_name() { |
1189 if (IsJSFunction()) return Heap::function_class_symbol(); | 1189 if (IsJSFunction()) { |
| 1190 return Heap::function_class_symbol(); |
| 1191 } |
1190 if (map()->constructor()->IsJSFunction()) { | 1192 if (map()->constructor()->IsJSFunction()) { |
1191 JSFunction* constructor = JSFunction::cast(map()->constructor()); | 1193 JSFunction* constructor = JSFunction::cast(map()->constructor()); |
1192 return String::cast(constructor->shared()->instance_class_name()); | 1194 return String::cast(constructor->shared()->instance_class_name()); |
1193 } | 1195 } |
1194 // If the constructor is not present, return "Object". | 1196 // If the constructor is not present, return "Object". |
1195 return Heap::Object_symbol(); | 1197 return Heap::Object_symbol(); |
1196 } | 1198 } |
1197 | 1199 |
1198 | 1200 |
| 1201 String* JSObject::constructor_name() { |
| 1202 if (IsJSFunction()) { |
| 1203 return Heap::function_class_symbol(); |
| 1204 } |
| 1205 if (map()->constructor()->IsJSFunction()) { |
| 1206 JSFunction* constructor = JSFunction::cast(map()->constructor()); |
| 1207 String* name = String::cast(constructor->shared()->name()); |
| 1208 return name->length() > 0 ? name : constructor->shared()->inferred_name(); |
| 1209 } |
| 1210 // If the constructor is not present, return "Object". |
| 1211 return Heap::Object_symbol(); |
| 1212 } |
| 1213 |
| 1214 |
1199 void JSObject::JSObjectIterateBody(int object_size, ObjectVisitor* v) { | 1215 void JSObject::JSObjectIterateBody(int object_size, ObjectVisitor* v) { |
1200 // Iterate over all fields in the body. Assumes all are Object*. | 1216 // Iterate over all fields in the body. Assumes all are Object*. |
1201 IteratePointers(v, kPropertiesOffset, object_size); | 1217 IteratePointers(v, kPropertiesOffset, object_size); |
1202 } | 1218 } |
1203 | 1219 |
1204 | 1220 |
1205 Object* JSObject::AddFastPropertyUsingMap(Map* new_map, | 1221 Object* JSObject::AddFastPropertyUsingMap(Map* new_map, |
1206 String* name, | 1222 String* name, |
1207 Object* value) { | 1223 Object* value) { |
1208 int index = new_map->PropertyIndexFor(name); | 1224 int index = new_map->PropertyIndexFor(name); |
(...skipping 6790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7999 if (break_point_objects()->IsUndefined()) return 0; | 8015 if (break_point_objects()->IsUndefined()) return 0; |
8000 // Single beak point. | 8016 // Single beak point. |
8001 if (!break_point_objects()->IsFixedArray()) return 1; | 8017 if (!break_point_objects()->IsFixedArray()) return 1; |
8002 // Multiple break points. | 8018 // Multiple break points. |
8003 return FixedArray::cast(break_point_objects())->length(); | 8019 return FixedArray::cast(break_point_objects())->length(); |
8004 } | 8020 } |
8005 #endif | 8021 #endif |
8006 | 8022 |
8007 | 8023 |
8008 } } // namespace v8::internal | 8024 } } // namespace v8::internal |
OLD | NEW |