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

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

Issue 558069: Change StoreIC interface on x64 to pass receiver in rdx, not on stack. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | « src/x64/ic-x64.cc ('k') | src/x64/virtual-frame-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 return GetCode(CALLBACKS, name); 1347 return GetCode(CALLBACKS, name);
1348 } 1348 }
1349 1349
1350 1350
1351 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, 1351 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object,
1352 AccessorInfo* callback, 1352 AccessorInfo* callback,
1353 String* name) { 1353 String* name) {
1354 // ----------- S t a t e ------------- 1354 // ----------- S t a t e -------------
1355 // -- rax : value 1355 // -- rax : value
1356 // -- rcx : name 1356 // -- rcx : name
1357 // -- rdx : receiver
1357 // -- rsp[0] : return address 1358 // -- rsp[0] : return address
1358 // -- rsp[8] : receiver
1359 // ----------------------------------- 1359 // -----------------------------------
1360 Label miss; 1360 Label miss;
1361 1361
1362 // Get the object from the stack.
1363 __ movq(rbx, Operand(rsp, 1 * kPointerSize));
1364
1365 // Check that the object isn't a smi. 1362 // Check that the object isn't a smi.
1366 __ JumpIfSmi(rbx, &miss); 1363 __ JumpIfSmi(rdx, &miss);
1367 1364
1368 // Check that the map of the object hasn't changed. 1365 // Check that the map of the object hasn't changed.
1369 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), 1366 __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset),
1370 Handle<Map>(object->map())); 1367 Handle<Map>(object->map()));
1371 __ j(not_equal, &miss); 1368 __ j(not_equal, &miss);
1372 1369
1373 // Perform global security token check if needed. 1370 // Perform global security token check if needed.
1374 if (object->IsJSGlobalProxy()) { 1371 if (object->IsJSGlobalProxy()) {
1375 __ CheckAccessGlobalProxy(rbx, rdx, &miss); 1372 __ CheckAccessGlobalProxy(rdx, rbx, &miss);
1376 } 1373 }
1377 1374
1378 // Stub never generated for non-global objects that require access 1375 // Stub never generated for non-global objects that require access
1379 // checks. 1376 // checks.
1380 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); 1377 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
1381 1378
1382 __ pop(rbx); // remove the return address 1379 __ pop(rbx); // remove the return address
1383 __ push(Operand(rsp, 0)); // receiver 1380 __ push(rdx); // receiver
1384 __ Push(Handle<AccessorInfo>(callback)); // callback info 1381 __ Push(Handle<AccessorInfo>(callback)); // callback info
1385 __ push(rcx); // name 1382 __ push(rcx); // name
1386 __ push(rax); // value 1383 __ push(rax); // value
1387 __ push(rbx); // restore return address 1384 __ push(rbx); // restore return address
1388 1385
1389 // Do tail-call to the runtime system. 1386 // Do tail-call to the runtime system.
1390 ExternalReference store_callback_property = 1387 ExternalReference store_callback_property =
1391 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); 1388 ExternalReference(IC_Utility(IC::kStoreCallbackProperty));
1392 __ TailCallRuntime(store_callback_property, 4, 1); 1389 __ TailCallRuntime(store_callback_property, 4, 1);
1393 1390
1394 // Handle store cache miss. 1391 // Handle store cache miss.
1395 __ bind(&miss); 1392 __ bind(&miss);
1396 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 1393 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1397 __ Jump(ic, RelocInfo::CODE_TARGET); 1394 __ Jump(ic, RelocInfo::CODE_TARGET);
1398 1395
1399 // Return the generated code. 1396 // Return the generated code.
1400 return GetCode(CALLBACKS, name); 1397 return GetCode(CALLBACKS, name);
1401 } 1398 }
1402 1399
1403 1400
1404 Object* StoreStubCompiler::CompileStoreField(JSObject* object, 1401 Object* StoreStubCompiler::CompileStoreField(JSObject* object,
1405 int index, 1402 int index,
1406 Map* transition, 1403 Map* transition,
1407 String* name) { 1404 String* name) {
1408 // ----------- S t a t e ------------- 1405 // ----------- S t a t e -------------
1409 // -- rax : value 1406 // -- rax : value
1410 // -- rcx : name 1407 // -- rcx : name
1408 // -- rdx : receiver
1411 // -- rsp[0] : return address 1409 // -- rsp[0] : return address
1412 // -- rsp[8] : receiver
1413 // ----------------------------------- 1410 // -----------------------------------
1414 Label miss; 1411 Label miss;
1415 1412
1416 // Get the object from the stack.
1417 __ movq(rbx, Operand(rsp, 1 * kPointerSize));
1418
1419 // Generate store field code. Trashes the name register. 1413 // Generate store field code. Trashes the name register.
1420 GenerateStoreField(masm(), 1414 GenerateStoreField(masm(),
1421 Builtins::StoreIC_ExtendStorage, 1415 Builtins::StoreIC_ExtendStorage,
1422 object, 1416 object,
1423 index, 1417 index,
1424 transition, 1418 transition,
1425 rbx, rcx, rdx, 1419 rdx, rcx, rbx,
1426 &miss); 1420 &miss);
1427 1421
1428 // Handle store cache miss. 1422 // Handle store cache miss.
1429 __ bind(&miss); 1423 __ bind(&miss);
1430 __ Move(rcx, Handle<String>(name)); // restore name 1424 __ Move(rcx, Handle<String>(name)); // restore name
1431 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 1425 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1432 __ Jump(ic, RelocInfo::CODE_TARGET); 1426 __ Jump(ic, RelocInfo::CODE_TARGET);
1433 1427
1434 // Return the generated code. 1428 // Return the generated code.
1435 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); 1429 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
1436 } 1430 }
1437 1431
1438 1432
1439 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, 1433 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
1440 String* name) { 1434 String* name) {
1441 // ----------- S t a t e ------------- 1435 // ----------- S t a t e -------------
1442 // -- rax : value 1436 // -- rax : value
1443 // -- rcx : name 1437 // -- rcx : name
1438 // -- rdx : receiver
1444 // -- rsp[0] : return address 1439 // -- rsp[0] : return address
1445 // -- rsp[8] : receiver
1446 // ----------------------------------- 1440 // -----------------------------------
1447 Label miss; 1441 Label miss;
1448 1442
1449 // Get the object from the stack.
1450 __ movq(rbx, Operand(rsp, 1 * kPointerSize));
1451
1452 // Check that the object isn't a smi. 1443 // Check that the object isn't a smi.
1453 __ JumpIfSmi(rbx, &miss); 1444 __ JumpIfSmi(rdx, &miss);
1454 1445
1455 // Check that the map of the object hasn't changed. 1446 // Check that the map of the object hasn't changed.
1456 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), 1447 __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset),
1457 Handle<Map>(receiver->map())); 1448 Handle<Map>(receiver->map()));
1458 __ j(not_equal, &miss); 1449 __ j(not_equal, &miss);
1459 1450
1460 // Perform global security token check if needed. 1451 // Perform global security token check if needed.
1461 if (receiver->IsJSGlobalProxy()) { 1452 if (receiver->IsJSGlobalProxy()) {
1462 __ CheckAccessGlobalProxy(rbx, rdx, &miss); 1453 __ CheckAccessGlobalProxy(rdx, rbx, &miss);
1463 } 1454 }
1464 1455
1465 // Stub never generated for non-global objects that require access 1456 // Stub never generated for non-global objects that require access
1466 // checks. 1457 // checks.
1467 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded()); 1458 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded());
1468 1459
1469 __ pop(rbx); // remove the return address 1460 __ pop(rbx); // remove the return address
1470 __ push(Operand(rsp, 0)); // receiver 1461 __ push(rdx); // receiver
1471 __ push(rcx); // name 1462 __ push(rcx); // name
1472 __ push(rax); // value 1463 __ push(rax); // value
1473 __ push(rbx); // restore return address 1464 __ push(rbx); // restore return address
1474 1465
1475 // Do tail-call to the runtime system. 1466 // Do tail-call to the runtime system.
1476 ExternalReference store_ic_property = 1467 ExternalReference store_ic_property =
1477 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); 1468 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty));
1478 __ TailCallRuntime(store_ic_property, 3, 1); 1469 __ TailCallRuntime(store_ic_property, 3, 1);
1479 1470
1480 // Handle store cache miss. 1471 // Handle store cache miss.
1481 __ bind(&miss); 1472 __ bind(&miss);
1482 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 1473 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1483 __ Jump(ic, RelocInfo::CODE_TARGET); 1474 __ Jump(ic, RelocInfo::CODE_TARGET);
1484 1475
1485 // Return the generated code. 1476 // Return the generated code.
1486 return GetCode(INTERCEPTOR, name); 1477 return GetCode(INTERCEPTOR, name);
1487 } 1478 }
1488 1479
1489 1480
1490 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, 1481 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
1491 JSGlobalPropertyCell* cell, 1482 JSGlobalPropertyCell* cell,
1492 String* name) { 1483 String* name) {
1493 // ----------- S t a t e ------------- 1484 // ----------- S t a t e -------------
1494 // -- rax : value 1485 // -- rax : value
1495 // -- rcx : name 1486 // -- rcx : name
1487 // -- rdx : receiver
1496 // -- rsp[0] : return address 1488 // -- rsp[0] : return address
1497 // -- rsp[8] : receiver
1498 // ----------------------------------- 1489 // -----------------------------------
1499 Label miss; 1490 Label miss;
1500 1491
1501 // Check that the map of the global has not changed. 1492 // Check that the map of the global has not changed.
1502 __ movq(rbx, Operand(rsp, kPointerSize)); 1493 __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset),
1503 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset),
1504 Handle<Map>(object->map())); 1494 Handle<Map>(object->map()));
1505 __ j(not_equal, &miss); 1495 __ j(not_equal, &miss);
1506 1496
1507 // Store the value in the cell. 1497 // Store the value in the cell.
1508 __ Move(rcx, Handle<JSGlobalPropertyCell>(cell)); 1498 __ Move(rcx, Handle<JSGlobalPropertyCell>(cell));
1509 __ movq(FieldOperand(rcx, JSGlobalPropertyCell::kValueOffset), rax); 1499 __ movq(FieldOperand(rcx, JSGlobalPropertyCell::kValueOffset), rax);
1510 1500
1511 // Return the value (register rax). 1501 // Return the value (register rax).
1512 __ IncrementCounter(&Counters::named_store_global_inline, 1); 1502 __ IncrementCounter(&Counters::named_store_global_inline, 1);
1513 __ ret(0); 1503 __ ret(0);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 1878 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
1889 1879
1890 // Return the generated code. 1880 // Return the generated code.
1891 return GetCode(); 1881 return GetCode();
1892 } 1882 }
1893 1883
1894 1884
1895 #undef __ 1885 #undef __
1896 1886
1897 } } // namespace v8::internal 1887 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/virtual-frame-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698