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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 class LOperand : public ZoneObject { | 46 class LOperand : public ZoneObject { |
47 public: | 47 public: |
48 enum Kind { | 48 enum Kind { |
49 INVALID, | 49 INVALID, |
50 UNALLOCATED, | 50 UNALLOCATED, |
51 CONSTANT_OPERAND, | 51 CONSTANT_OPERAND, |
52 STACK_SLOT, | 52 STACK_SLOT, |
53 DOUBLE_STACK_SLOT, | 53 DOUBLE_STACK_SLOT, |
54 REGISTER, | 54 REGISTER, |
55 DOUBLE_REGISTER, | 55 DOUBLE_REGISTER, |
56 ARGUMENT | 56 ARGUMENT |
Michael Starzinger
2014/03/04 15:40:12
The "ARGUMENT" kind should be obsolete now.
Jarin
2014/03/05 08:30:14
Done.
| |
57 }; | 57 }; |
58 | 58 |
59 LOperand() : value_(KindField::encode(INVALID)) { } | 59 LOperand() : value_(KindField::encode(INVALID)) { } |
60 | 60 |
61 Kind kind() const { return KindField::decode(value_); } | 61 Kind kind() const { return KindField::decode(value_); } |
62 int index() const { return static_cast<int>(value_) >> kKindFieldWidth; } | 62 int index() const { return static_cast<int>(value_) >> kKindFieldWidth; } |
63 #define LITHIUM_OPERAND_PREDICATE(name, type) \ | 63 #define LITHIUM_OPERAND_PREDICATE(name, type) \ |
64 bool Is##name() const { return kind() == type; } | 64 bool Is##name() const { return kind() == type; } |
65 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_PREDICATE) | 65 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_PREDICATE) |
66 LITHIUM_OPERAND_PREDICATE(Argument, ARGUMENT) | 66 LITHIUM_OPERAND_PREDICATE(Argument, ARGUMENT) |
Michael Starzinger
2014/03/04 15:40:12
Likewise.
Jarin
2014/03/05 08:30:14
Done.
| |
67 LITHIUM_OPERAND_PREDICATE(Unallocated, UNALLOCATED) | 67 LITHIUM_OPERAND_PREDICATE(Unallocated, UNALLOCATED) |
68 LITHIUM_OPERAND_PREDICATE(Ignored, INVALID) | 68 LITHIUM_OPERAND_PREDICATE(Ignored, INVALID) |
69 #undef LITHIUM_OPERAND_PREDICATE | 69 #undef LITHIUM_OPERAND_PREDICATE |
70 bool Equals(LOperand* other) const { return value_ == other->value_; } | 70 bool Equals(LOperand* other) const { return value_ == other->value_; } |
71 | 71 |
72 void PrintTo(StringStream* stream); | 72 void PrintTo(StringStream* stream); |
73 void ConvertTo(Kind kind, int index) { | 73 void ConvertTo(Kind kind, int index) { |
74 value_ = KindField::encode(kind); | 74 value_ = KindField::encode(kind); |
75 value_ |= index << kKindFieldWidth; | 75 value_ |= index << kKindFieldWidth; |
76 ASSERT(this->index() == index); | 76 ASSERT(this->index() == index); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 | 335 |
336 private: | 336 private: |
337 static const int kNumCachedOperands = 128; | 337 static const int kNumCachedOperands = 128; |
338 static LConstantOperand* cache; | 338 static LConstantOperand* cache; |
339 | 339 |
340 LConstantOperand() : LOperand() { } | 340 LConstantOperand() : LOperand() { } |
341 explicit LConstantOperand(int index) : LOperand(CONSTANT_OPERAND, index) { } | 341 explicit LConstantOperand(int index) : LOperand(CONSTANT_OPERAND, index) { } |
342 }; | 342 }; |
343 | 343 |
344 | 344 |
345 class LArgument V8_FINAL : public LOperand { | |
346 public: | |
347 explicit LArgument(int index) : LOperand(ARGUMENT, index) { } | |
348 | |
349 static LArgument* cast(LOperand* op) { | |
350 ASSERT(op->IsArgument()); | |
351 return reinterpret_cast<LArgument*>(op); | |
352 } | |
353 }; | |
354 | |
355 | |
356 class LStackSlot V8_FINAL : public LOperand { | 345 class LStackSlot V8_FINAL : public LOperand { |
357 public: | 346 public: |
358 static LStackSlot* Create(int index, Zone* zone) { | 347 static LStackSlot* Create(int index, Zone* zone) { |
359 ASSERT(index >= 0); | 348 ASSERT(index >= 0); |
360 if (index < kNumCachedOperands) return &cache[index]; | 349 if (index < kNumCachedOperands) return &cache[index]; |
361 return new(zone) LStackSlot(index); | 350 return new(zone) LStackSlot(index); |
362 } | 351 } |
363 | 352 |
364 static LStackSlot* cast(LOperand* op) { | 353 static LStackSlot* cast(LOperand* op) { |
365 ASSERT(op->IsStackSlot()); | 354 ASSERT(op->IsStackSlot()); |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
838 private: | 827 private: |
839 LChunk* chunk_; | 828 LChunk* chunk_; |
840 | 829 |
841 DISALLOW_COPY_AND_ASSIGN(LPhase); | 830 DISALLOW_COPY_AND_ASSIGN(LPhase); |
842 }; | 831 }; |
843 | 832 |
844 | 833 |
845 } } // namespace v8::internal | 834 } } // namespace v8::internal |
846 | 835 |
847 #endif // V8_LITHIUM_H_ | 836 #endif // V8_LITHIUM_H_ |
OLD | NEW |