Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: src/a64/code-stubs-a64.cc

Issue 149153003: Implement a code stub for floating point modulo operation (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 Label* gc_required, 1320 Label* gc_required,
1321 Label* miss, 1321 Label* miss,
1322 Token::Value op, 1322 Token::Value op,
1323 OverwriteMode mode) { 1323 OverwriteMode mode) {
1324 ASM_LOCATION("BinaryOpStub_GenerateFPOperation"); 1324 ASM_LOCATION("BinaryOpStub_GenerateFPOperation");
1325 1325
1326 Register result = x0; 1326 Register result = x0;
1327 FPRegister result_d = d0; 1327 FPRegister result_d = d0;
1328 Register right = x0; 1328 Register right = x0;
1329 Register left = x1; 1329 Register left = x1;
1330 Register heap_result = x3; 1330 Register heap_result = x19;
1331 1331
1332 ASSERT(smi_operands || (not_numbers != NULL)); 1332 ASSERT(smi_operands || (not_numbers != NULL));
1333 if (smi_operands) { 1333 if (smi_operands) {
1334 __ AssertSmi(left); 1334 __ AssertSmi(left);
1335 __ AssertSmi(right); 1335 __ AssertSmi(right);
1336 } 1336 }
1337 if (left_type == BinaryOpIC::SMI) { 1337 if (left_type == BinaryOpIC::SMI) {
1338 __ JumpIfNotSmi(left, miss); 1338 __ JumpIfNotSmi(left, miss);
1339 } 1339 }
1340 if (right_type == BinaryOpIC::SMI) { 1340 if (right_type == BinaryOpIC::SMI) {
1341 __ JumpIfNotSmi(right, miss); 1341 __ JumpIfNotSmi(right, miss);
1342 } 1342 }
1343 1343
1344 Register heap_number_map = x2; 1344 Register heap_number_map = x2;
1345 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); 1345 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
1346 1346
1347 switch (op) { 1347 switch (op) {
1348 case Token::ADD: 1348 case Token::ADD:
1349 case Token::SUB: 1349 case Token::SUB:
1350 case Token::MUL: 1350 case Token::MUL:
1351 case Token::DIV: 1351 case Token::DIV:
1352 case Token::MOD: { 1352 case Token::MOD: {
1353 FPRegister right_d = d0; 1353 FPRegister left_d = d0;
1354 FPRegister left_d = d1; 1354 FPRegister right_d = d1;
1355 Label do_operation; 1355 Label do_operation;
1356 1356
1357 __ SmiUntagToDouble(left_d, left, kSpeculativeUntag); 1357 __ SmiUntagToDouble(left_d, left, kSpeculativeUntag);
1358 __ SmiUntagToDouble(right_d, right, kSpeculativeUntag); 1358 __ SmiUntagToDouble(right_d, right, kSpeculativeUntag);
1359 1359
1360 if (!smi_operands) { 1360 if (!smi_operands) {
1361 if (left_type != BinaryOpIC::SMI) { 1361 if (left_type != BinaryOpIC::SMI) {
1362 Label left_done; 1362 Label left_done;
1363 Label* left_not_heap = 1363 Label* left_not_heap =
1364 (left_type == BinaryOpIC::NUMBER) ? miss : not_numbers; 1364 (left_type == BinaryOpIC::NUMBER) ? miss : not_numbers;
(...skipping 11 matching lines...) Expand all
1376 __ JumpIfSmi(right, &do_operation); 1376 __ JumpIfSmi(right, &do_operation);
1377 1377
1378 // Right not smi: load if heap number. 1378 // Right not smi: load if heap number.
1379 __ JumpIfNotHeapNumber(right, right_not_heap, heap_number_map); 1379 __ JumpIfNotHeapNumber(right, right_not_heap, heap_number_map);
1380 __ Ldr(right_d, FieldMemOperand(right, HeapNumber::kValueOffset)); 1380 __ Ldr(right_d, FieldMemOperand(right, HeapNumber::kValueOffset));
1381 } 1381 }
1382 } 1382 }
1383 1383
1384 // Left and right are doubles in left_d and right_d. Calculate the result. 1384 // Left and right are doubles in left_d and right_d. Calculate the result.
1385 __ Bind(&do_operation); 1385 __ Bind(&do_operation);
1386
1387 BinaryOpStub_GenerateHeapResultAllocation(
1388 masm, heap_result, heap_number_map, x10, x11, gc_required, mode);
1389
1386 switch (op) { 1390 switch (op) {
1387 case Token::ADD: __ Fadd(result_d, left_d, right_d); break; 1391 case Token::ADD: __ Fadd(result_d, left_d, right_d); break;
1388 case Token::SUB: __ Fsub(result_d, left_d, right_d); break; 1392 case Token::SUB: __ Fsub(result_d, left_d, right_d); break;
1389 case Token::MUL: __ Fmul(result_d, left_d, right_d); break; 1393 case Token::MUL: __ Fmul(result_d, left_d, right_d); break;
1390 case Token::DIV: __ Fdiv(result_d, left_d, right_d); break; 1394 case Token::DIV: __ Fdiv(result_d, left_d, right_d); break;
1391 case Token::MOD: 1395 case Token::MOD: {
1392 ASM_UNIMPLEMENTED("Implement HeapNumber modulo"); 1396 Register saved_lr = x20;
1393 __ B(miss); 1397 __ Mov(saved_lr, lr);
1398 AllowExternalCallThatCantCauseGC scope(masm);
1399 __ CallCFunction(
1400 ExternalReference::double_fp_operation(op, masm->isolate()),
1401 0, 2);
1402 __ Mov(lr, saved_lr);
1394 break; 1403 break;
1404 }
1395 default: UNREACHABLE(); 1405 default: UNREACHABLE();
1396 } 1406 }
1397 1407
1398 BinaryOpStub_GenerateHeapResultAllocation(
1399 masm, heap_result, heap_number_map, x10, x11, gc_required, mode);
1400
1401 __ Str(result_d, FieldMemOperand(heap_result, HeapNumber::kValueOffset)); 1408 __ Str(result_d, FieldMemOperand(heap_result, HeapNumber::kValueOffset));
1402 __ Mov(result, heap_result); 1409 __ Mov(result, heap_result);
1403 __ Ret(); 1410 __ Ret();
1404 break; 1411 break;
1405 } 1412 }
1406 1413
1407 case Token::BIT_OR: 1414 case Token::BIT_OR:
1408 case Token::BIT_XOR: 1415 case Token::BIT_XOR:
1409 case Token::BIT_AND: 1416 case Token::BIT_AND:
1410 case Token::SAR: 1417 case Token::SAR:
(...skipping 5653 matching lines...) Expand 10 before | Expand all | Expand 10 after
7064 __ Bind(&fast_elements_case); 7071 __ Bind(&fast_elements_case);
7065 GenerateCase(masm, FAST_ELEMENTS); 7072 GenerateCase(masm, FAST_ELEMENTS);
7066 } 7073 }
7067 7074
7068 7075
7069 #undef __ 7076 #undef __
7070 7077
7071 } } // namespace v8::internal 7078 } } // namespace v8::internal
7072 7079
7073 #endif // V8_TARGET_ARCH_A64 7080 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698