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

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 3143038: Ported string call IC-s to arm. (Closed)
Patch Set: Created 10 years, 4 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
« 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 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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 // Return the generated code. 1356 // Return the generated code.
1357 return GetCode(function); 1357 return GetCode(function);
1358 } 1358 }
1359 1359
1360 1360
1361 Object* CallStubCompiler::CompileStringCharCodeAtCall(Object* object, 1361 Object* CallStubCompiler::CompileStringCharCodeAtCall(Object* object,
1362 JSObject* holder, 1362 JSObject* holder,
1363 JSFunction* function, 1363 JSFunction* function,
1364 String* name, 1364 String* name,
1365 CheckType check) { 1365 CheckType check) {
1366 // TODO(722): implement this. 1366 // ----------- S t a t e -------------
1367 return Heap::undefined_value(); 1367 // -- r2 : function name
1368 // -- lr : return address
1369 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
1370 // -- ...
1371 // -- sp[argc * 4] : receiver
1372 // -----------------------------------
1373
1374 // If object is not a string, bail out to regular call.
1375 if (!object->IsString()) return Heap::undefined_value();
1376
1377 const int argc = arguments().immediate();
1378
1379 Label miss;
1380 Label index_out_of_range;
1381 GenerateNameCheck(name, &miss);
1382
1383 // Check that the maps starting from the prototype haven't changed.
1384 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1385 Context::STRING_FUNCTION_INDEX,
1386 r0);
1387 ASSERT(object != holder);
1388 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder,
1389 r1, r3, r4, name, &miss);
1390
1391 Register receiver = r1;
1392 Register index = r4;
1393 Register scratch = r3;
1394 Register result = r0;
1395 __ ldr(receiver, MemOperand(sp, argc * kPointerSize));
1396 if (argc > 0) {
1397 __ ldr(index, MemOperand(sp, (argc - 1) * kPointerSize));
1398 } else {
1399 __ LoadRoot(index, Heap::kUndefinedValueRootIndex);
1400 }
1401
1402 StringCharCodeAtGenerator char_code_at_generator(receiver,
1403 index,
1404 scratch,
1405 result,
1406 &miss, // When not a string.
1407 &miss, // When not a number.
1408 &index_out_of_range,
1409 STRING_INDEX_IS_NUMBER);
1410 char_code_at_generator.GenerateFast(masm());
1411 __ Drop(argc + 1);
1412 __ Ret();
1413
1414 ICRuntimeCallHelper call_helper;
1415 char_code_at_generator.GenerateSlow(masm(), call_helper);
1416
1417 __ bind(&index_out_of_range);
1418 __ LoadRoot(r0, Heap::kNanValueRootIndex);
1419 __ Drop(argc + 1);
1420 __ Ret();
1421
1422 __ bind(&miss);
1423 Object* obj = GenerateMissBranch();
1424 if (obj->IsFailure()) return obj;
1425
1426 // Return the generated code.
1427 return GetCode(function);
1368 } 1428 }
1369 1429
1370 1430
1371 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, 1431 Object* CallStubCompiler::CompileStringCharAtCall(Object* object,
1372 JSObject* holder, 1432 JSObject* holder,
1373 JSFunction* function, 1433 JSFunction* function,
1374 String* name, 1434 String* name,
1375 CheckType check) { 1435 CheckType check) {
1376 // TODO(722): implement this. 1436 // ----------- S t a t e -------------
1377 return Heap::undefined_value(); 1437 // -- r2 : function name
1438 // -- lr : return address
1439 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
1440 // -- ...
1441 // -- sp[argc * 4] : receiver
1442 // -----------------------------------
1443
1444 // If object is not a string, bail out to regular call.
1445 if (!object->IsString()) return Heap::undefined_value();
1446
1447 const int argc = arguments().immediate();
1448
1449 Label miss;
1450 Label index_out_of_range;
1451
1452 GenerateNameCheck(name, &miss);
1453
1454 // Check that the maps starting from the prototype haven't changed.
1455 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1456 Context::STRING_FUNCTION_INDEX,
1457 r0);
1458 ASSERT(object != holder);
1459 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder,
1460 r1, r3, r4, name, &miss);
1461
1462 Register receiver = r0;
1463 Register index = r4;
1464 Register scratch1 = r1;
1465 Register scratch2 = r3;
1466 Register result = r0;
1467 __ ldr(receiver, MemOperand(sp, argc * kPointerSize));
1468 if (argc > 0) {
1469 __ ldr(index, MemOperand(sp, (argc - 1) * kPointerSize));
1470 } else {
1471 __ LoadRoot(index, Heap::kUndefinedValueRootIndex);
1472 }
1473
1474 StringCharAtGenerator char_at_generator(receiver,
1475 index,
1476 scratch1,
1477 scratch2,
1478 result,
1479 &miss, // When not a string.
1480 &miss, // When not a number.
1481 &index_out_of_range,
1482 STRING_INDEX_IS_NUMBER);
1483 char_at_generator.GenerateFast(masm());
1484 __ Drop(argc + 1);
1485 __ Ret();
1486
1487 ICRuntimeCallHelper call_helper;
1488 char_at_generator.GenerateSlow(masm(), call_helper);
1489
1490 __ bind(&index_out_of_range);
1491 __ LoadRoot(r0, Heap::kEmptyStringRootIndex);
1492 __ Drop(argc + 1);
1493 __ Ret();
1494
1495 __ bind(&miss);
1496 Object* obj = GenerateMissBranch();
1497 if (obj->IsFailure()) return obj;
1498
1499 // Return the generated code.
1500 return GetCode(function);
1378 } 1501 }
1379 1502
1380 1503
1381 Object* CallStubCompiler::CompileCallConstant(Object* object, 1504 Object* CallStubCompiler::CompileCallConstant(Object* object,
1382 JSObject* holder, 1505 JSObject* holder,
1383 JSFunction* function, 1506 JSFunction* function,
1384 String* name, 1507 String* name,
1385 CheckType check) { 1508 CheckType check) {
1386 // ----------- S t a t e ------------- 1509 // ----------- S t a t e -------------
1387 // -- r2 : name 1510 // -- r2 : name
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 // Return the generated code. 2467 // Return the generated code.
2345 return GetCode(); 2468 return GetCode();
2346 } 2469 }
2347 2470
2348 2471
2349 #undef __ 2472 #undef __
2350 2473
2351 } } // namespace v8::internal 2474 } } // namespace v8::internal
2352 2475
2353 #endif // V8_TARGET_ARCH_ARM 2476 #endif // V8_TARGET_ARCH_ARM
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