Chromium Code Reviews| Index: src/code-stubs.h |
| diff --git a/src/code-stubs.h b/src/code-stubs.h |
| index aa6a4101951f3d762df2659d2ae870a677a91cc7..1f69d44555988fc97fb17e95c9cd212cc6d7e095 100644 |
| --- a/src/code-stubs.h |
| +++ b/src/code-stubs.h |
| @@ -870,7 +870,9 @@ class BinaryOpStub: public PlatformCodeStub { |
| platform_specific_bit_(false), |
| left_type_(BinaryOpIC::UNINITIALIZED), |
| right_type_(BinaryOpIC::UNINITIALIZED), |
| - result_type_(BinaryOpIC::UNINITIALIZED) { |
| + result_type_(BinaryOpIC::UNINITIALIZED), |
| + has_fixed_right_arg_(false), |
| + encoded_right_arg_(encode_arg_value(1)) { |
| Initialize(); |
| ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
| } |
| @@ -879,13 +881,17 @@ class BinaryOpStub: public PlatformCodeStub { |
| int key, |
| BinaryOpIC::TypeInfo left_type, |
| BinaryOpIC::TypeInfo right_type, |
| - BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) |
| + BinaryOpIC::TypeInfo result_type, |
| + bool has_fixed_right_arg, |
| + int32_t fixed_right_arg_value) |
| : op_(OpBits::decode(key)), |
| mode_(ModeBits::decode(key)), |
| platform_specific_bit_(PlatformSpecificBits::decode(key)), |
| left_type_(left_type), |
| right_type_(right_type), |
| - result_type_(result_type) { } |
| + result_type_(result_type), |
| + has_fixed_right_arg_(has_fixed_right_arg), |
| + encoded_right_arg_(encode_arg_value(fixed_right_arg_value)) { } |
| static void decode_types_from_minor_key(int minor_key, |
| BinaryOpIC::TypeInfo* left_type, |
| @@ -903,6 +909,24 @@ class BinaryOpStub: public PlatformCodeStub { |
| return static_cast<Token::Value>(OpBits::decode(minor_key)); |
| } |
| + static bool decode_has_fixed_right_arg_from_minor_key(int minor_key) { |
| + return HasFixedRightArgBits::decode(minor_key); |
| + } |
| + |
| + static int decode_fixed_right_arg_value_from_minor_key(int minor_key) { |
| + return decode_arg_value(FixedRightArgValueBits::decode(minor_key)); |
| + } |
| + |
| + int fixed_right_arg_value() const { |
| + return decode_arg_value(encoded_right_arg_); |
| + } |
| + |
| + static bool can_encode_arg_value(int32_t value) { |
| + return value > 0 && |
| + IsPowerOf2(value) && |
| + FixedRightArgValueBits::is_valid(WhichPowerOf2(value)); |
| + } |
| + |
| enum SmiCodeGenerateHeapNumberResults { |
| ALLOW_HEAPNUMBER_RESULTS, |
| NO_HEAPNUMBER_RESULTS |
| @@ -918,6 +942,18 @@ class BinaryOpStub: public PlatformCodeStub { |
| BinaryOpIC::TypeInfo right_type_; |
| BinaryOpIC::TypeInfo result_type_; |
| + bool has_fixed_right_arg_; |
| + int encoded_right_arg_; |
| + |
| + static int encode_arg_value(int32_t value) { |
| + ASSERT(can_encode_arg_value(value)); |
| + return WhichPowerOf2(value); |
| + } |
| + |
| + static int32_t decode_arg_value(int value) { |
| + return 1 << value; |
| + } |
| + |
| virtual void PrintName(StringStream* stream); |
| // Minor key encoding in 19 bits TTTRRRLLLSOOOOOOOMM. |
|
Jakob Kummerow
2013/05/23 12:05:43
Please update this comment.
Sven Panne
2013/05/23 14:39:20
Done.
|
| @@ -927,6 +963,8 @@ class BinaryOpStub: public PlatformCodeStub { |
| class LeftTypeBits: public BitField<BinaryOpIC::TypeInfo, 10, 3> {}; |
| class RightTypeBits: public BitField<BinaryOpIC::TypeInfo, 13, 3> {}; |
| class ResultTypeBits: public BitField<BinaryOpIC::TypeInfo, 16, 3> {}; |
| + class HasFixedRightArgBits: public BitField<bool, 19, 1> {}; |
| + class FixedRightArgValueBits: public BitField<int, 20, 5> {}; |
| Major MajorKey() { return BinaryOp; } |
| int MinorKey() { |
| @@ -935,7 +973,9 @@ class BinaryOpStub: public PlatformCodeStub { |
| | PlatformSpecificBits::encode(platform_specific_bit_) |
| | LeftTypeBits::encode(left_type_) |
| | RightTypeBits::encode(right_type_) |
| - | ResultTypeBits::encode(result_type_); |
| + | ResultTypeBits::encode(result_type_) |
| + | HasFixedRightArgBits::encode(has_fixed_right_arg_) |
| + | FixedRightArgValueBits::encode(encoded_right_arg_); |
| } |