OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // * Register: an element that resides in a register. | 46 // * Register: an element that resides in a register. |
47 // * Constant: an element whose value is known at compile time. | 47 // * Constant: an element whose value is known at compile time. |
48 | 48 |
49 class FrameElement BASE_EMBEDDED { | 49 class FrameElement BASE_EMBEDDED { |
50 public: | 50 public: |
51 enum SyncFlag { | 51 enum SyncFlag { |
52 NOT_SYNCED, | 52 NOT_SYNCED, |
53 SYNCED | 53 SYNCED |
54 }; | 54 }; |
55 | 55 |
56 NumberInfo::Type number_info(); | 56 inline NumberInfo::Type number_info() { |
57 void set_number_info(NumberInfo::Type info) { | 57 // Copied elements do not have number info. Instead |
| 58 // we have to inspect their backing element in the frame. |
| 59 ASSERT(!is_copy()); |
| 60 if (!is_constant()) return NumberInfoField::decode(value_); |
| 61 Handle<Object> value = handle(); |
| 62 if (value->IsSmi()) return NumberInfo::kSmi; |
| 63 if (value->IsHeapNumber()) return NumberInfo::kHeapNumber; |
| 64 return NumberInfo::kUnknown; |
| 65 } |
| 66 |
| 67 inline void set_number_info(NumberInfo::Type info) { |
58 value_ = value_ & ~NumberInfoField::mask(); | 68 value_ = value_ & ~NumberInfoField::mask(); |
59 value_ = value_ | NumberInfoField::encode(info); | 69 value_ = value_ | NumberInfoField::encode(info); |
60 } | 70 } |
61 | 71 |
62 // The default constructor creates an invalid frame element. | 72 // The default constructor creates an invalid frame element. |
63 FrameElement() { | 73 FrameElement() { |
64 value_ = TypeField::encode(INVALID) | 74 value_ = TypeField::encode(INVALID) |
65 | CopiedField::encode(false) | 75 | CopiedField::encode(false) |
66 | SyncedField::encode(false) | 76 | SyncedField::encode(false) |
67 | NumberInfoField::encode(NumberInfo::kUninitialized) | 77 | NumberInfoField::encode(NumberInfo::kUninitialized) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 class SyncedField: public BitField<bool, 4, 1> {}; | 251 class SyncedField: public BitField<bool, 4, 1> {}; |
242 class NumberInfoField: public BitField<NumberInfo::Type, 5, 3> {}; | 252 class NumberInfoField: public BitField<NumberInfo::Type, 5, 3> {}; |
243 class DataField: public BitField<uint32_t, 8, 32 - 9> {}; | 253 class DataField: public BitField<uint32_t, 8, 32 - 9> {}; |
244 | 254 |
245 friend class VirtualFrame; | 255 friend class VirtualFrame; |
246 }; | 256 }; |
247 | 257 |
248 } } // namespace v8::internal | 258 } } // namespace v8::internal |
249 | 259 |
250 #endif // V8_FRAME_ELEMENT_H_ | 260 #endif // V8_FRAME_ELEMENT_H_ |
OLD | NEW |