OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 class Descriptor BASE_EMBEDDED { | 42 class Descriptor BASE_EMBEDDED { |
43 public: | 43 public: |
44 static int IndexFromValue(Object* value) { | 44 static int IndexFromValue(Object* value) { |
45 return Smi::cast(value)->value(); | 45 return Smi::cast(value)->value(); |
46 } | 46 } |
47 | 47 |
48 MUST_USE_RESULT MaybeObject* KeyToSymbol() { | 48 MUST_USE_RESULT MaybeObject* KeyToSymbol() { |
49 if (!StringShape(key_).IsSymbol()) { | 49 if (!StringShape(key_).IsSymbol()) { |
50 Object* result; | 50 Object* result; |
51 { MaybeObject* maybe_result = Heap::LookupSymbol(key_); | 51 { MaybeObject* maybe_result = HEAP->LookupSymbol(key_); |
52 if (!maybe_result->ToObject(&result)) return maybe_result; | 52 if (!maybe_result->ToObject(&result)) return maybe_result; |
53 } | 53 } |
54 key_ = String::cast(result); | 54 key_ = String::cast(result); |
55 } | 55 } |
56 return key_; | 56 return key_; |
57 } | 57 } |
58 | 58 |
59 String* GetKey() { return key_; } | 59 String* GetKey() { return key_; } |
60 Object* GetValue() { return value_; } | 60 Object* GetValue() { return value_; } |
61 PropertyDetails GetDetails() { return details_; } | 61 PropertyDetails GetDetails() { return details_; } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 JSFunction* GetConstantFunctionFromMap(Map* map) { | 299 JSFunction* GetConstantFunctionFromMap(Map* map) { |
300 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 300 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
301 ASSERT(type() == CONSTANT_FUNCTION); | 301 ASSERT(type() == CONSTANT_FUNCTION); |
302 return JSFunction::cast(map->instance_descriptors()->GetValue(number_)); | 302 return JSFunction::cast(map->instance_descriptors()->GetValue(number_)); |
303 } | 303 } |
304 | 304 |
305 Object* GetCallbackObject() { | 305 Object* GetCallbackObject() { |
306 if (lookup_type_ == CONSTANT_TYPE) { | 306 if (lookup_type_ == CONSTANT_TYPE) { |
307 // For now we only have the __proto__ as constant type. | 307 // For now we only have the __proto__ as constant type. |
308 return Heap::prototype_accessors(); | 308 return HEAP->prototype_accessors(); |
309 } | 309 } |
310 return GetValue(); | 310 return GetValue(); |
311 } | 311 } |
312 | 312 |
313 #ifdef OBJECT_PRINT | 313 #ifdef OBJECT_PRINT |
314 void Print(FILE* out); | 314 void Print(FILE* out); |
315 #endif | 315 #endif |
316 | 316 |
317 Object* GetValue() { | 317 Object* GetValue() { |
318 if (lookup_type_ == DESCRIPTOR_TYPE) { | 318 if (lookup_type_ == DESCRIPTOR_TYPE) { |
319 DescriptorArray* descriptors = holder()->map()->instance_descriptors(); | 319 DescriptorArray* descriptors = holder()->map()->instance_descriptors(); |
320 return descriptors->GetValue(number_); | 320 return descriptors->GetValue(number_); |
321 } | 321 } |
322 // In the dictionary case, the data is held in the value field. | 322 // In the dictionary case, the data is held in the value field. |
323 ASSERT(lookup_type_ == DICTIONARY_TYPE); | 323 ASSERT(lookup_type_ == DICTIONARY_TYPE); |
324 return holder()->GetNormalizedProperty(this); | 324 return holder()->GetNormalizedProperty(this); |
325 } | 325 } |
326 | 326 |
327 private: | 327 private: |
328 JSObject* holder_; | 328 JSObject* holder_; |
329 int number_; | 329 int number_; |
330 bool cacheable_; | 330 bool cacheable_; |
331 PropertyDetails details_; | 331 PropertyDetails details_; |
332 }; | 332 }; |
333 | 333 |
334 | 334 |
335 } } // namespace v8::internal | 335 } } // namespace v8::internal |
336 | 336 |
337 #endif // V8_PROPERTY_H_ | 337 #endif // V8_PROPERTY_H_ |
OLD | NEW |