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

Side by Side Diff: src/ic.cc

Issue 10263008: Implement clearing of CompareICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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/ic.h ('k') | src/objects.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 switch (target->kind()) { 346 switch (target->kind()) {
347 case Code::LOAD_IC: return LoadIC::Clear(address, target); 347 case Code::LOAD_IC: return LoadIC::Clear(address, target);
348 case Code::KEYED_LOAD_IC: 348 case Code::KEYED_LOAD_IC:
349 return KeyedLoadIC::Clear(address, target); 349 return KeyedLoadIC::Clear(address, target);
350 case Code::STORE_IC: return StoreIC::Clear(address, target); 350 case Code::STORE_IC: return StoreIC::Clear(address, target);
351 case Code::KEYED_STORE_IC: 351 case Code::KEYED_STORE_IC:
352 return KeyedStoreIC::Clear(address, target); 352 return KeyedStoreIC::Clear(address, target);
353 case Code::CALL_IC: return CallIC::Clear(address, target); 353 case Code::CALL_IC: return CallIC::Clear(address, target);
354 case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target); 354 case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target);
355 case Code::COMPARE_IC: return CompareIC::Clear(address, target);
355 case Code::UNARY_OP_IC: 356 case Code::UNARY_OP_IC:
356 case Code::BINARY_OP_IC: 357 case Code::BINARY_OP_IC:
357 case Code::COMPARE_IC:
358 case Code::TO_BOOLEAN_IC: 358 case Code::TO_BOOLEAN_IC:
359 // Clearing these is tricky and does not 359 // Clearing these is tricky and does not
360 // make any performance difference. 360 // make any performance difference.
361 return; 361 return;
362 default: UNREACHABLE(); 362 default: UNREACHABLE();
363 } 363 }
364 } 364 }
365 365
366 366
367 void CallICBase::Clear(Address address, Code* target) { 367 void CallICBase::Clear(Address address, Code* target) {
368 if (target->ic_state() == UNINITIALIZED) return;
368 bool contextual = CallICBase::Contextual::decode(target->extra_ic_state()); 369 bool contextual = CallICBase::Contextual::decode(target->extra_ic_state());
369 State state = target->ic_state();
370 if (state == UNINITIALIZED) return;
371 Code* code = 370 Code* code =
372 Isolate::Current()->stub_cache()->FindCallInitialize( 371 Isolate::Current()->stub_cache()->FindCallInitialize(
373 target->arguments_count(), 372 target->arguments_count(),
374 contextual ? RelocInfo::CODE_TARGET_CONTEXT : RelocInfo::CODE_TARGET, 373 contextual ? RelocInfo::CODE_TARGET_CONTEXT : RelocInfo::CODE_TARGET,
375 target->kind()); 374 target->kind());
376 SetTargetAtAddress(address, code); 375 SetTargetAtAddress(address, code);
377 } 376 }
378 377
379 378
380 void KeyedLoadIC::Clear(Address address, Code* target) { 379 void KeyedLoadIC::Clear(Address address, Code* target) {
(...skipping 22 matching lines...) Expand all
403 402
404 void KeyedStoreIC::Clear(Address address, Code* target) { 403 void KeyedStoreIC::Clear(Address address, Code* target) {
405 if (target->ic_state() == UNINITIALIZED) return; 404 if (target->ic_state() == UNINITIALIZED) return;
406 SetTargetAtAddress(address, 405 SetTargetAtAddress(address,
407 (Code::GetStrictMode(target->extra_ic_state()) == kStrictMode) 406 (Code::GetStrictMode(target->extra_ic_state()) == kStrictMode)
408 ? initialize_stub_strict() 407 ? initialize_stub_strict()
409 : initialize_stub()); 408 : initialize_stub());
410 } 409 }
411 410
412 411
412 void CompareIC::Clear(Address address, Code* target) {
413 // Only clear ICCompareStubs, we currently cannot clear generic CompareStubs.
414 if (target->major_key() != CodeStub::CompareIC) return;
415 if (target->compare_state() == UNINITIALIZED) return;
Vyacheslav Egorov (Chromium) 2012/04/30 14:27:10 We can limit clearing to those states that can ret
Michael Starzinger 2012/05/02 11:07:23 Done.
416 Token::Value op = CompareIC::ComputeOperation(target);
417 SetTargetAtAddress(address, initialize_stub(op));
418 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK);
419 }
420
421
413 static bool HasInterceptorGetter(JSObject* object) { 422 static bool HasInterceptorGetter(JSObject* object) {
414 return !object->GetNamedInterceptor()->getter()->IsUndefined(); 423 return !object->GetNamedInterceptor()->getter()->IsUndefined();
415 } 424 }
416 425
417 426
418 static void LookupForRead(Handle<Object> object, 427 static void LookupForRead(Handle<Object> object,
419 Handle<String> name, 428 Handle<String> name,
420 LookupResult* lookup) { 429 LookupResult* lookup) {
421 // Skip all the objects with named interceptors, but 430 // Skip all the objects with named interceptors, but
422 // without actual getter. 431 // without actual getter.
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 BinaryOpIC::GetName(previous_type), 2398 BinaryOpIC::GetName(previous_type),
2390 BinaryOpIC::GetName(type), 2399 BinaryOpIC::GetName(type),
2391 BinaryOpIC::GetName(result_type), 2400 BinaryOpIC::GetName(result_type),
2392 Token::Name(op)); 2401 Token::Name(op));
2393 } 2402 }
2394 BinaryOpIC ic(isolate); 2403 BinaryOpIC ic(isolate);
2395 ic.patch(*code); 2404 ic.patch(*code);
2396 2405
2397 // Activate inlined smi code. 2406 // Activate inlined smi code.
2398 if (previous_type == BinaryOpIC::UNINITIALIZED) { 2407 if (previous_type == BinaryOpIC::UNINITIALIZED) {
2399 PatchInlinedSmiCode(ic.address()); 2408 PatchInlinedSmiCode(ic.address(), ENABLE_INLINED_SMI_CHECK);
2400 } 2409 }
2401 } 2410 }
2402 2411
2403 Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>( 2412 Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>(
2404 isolate->thread_local_top()->context_->builtins(), isolate); 2413 isolate->thread_local_top()->context_->builtins(), isolate);
2405 Object* builtin = NULL; // Initialization calms down the compiler. 2414 Object* builtin = NULL; // Initialization calms down the compiler.
2406 switch (op) { 2415 switch (op) {
2407 case Token::ADD: 2416 case Token::ADD:
2408 builtin = builtins->javascript_builtin(Builtins::ADD); 2417 builtin = builtins->javascript_builtin(Builtins::ADD);
2409 break; 2418 break;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 ARRAY_SIZE(builtin_args), 2459 ARRAY_SIZE(builtin_args),
2451 builtin_args, 2460 builtin_args,
2452 &caught_exception); 2461 &caught_exception);
2453 if (caught_exception) { 2462 if (caught_exception) {
2454 return Failure::Exception(); 2463 return Failure::Exception();
2455 } 2464 }
2456 return *result; 2465 return *result;
2457 } 2466 }
2458 2467
2459 2468
2469 Code* CompareIC::initialize_stub(Token::Value op) {
Vyacheslav Egorov (Chromium) 2012/04/30 14:27:10 I guess it should be called GetUnitializedStub() o
Michael Starzinger 2012/05/02 11:07:23 Done. Renamed to GetRawUninitialized() to be in sy
2470 ICCompareStub stub(op, UNINITIALIZED);
2471 Code* code = NULL;
2472 CHECK(stub.FindCodeInCache(&code));
2473 return code;
2474 }
2475
2476
2460 Handle<Code> CompareIC::GetUninitialized(Token::Value op) { 2477 Handle<Code> CompareIC::GetUninitialized(Token::Value op) {
2461 ICCompareStub stub(op, UNINITIALIZED); 2478 ICCompareStub stub(op, UNINITIALIZED);
2462 return stub.GetCode(); 2479 return stub.GetCode();
2463 } 2480 }
2464 2481
2465 2482
2466 CompareIC::State CompareIC::ComputeState(Code* target) { 2483 CompareIC::State CompareIC::ComputeState(Code* target) {
2467 int key = target->major_key(); 2484 int key = target->major_key();
2468 if (key == CodeStub::Compare) return GENERIC; 2485 if (key == CodeStub::Compare) return GENERIC;
2469 ASSERT(key == CodeStub::CompareIC); 2486 ASSERT(key == CodeStub::CompareIC);
2470 return static_cast<State>(target->compare_state()); 2487 return static_cast<State>(target->compare_state());
2471 } 2488 }
2472 2489
2473 2490
2491 Token::Value CompareIC::ComputeOperation(Code* target) {
2492 ASSERT(target->major_key() == CodeStub::CompareIC);
2493 return static_cast<Token::Value>(target->compare_operation());
2494 }
2495
2496
2474 const char* CompareIC::GetStateName(State state) { 2497 const char* CompareIC::GetStateName(State state) {
2475 switch (state) { 2498 switch (state) {
2476 case UNINITIALIZED: return "UNINITIALIZED"; 2499 case UNINITIALIZED: return "UNINITIALIZED";
2477 case SMIS: return "SMIS"; 2500 case SMIS: return "SMIS";
2478 case HEAP_NUMBERS: return "HEAP_NUMBERS"; 2501 case HEAP_NUMBERS: return "HEAP_NUMBERS";
2479 case OBJECTS: return "OBJECTS"; 2502 case OBJECTS: return "OBJECTS";
2480 case KNOWN_OBJECTS: return "OBJECTS"; 2503 case KNOWN_OBJECTS: return "OBJECTS";
2481 case SYMBOLS: return "SYMBOLS"; 2504 case SYMBOLS: return "SYMBOLS";
2482 case STRINGS: return "STRINGS"; 2505 case STRINGS: return "STRINGS";
2483 case GENERIC: return "GENERIC"; 2506 case GENERIC: return "GENERIC";
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 #undef ADDR 2605 #undef ADDR
2583 }; 2606 };
2584 2607
2585 2608
2586 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2609 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2587 return IC_utilities[id]; 2610 return IC_utilities[id];
2588 } 2611 }
2589 2612
2590 2613
2591 } } // namespace v8::internal 2614 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698