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

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

Issue 2330003: Change the interface of LoadIC on the x64 platform to take its arguments in r... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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 2010 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
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 // Return the generated code. 1311 // Return the generated code.
1312 return GetCode(NORMAL, name); 1312 return GetCode(NORMAL, name);
1313 } 1313 }
1314 1314
1315 1315
1316 Object* LoadStubCompiler::CompileLoadCallback(String* name, 1316 Object* LoadStubCompiler::CompileLoadCallback(String* name,
1317 JSObject* object, 1317 JSObject* object,
1318 JSObject* holder, 1318 JSObject* holder,
1319 AccessorInfo* callback) { 1319 AccessorInfo* callback) {
1320 // ----------- S t a t e ------------- 1320 // ----------- S t a t e -------------
1321 // -- rax : receiver
1321 // -- rcx : name 1322 // -- rcx : name
1322 // -- rsp[0] : return address 1323 // -- rsp[0] : return address
1323 // -- rsp[8] : receiver
1324 // ----------------------------------- 1324 // -----------------------------------
1325 Label miss; 1325 Label miss;
1326 1326
1327 __ movq(rax, Operand(rsp, kPointerSize));
1328 Failure* failure = Failure::InternalError(); 1327 Failure* failure = Failure::InternalError();
1329 bool success = GenerateLoadCallback(object, holder, rax, rcx, rbx, rdx, 1328 bool success = GenerateLoadCallback(object, holder, rax, rcx, rbx, rdx,
1330 callback, name, &miss, &failure); 1329 callback, name, &miss, &failure);
1331 if (!success) return failure; 1330 if (!success) return failure;
1332 1331
1333 __ bind(&miss); 1332 __ bind(&miss);
1334 GenerateLoadMiss(masm(), Code::LOAD_IC); 1333 GenerateLoadMiss(masm(), Code::LOAD_IC);
1335 1334
1336 // Return the generated code. 1335 // Return the generated code.
1337 return GetCode(CALLBACKS, name); 1336 return GetCode(CALLBACKS, name);
1338 } 1337 }
1339 1338
1340 1339
1341 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, 1340 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object,
1342 JSObject* holder, 1341 JSObject* holder,
1343 Object* value, 1342 Object* value,
1344 String* name) { 1343 String* name) {
1345 // ----------- S t a t e ------------- 1344 // ----------- S t a t e -------------
1345 // -- rax : receiver
1346 // -- rcx : name 1346 // -- rcx : name
1347 // -- rsp[0] : return address 1347 // -- rsp[0] : return address
1348 // -- rsp[8] : receiver
1349 // ----------------------------------- 1348 // -----------------------------------
1350 Label miss; 1349 Label miss;
1351 1350
1352 __ movq(rax, Operand(rsp, kPointerSize));
1353 GenerateLoadConstant(object, holder, rax, rbx, rdx, value, name, &miss); 1351 GenerateLoadConstant(object, holder, rax, rbx, rdx, value, name, &miss);
1354 __ bind(&miss); 1352 __ bind(&miss);
1355 GenerateLoadMiss(masm(), Code::LOAD_IC); 1353 GenerateLoadMiss(masm(), Code::LOAD_IC);
1356 1354
1357 // Return the generated code. 1355 // Return the generated code.
1358 return GetCode(CONSTANT_FUNCTION, name); 1356 return GetCode(CONSTANT_FUNCTION, name);
1359 } 1357 }
1360 1358
1361 1359
1362 Object* LoadStubCompiler::CompileLoadNonexistent(String* name, 1360 Object* LoadStubCompiler::CompileLoadNonexistent(String* name,
1363 JSObject* object, 1361 JSObject* object,
1364 JSObject* last) { 1362 JSObject* last) {
1365 // ----------- S t a t e ------------- 1363 // ----------- S t a t e -------------
1364 // -- rax : receiver
1366 // -- rcx : name 1365 // -- rcx : name
1367 // -- rsp[0] : return address 1366 // -- rsp[0] : return address
1368 // -- rsp[8] : receiver
1369 // ----------------------------------- 1367 // -----------------------------------
1370 Label miss; 1368 Label miss;
1371 1369
1372 // Load receiver.
1373 __ movq(rax, Operand(rsp, kPointerSize));
1374
1375 // Chech that receiver is not a smi. 1370 // Chech that receiver is not a smi.
1376 __ JumpIfSmi(rax, &miss); 1371 __ JumpIfSmi(rax, &miss);
1377 1372
1378 // Check the maps of the full prototype chain. Also check that 1373 // Check the maps of the full prototype chain. Also check that
1379 // global property cells up to (but not including) the last object 1374 // global property cells up to (but not including) the last object
1380 // in the prototype chain are empty. 1375 // in the prototype chain are empty.
1381 CheckPrototypes(object, rax, last, rbx, rdx, name, &miss); 1376 CheckPrototypes(object, rax, last, rbx, rdx, name, &miss);
1382 1377
1383 // If the last object in the prototype chain is a global object, 1378 // If the last object in the prototype chain is a global object,
1384 // check that the global property cell is empty. 1379 // check that the global property cell is empty.
(...skipping 17 matching lines...) Expand all
1402 // Return the generated code. 1397 // Return the generated code.
1403 return GetCode(NONEXISTENT, Heap::empty_string()); 1398 return GetCode(NONEXISTENT, Heap::empty_string());
1404 } 1399 }
1405 1400
1406 1401
1407 Object* LoadStubCompiler::CompileLoadField(JSObject* object, 1402 Object* LoadStubCompiler::CompileLoadField(JSObject* object,
1408 JSObject* holder, 1403 JSObject* holder,
1409 int index, 1404 int index,
1410 String* name) { 1405 String* name) {
1411 // ----------- S t a t e ------------- 1406 // ----------- S t a t e -------------
1407 // -- rax : receiver
1412 // -- rcx : name 1408 // -- rcx : name
1413 // -- rsp[0] : return address 1409 // -- rsp[0] : return address
1414 // -- rsp[8] : receiver
1415 // ----------------------------------- 1410 // -----------------------------------
1416 Label miss; 1411 Label miss;
1417 1412
1418 __ movq(rax, Operand(rsp, kPointerSize));
1419 GenerateLoadField(object, holder, rax, rbx, rdx, index, name, &miss); 1413 GenerateLoadField(object, holder, rax, rbx, rdx, index, name, &miss);
1420 __ bind(&miss); 1414 __ bind(&miss);
1421 GenerateLoadMiss(masm(), Code::LOAD_IC); 1415 GenerateLoadMiss(masm(), Code::LOAD_IC);
1422 1416
1423 // Return the generated code. 1417 // Return the generated code.
1424 return GetCode(FIELD, name); 1418 return GetCode(FIELD, name);
1425 } 1419 }
1426 1420
1427 1421
1428 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, 1422 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
1429 JSObject* holder, 1423 JSObject* holder,
1430 String* name) { 1424 String* name) {
1431 // ----------- S t a t e ------------- 1425 // ----------- S t a t e -------------
1426 // -- rax : receiver
1432 // -- rcx : name 1427 // -- rcx : name
1433 // -- rsp[0] : return address 1428 // -- rsp[0] : return address
1434 // -- rsp[8] : receiver
1435 // ----------------------------------- 1429 // -----------------------------------
1436 Label miss; 1430 Label miss;
1437 1431
1438 LookupResult lookup; 1432 LookupResult lookup;
1439 LookupPostInterceptor(holder, name, &lookup); 1433 LookupPostInterceptor(holder, name, &lookup);
1440 1434
1441 __ movq(rax, Operand(rsp, kPointerSize));
1442 // TODO(368): Compile in the whole chain: all the interceptors in 1435 // TODO(368): Compile in the whole chain: all the interceptors in
1443 // prototypes and ultimate answer. 1436 // prototypes and ultimate answer.
1444 GenerateLoadInterceptor(receiver, 1437 GenerateLoadInterceptor(receiver,
1445 holder, 1438 holder,
1446 &lookup, 1439 &lookup,
1447 rax, 1440 rax,
1448 rcx, 1441 rcx,
1449 rdx, 1442 rdx,
1450 rbx, 1443 rbx,
1451 name, 1444 name,
1452 &miss); 1445 &miss);
1453 1446
1454 __ bind(&miss); 1447 __ bind(&miss);
1455 GenerateLoadMiss(masm(), Code::LOAD_IC); 1448 GenerateLoadMiss(masm(), Code::LOAD_IC);
1456 1449
1457 // Return the generated code. 1450 // Return the generated code.
1458 return GetCode(INTERCEPTOR, name); 1451 return GetCode(INTERCEPTOR, name);
1459 } 1452 }
1460 1453
1461 1454
1462 Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object, 1455 Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
1463 GlobalObject* holder, 1456 GlobalObject* holder,
1464 JSGlobalPropertyCell* cell, 1457 JSGlobalPropertyCell* cell,
1465 String* name, 1458 String* name,
1466 bool is_dont_delete) { 1459 bool is_dont_delete) {
1467 // ----------- S t a t e ------------- 1460 // ----------- S t a t e -------------
1461 // -- rax : receiver
1468 // -- rcx : name 1462 // -- rcx : name
1469 // -- rsp[0] : return address 1463 // -- rsp[0] : return address
1470 // -- rsp[8] : receiver
1471 // ----------------------------------- 1464 // -----------------------------------
1472 Label miss; 1465 Label miss;
1473 1466
1474 // Get the receiver from the stack.
1475 __ movq(rax, Operand(rsp, kPointerSize));
1476
1477 // If the object is the holder then we know that it's a global 1467 // If the object is the holder then we know that it's a global
1478 // object which can only happen for contextual loads. In this case, 1468 // object which can only happen for contextual loads. In this case,
1479 // the receiver cannot be a smi. 1469 // the receiver cannot be a smi.
1480 if (object != holder) { 1470 if (object != holder) {
1481 __ JumpIfSmi(rax, &miss); 1471 __ JumpIfSmi(rax, &miss);
1482 } 1472 }
1483 1473
1484 // Check that the maps haven't changed. 1474 // Check that the maps haven't changed.
1485 CheckPrototypes(object, rax, holder, rbx, rdx, name, &miss); 1475 CheckPrototypes(object, rax, holder, rbx, rdx, name, &miss);
1486 1476
1487 // Get the value from the cell. 1477 // Get the value from the cell.
1488 __ Move(rax, Handle<JSGlobalPropertyCell>(cell)); 1478 __ Move(rbx, Handle<JSGlobalPropertyCell>(cell));
1489 __ movq(rax, FieldOperand(rax, JSGlobalPropertyCell::kValueOffset)); 1479 __ movq(rbx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset));
1490 1480
1491 // Check for deleted property if property can actually be deleted. 1481 // Check for deleted property if property can actually be deleted.
1492 if (!is_dont_delete) { 1482 if (!is_dont_delete) {
1493 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 1483 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex);
1494 __ j(equal, &miss); 1484 __ j(equal, &miss);
1495 } else if (FLAG_debug_code) { 1485 } else if (FLAG_debug_code) {
1496 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 1486 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex);
1497 __ Check(not_equal, "DontDelete cells can't contain the hole"); 1487 __ Check(not_equal, "DontDelete cells can't contain the hole");
1498 } 1488 }
1499 1489
1500 __ IncrementCounter(&Counters::named_load_global_inline, 1); 1490 __ IncrementCounter(&Counters::named_load_global_inline, 1);
1491 __ movq(rax, rbx);
1501 __ ret(0); 1492 __ ret(0);
1502 1493
1503 __ bind(&miss); 1494 __ bind(&miss);
1504 __ IncrementCounter(&Counters::named_load_global_inline_miss, 1); 1495 __ IncrementCounter(&Counters::named_load_global_inline_miss, 1);
1505 GenerateLoadMiss(masm(), Code::LOAD_IC); 1496 GenerateLoadMiss(masm(), Code::LOAD_IC);
1506 1497
1507 // Return the generated code. 1498 // Return the generated code.
1508 return GetCode(NORMAL, name); 1499 return GetCode(NORMAL, name);
1509 } 1500 }
1510 1501
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 // Return the generated code. 2317 // Return the generated code.
2327 return GetCode(); 2318 return GetCode();
2328 } 2319 }
2329 2320
2330 2321
2331 #undef __ 2322 #undef __
2332 2323
2333 } } // namespace v8::internal 2324 } } // namespace v8::internal
2334 2325
2335 #endif // V8_TARGET_ARCH_X64 2326 #endif // V8_TARGET_ARCH_X64
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