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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 bool is_valid = Smi::IsValid(number); | 102 bool is_valid = Smi::IsValid(number); |
103 bool is_in_range = number >= Smi::kMinValue && number <= Smi::kMaxValue; | 103 bool is_in_range = number >= Smi::kMinValue && number <= Smi::kMaxValue; |
104 CHECK_EQ(is_in_range, is_valid); | 104 CHECK_EQ(is_in_range, is_valid); |
105 if (is_valid) { | 105 if (is_valid) { |
106 Smi* smi_from_intptr = Smi::FromIntptr(number); | 106 Smi* smi_from_intptr = Smi::FromIntptr(number); |
107 if (static_cast<int>(number) == number) { // Is a 32-bit int. | 107 if (static_cast<int>(number) == number) { // Is a 32-bit int. |
108 Smi* smi_from_int = Smi::FromInt(static_cast<int32_t>(number)); | 108 Smi* smi_from_int = Smi::FromInt(static_cast<int32_t>(number)); |
109 CHECK_EQ(smi_from_int, smi_from_intptr); | 109 CHECK_EQ(smi_from_int, smi_from_intptr); |
110 } | 110 } |
111 int smi_value = smi_from_intptr->value(); | 111 int smi_value = smi_from_intptr->value(); |
112 CHECK_EQ(number, smi_value); | 112 CHECK_EQ(number, static_cast<intptr_t>(smi_value)); |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 | 117 |
118 static void TestMoveSmi(MacroAssembler* masm, Label* exit, int id, Smi* value) { | 118 static void TestMoveSmi(MacroAssembler* masm, Label* exit, int id, Smi* value) { |
119 __ movl(rax, Immediate(id)); | 119 __ movl(rax, Immediate(id)); |
120 __ Move(rcx, Smi::FromInt(0)); | 120 __ Move(rcx, Smi::FromInt(0)); |
121 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); | 121 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); |
122 __ cmpq(rcx, rdx); | 122 __ cmpq(rcx, rdx); |
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 | 2087 |
2088 CodeDesc desc; | 2088 CodeDesc desc; |
2089 masm->GetCode(&desc); | 2089 masm->GetCode(&desc); |
2090 // Call the function from C++. | 2090 // Call the function from C++. |
2091 int result = FUNCTION_CAST<F0>(buffer)(); | 2091 int result = FUNCTION_CAST<F0>(buffer)(); |
2092 CHECK_EQ(0, result); | 2092 CHECK_EQ(0, result); |
2093 } | 2093 } |
2094 | 2094 |
2095 | 2095 |
2096 #undef __ | 2096 #undef __ |
OLD | NEW |