| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
| 10 #include "src/hydrogen.h" | 10 #include "src/hydrogen.h" |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 left_type, right_type, result_type, | 1223 left_type, right_type, result_type, |
| 1224 state.fixed_right_arg(), allocation_mode); | 1224 state.fixed_right_arg(), allocation_mode); |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 // If we encounter a generic argument, the number conversion is | 1227 // If we encounter a generic argument, the number conversion is |
| 1228 // observable, thus we cannot afford to bail out after the fact. | 1228 // observable, thus we cannot afford to bail out after the fact. |
| 1229 if (!state.HasSideEffects()) { | 1229 if (!state.HasSideEffects()) { |
| 1230 result = EnforceNumberType(result, result_type); | 1230 result = EnforceNumberType(result, result_type); |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 // Reuse the double box of one of the operands if we are allowed to (i.e. | |
| 1234 // chained binops). | |
| 1235 if (state.CanReuseDoubleBox()) { | |
| 1236 HValue* operand = (state.mode() == OVERWRITE_LEFT) ? left : right; | |
| 1237 IfBuilder if_heap_number(this); | |
| 1238 if_heap_number.If<HHasInstanceTypeAndBranch>(operand, HEAP_NUMBER_TYPE); | |
| 1239 if_heap_number.Then(); | |
| 1240 Add<HStoreNamedField>(operand, HObjectAccess::ForHeapNumberValue(), result); | |
| 1241 Push(operand); | |
| 1242 if_heap_number.Else(); | |
| 1243 Push(result); | |
| 1244 if_heap_number.End(); | |
| 1245 result = Pop(); | |
| 1246 } | |
| 1247 | |
| 1248 return result; | 1233 return result; |
| 1249 } | 1234 } |
| 1250 | 1235 |
| 1251 | 1236 |
| 1252 Handle<Code> BinaryOpICStub::GenerateCode() { | 1237 Handle<Code> BinaryOpICStub::GenerateCode() { |
| 1253 return DoGenerateCode(this); | 1238 return DoGenerateCode(this); |
| 1254 } | 1239 } |
| 1255 | 1240 |
| 1256 | 1241 |
| 1257 template <> | 1242 template <> |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 // megamorphic case is handled as part of the default stub. | 2248 // megamorphic case is handled as part of the default stub. |
| 2264 DCHECK(!FLAG_vector_ics); | 2249 DCHECK(!FLAG_vector_ics); |
| 2265 | 2250 |
| 2266 // Probe the stub cache. | 2251 // Probe the stub cache. |
| 2267 Add<HTailCallThroughMegamorphicCache>(receiver, name); | 2252 Add<HTailCallThroughMegamorphicCache>(receiver, name); |
| 2268 | 2253 |
| 2269 // We never continue. | 2254 // We never continue. |
| 2270 return graph()->GetConstant0(); | 2255 return graph()->GetConstant0(); |
| 2271 } | 2256 } |
| 2272 } } // namespace v8::internal | 2257 } } // namespace v8::internal |
| OLD | NEW |