OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 3918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3929 } | 3929 } |
3930 } | 3930 } |
3931 | 3931 |
3932 | 3932 |
3933 void CodeGenerator::VisitLiteral(Literal* node) { | 3933 void CodeGenerator::VisitLiteral(Literal* node) { |
3934 Comment cmnt(masm_, "[ Literal"); | 3934 Comment cmnt(masm_, "[ Literal"); |
3935 frame_->Push(node->handle()); | 3935 frame_->Push(node->handle()); |
3936 } | 3936 } |
3937 | 3937 |
3938 | 3938 |
3939 void CodeGenerator::LoadUnsafeSmi(Register target, Handle<Object> value) { | 3939 void CodeGenerator::PushUnsafeSmi(Handle<Object> value) { |
| 3940 ASSERT(value->IsSmi()); |
| 3941 int bits = reinterpret_cast<int>(*value); |
| 3942 __ push(Immediate(bits & 0x0000FFFF)); |
| 3943 __ or_(Operand(esp, 0), Immediate(bits & 0xFFFF0000)); |
| 3944 } |
| 3945 |
| 3946 |
| 3947 void CodeGenerator::StoreUnsafeSmiToLocal(int offset, Handle<Object> value) { |
| 3948 ASSERT(value->IsSmi()); |
| 3949 int bits = reinterpret_cast<int>(*value); |
| 3950 __ mov(Operand(ebp, offset), Immediate(bits & 0x0000FFFF)); |
| 3951 __ or_(Operand(ebp, offset), Immediate(bits & 0xFFFF0000)); |
| 3952 } |
| 3953 |
| 3954 |
| 3955 void CodeGenerator::MoveUnsafeSmi(Register target, Handle<Object> value) { |
3940 ASSERT(target.is_valid()); | 3956 ASSERT(target.is_valid()); |
3941 ASSERT(value->IsSmi()); | 3957 ASSERT(value->IsSmi()); |
3942 int bits = reinterpret_cast<int>(*value); | 3958 int bits = reinterpret_cast<int>(*value); |
3943 __ Set(target, Immediate(bits & 0x0000FFFF)); | 3959 __ Set(target, Immediate(bits & 0x0000FFFF)); |
3944 __ xor_(target, bits & 0xFFFF0000); | 3960 __ or_(target, bits & 0xFFFF0000); |
3945 } | 3961 } |
3946 | 3962 |
3947 | 3963 |
3948 bool CodeGenerator::IsUnsafeSmi(Handle<Object> value) { | 3964 bool CodeGenerator::IsUnsafeSmi(Handle<Object> value) { |
3949 if (!value->IsSmi()) return false; | 3965 if (!value->IsSmi()) return false; |
3950 int int_value = Smi::cast(*value)->value(); | 3966 int int_value = Smi::cast(*value)->value(); |
3951 return !is_intn(int_value, kMaxSmiInlinedBits); | 3967 return !is_intn(int_value, kMaxSmiInlinedBits); |
3952 } | 3968 } |
3953 | 3969 |
3954 | 3970 |
(...skipping 4152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8107 | 8123 |
8108 int CompareStub::MinorKey() { | 8124 int CompareStub::MinorKey() { |
8109 // Encode the two parameters in a unique 16 bit value. | 8125 // Encode the two parameters in a unique 16 bit value. |
8110 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 8126 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
8111 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 8127 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
8112 } | 8128 } |
8113 | 8129 |
8114 #undef __ | 8130 #undef __ |
8115 | 8131 |
8116 } } // namespace v8::internal | 8132 } } // namespace v8::internal |
OLD | NEW |