OLD | NEW |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // | 42 // |
43 | 43 |
44 class Descriptor BASE_EMBEDDED { | 44 class Descriptor BASE_EMBEDDED { |
45 public: | 45 public: |
46 static int IndexFromValue(Object* value) { | 46 static int IndexFromValue(Object* value) { |
47 return Smi::cast(value)->value(); | 47 return Smi::cast(value)->value(); |
48 } | 48 } |
49 | 49 |
50 MUST_USE_RESULT MaybeObject* KeyToSymbol() { | 50 MUST_USE_RESULT MaybeObject* KeyToSymbol() { |
51 if (!StringShape(key_).IsSymbol()) { | 51 if (!StringShape(key_).IsSymbol()) { |
52 Object* result; | 52 MaybeObject* maybe_result = HEAP->LookupSymbol(key_); |
53 { MaybeObject* maybe_result = HEAP->LookupSymbol(key_); | 53 if (!maybe_result->To(&key_)) return maybe_result; |
54 if (!maybe_result->ToObject(&result)) return maybe_result; | |
55 } | |
56 key_ = String::cast(result); | |
57 } | 54 } |
58 return key_; | 55 return key_; |
59 } | 56 } |
60 | 57 |
61 String* GetKey() { return key_; } | 58 String* GetKey() { return key_; } |
62 Object* GetValue() { return value_; } | 59 Object* GetValue() { return value_; } |
63 PropertyDetails GetDetails() { return details_; } | 60 PropertyDetails GetDetails() { return details_; } |
64 | 61 |
65 #ifdef OBJECT_PRINT | 62 #ifdef OBJECT_PRINT |
66 void Print(FILE* out); | 63 void Print(FILE* out); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 JSReceiver* holder_; | 400 JSReceiver* holder_; |
404 int number_; | 401 int number_; |
405 bool cacheable_; | 402 bool cacheable_; |
406 PropertyDetails details_; | 403 PropertyDetails details_; |
407 }; | 404 }; |
408 | 405 |
409 | 406 |
410 } } // namespace v8::internal | 407 } } // namespace v8::internal |
411 | 408 |
412 #endif // V8_PROPERTY_H_ | 409 #endif // V8_PROPERTY_H_ |
OLD | NEW |