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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 (ERECT_FRAME | NO_STRING_CHECK_RIGHT_IN_STUB)); | 1310 (ERECT_FRAME | NO_STRING_CHECK_RIGHT_IN_STUB)); |
1311 BinaryOpStub_GenerateRegisterArgsPushUnderReturn(masm); | 1311 BinaryOpStub_GenerateRegisterArgsPushUnderReturn(masm); |
1312 __ TailCallStub(&string_add_right_stub); | 1312 __ TailCallStub(&string_add_right_stub); |
1313 | 1313 |
1314 // Neither argument is a string. | 1314 // Neither argument is a string. |
1315 __ bind(&call_runtime); | 1315 __ bind(&call_runtime); |
1316 } | 1316 } |
1317 | 1317 |
1318 | 1318 |
1319 void BinaryOpStub::GenerateSmiStub(MacroAssembler* masm) { | 1319 void BinaryOpStub::GenerateSmiStub(MacroAssembler* masm) { |
1320 Label call_runtime; | 1320 Label right_arg_changed, call_runtime; |
| 1321 |
| 1322 if (op_ == Token::MOD && has_fixed_right_arg_) { |
| 1323 // It is guaranteed that the value will fit into a Smi, because if it |
| 1324 // didn't, we wouldn't be here, see BinaryOp_Patch. |
| 1325 __ Cmp(rax, Smi::FromInt(fixed_right_arg_value())); |
| 1326 __ j(not_equal, &right_arg_changed); |
| 1327 } |
| 1328 |
1321 if (result_type_ == BinaryOpIC::UNINITIALIZED || | 1329 if (result_type_ == BinaryOpIC::UNINITIALIZED || |
1322 result_type_ == BinaryOpIC::SMI) { | 1330 result_type_ == BinaryOpIC::SMI) { |
1323 // Only allow smi results. | 1331 // Only allow smi results. |
1324 BinaryOpStub_GenerateSmiCode(masm, NULL, NO_HEAPNUMBER_RESULTS, op_); | 1332 BinaryOpStub_GenerateSmiCode(masm, NULL, NO_HEAPNUMBER_RESULTS, op_); |
1325 } else { | 1333 } else { |
1326 // Allow heap number result and don't make a transition if a heap number | 1334 // Allow heap number result and don't make a transition if a heap number |
1327 // cannot be allocated. | 1335 // cannot be allocated. |
1328 BinaryOpStub_GenerateSmiCode( | 1336 BinaryOpStub_GenerateSmiCode( |
1329 masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS, op_); | 1337 masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS, op_); |
1330 } | 1338 } |
1331 | 1339 |
1332 // Code falls through if the result is not returned as either a smi or heap | 1340 // Code falls through if the result is not returned as either a smi or heap |
1333 // number. | 1341 // number. |
| 1342 __ bind(&right_arg_changed); |
1334 GenerateTypeTransition(masm); | 1343 GenerateTypeTransition(masm); |
1335 | 1344 |
1336 if (call_runtime.is_linked()) { | 1345 if (call_runtime.is_linked()) { |
1337 __ bind(&call_runtime); | 1346 __ bind(&call_runtime); |
1338 { | 1347 { |
1339 FrameScope scope(masm, StackFrame::INTERNAL); | 1348 FrameScope scope(masm, StackFrame::INTERNAL); |
1340 GenerateRegisterArgsPush(masm); | 1349 GenerateRegisterArgsPush(masm); |
1341 GenerateCallRuntime(masm); | 1350 GenerateCallRuntime(masm); |
1342 } | 1351 } |
1343 __ Ret(); | 1352 __ Ret(); |
(...skipping 5710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7054 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 7063 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
7055 } | 7064 } |
7056 } | 7065 } |
7057 | 7066 |
7058 | 7067 |
7059 #undef __ | 7068 #undef __ |
7060 | 7069 |
7061 } } // namespace v8::internal | 7070 } } // namespace v8::internal |
7062 | 7071 |
7063 #endif // V8_TARGET_ARCH_X64 | 7072 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |