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

Side by Side Diff: src/ic.cc

Issue 551093: Implementing inline caches for GenericBinaryOpStub. ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 // Don't clear debug break inline cache as it will remove the break point. 216 // Don't clear debug break inline cache as it will remove the break point.
217 if (target->ic_state() == DEBUG_BREAK) return; 217 if (target->ic_state() == DEBUG_BREAK) return;
218 218
219 switch (target->kind()) { 219 switch (target->kind()) {
220 case Code::LOAD_IC: return LoadIC::Clear(address, target); 220 case Code::LOAD_IC: return LoadIC::Clear(address, target);
221 case Code::KEYED_LOAD_IC: return KeyedLoadIC::Clear(address, target); 221 case Code::KEYED_LOAD_IC: return KeyedLoadIC::Clear(address, target);
222 case Code::STORE_IC: return StoreIC::Clear(address, target); 222 case Code::STORE_IC: return StoreIC::Clear(address, target);
223 case Code::KEYED_STORE_IC: return KeyedStoreIC::Clear(address, target); 223 case Code::KEYED_STORE_IC: return KeyedStoreIC::Clear(address, target);
224 case Code::CALL_IC: return CallIC::Clear(address, target); 224 case Code::CALL_IC: return CallIC::Clear(address, target);
225 case Code::BINARY_OP_IC: return BinaryOpIC::Clear(address, target);
225 default: UNREACHABLE(); 226 default: UNREACHABLE();
226 } 227 }
227 } 228 }
228 229
229 230
230 void CallIC::Clear(Address address, Code* target) { 231 void CallIC::Clear(Address address, Code* target) {
231 State state = target->ic_state(); 232 State state = target->ic_state();
232 InLoopFlag in_loop = target->ic_in_loop(); 233 InLoopFlag in_loop = target->ic_in_loop();
233 if (state == UNINITIALIZED) return; 234 if (state == UNINITIALIZED) return;
234 Code* code = 235 Code* code =
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 1419
1419 void KeyedStoreIC::GenerateInitialize(MacroAssembler* masm) { 1420 void KeyedStoreIC::GenerateInitialize(MacroAssembler* masm) {
1420 Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss))); 1421 Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss)));
1421 } 1422 }
1422 1423
1423 1424
1424 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { 1425 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
1425 Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss))); 1426 Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss)));
1426 } 1427 }
1427 1428
1429 // defined in codegen-<arch>.cc
1430 Code* GetBinaryOpStub(int minor_key);
1431
1432 #ifdef DEBUG
1433 // defined in codegen-<arch>.cc
1434 void TraceBinaryOp(int old_key, int new_key);
1435 #endif
1436
1437 void BinaryOpIC::patch(Code* code) {
1438 set_target(code);
1439 }
1440
1441 void BinaryOpIC::Clear(Address address, Code* target) {
1442 if (target->ic_state() == UNINITIALIZED) return;
1443
1444 // At the end of a fast case stub there should be a reference to
1445 // a corresponding UNINITIALIZED stub, so look for the last reloc info item.
1446 RelocInfo* rinfo = NULL;
1447 for (RelocIterator it(target, RelocInfo::kCodeTargetMask);
1448 !it.done(); it.next()) {
1449 rinfo = it.rinfo();
1450 }
1451
1452 ASSERT(rinfo != NULL);
1453 Code * uninit_stub = Code::GetCodeFromTargetAddress(rinfo->target_address());
1454 ASSERT(uninit_stub->ic_state() == UNINITIALIZED &&
1455 uninit_stub->kind() == Code::BINARY_OP_IC);
1456 SetTargetAtAddress(address, uninit_stub);
1457 }
1458
1459
1460 Object * BinaryOp_Patch(Arguments args) {
Mads Ager (chromium) 2010/01/22 12:14:26 Remove space before '*'.
vladislav.kaznacheev 2010/01/22 14:09:42 Done.
1461 NoHandleAllocation na;
1462 int key = Smi::cast(args[1])->value();
1463 #ifdef DEBUG
1464 if (FLAG_trace_ic) {
1465 int old_key = Smi::cast(args[2])->value();
1466 TraceBinaryOp(old_key, key);
1467 }
1468 #endif // DEBUG
1469 Code* code = GetBinaryOpStub(key);
1470 BinaryOpIC ic;
1471 ic.patch(code);
1472 return args[0];
1473 }
1474
1428 1475
1429 static Address IC_utilities[] = { 1476 static Address IC_utilities[] = {
1430 #define ADDR(name) FUNCTION_ADDR(name), 1477 #define ADDR(name) FUNCTION_ADDR(name),
1431 IC_UTIL_LIST(ADDR) 1478 IC_UTIL_LIST(ADDR)
1432 NULL 1479 NULL
1433 #undef ADDR 1480 #undef ADDR
1434 }; 1481 };
1435 1482
1436 1483
1437 Address IC::AddressFromUtilityId(IC::UtilityId id) { 1484 Address IC::AddressFromUtilityId(IC::UtilityId id) {
1438 return IC_utilities[id]; 1485 return IC_utilities[id];
1439 } 1486 }
1440 1487
1441 1488
1442 } } // namespace v8::internal 1489 } } // namespace v8::internal
OLDNEW
« src/ia32/codegen-ia32.cc ('K') | « src/ic.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698