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

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

Issue 8365026: MIPS: port Handlify the stub cache lookup and patching for CallIC and KeyedCallIC. (Closed)
Patch Set: Created 9 years, 2 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 | « src/mips/macro-assembler-mips.cc ('k') | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1494 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1495 __ Branch(miss, ne, t0, Operand(a3)); 1495 __ Branch(miss, ne, t0, Operand(a3));
1496 } else { 1496 } else {
1497 __ Branch(miss, ne, a1, Operand(Handle<JSFunction>(function))); 1497 __ Branch(miss, ne, a1, Operand(Handle<JSFunction>(function)));
1498 } 1498 }
1499 } 1499 }
1500 1500
1501 1501
1502 MaybeObject* CallStubCompiler::GenerateMissBranch() { 1502 MaybeObject* CallStubCompiler::GenerateMissBranch() {
1503 MaybeObject* maybe_obj = 1503 MaybeObject* maybe_obj =
1504 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), 1504 isolate()->stub_cache()->TryComputeCallMiss(arguments().immediate(),
1505 kind_, 1505 kind_,
1506 extra_ic_state_); 1506 extra_state_);
1507 Object* obj; 1507 Object* obj;
1508 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1508 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1509 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); 1509 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
1510 return obj; 1510 return obj;
1511 } 1511 }
1512 1512
1513 1513
1514 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, 1514 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object,
1515 JSObject* holder, 1515 JSObject* holder,
1516 int index, 1516 int index,
(...skipping 10 matching lines...) Expand all
1527 1527
1528 // Get the receiver of the function from the stack into a0. 1528 // Get the receiver of the function from the stack into a0.
1529 __ lw(a0, MemOperand(sp, argc * kPointerSize)); 1529 __ lw(a0, MemOperand(sp, argc * kPointerSize));
1530 // Check that the receiver isn't a smi. 1530 // Check that the receiver isn't a smi.
1531 __ JumpIfSmi(a0, &miss, t0); 1531 __ JumpIfSmi(a0, &miss, t0);
1532 1532
1533 // Do the right check and compute the holder register. 1533 // Do the right check and compute the holder register.
1534 Register reg = CheckPrototypes(object, a0, holder, a1, a3, t0, name, &miss); 1534 Register reg = CheckPrototypes(object, a0, holder, a1, a3, t0, name, &miss);
1535 GenerateFastPropertyLoad(masm(), a1, reg, holder, index); 1535 GenerateFastPropertyLoad(masm(), a1, reg, holder, index);
1536 1536
1537 GenerateCallFunction(masm(), object, arguments(), &miss, extra_ic_state_); 1537 GenerateCallFunction(masm(), object, arguments(), &miss, extra_state_);
1538 1538
1539 // Handle call cache miss. 1539 // Handle call cache miss.
1540 __ bind(&miss); 1540 __ bind(&miss);
1541 MaybeObject* maybe_result = GenerateMissBranch(); 1541 MaybeObject* maybe_result = GenerateMissBranch();
1542 if (maybe_result->IsFailure()) return maybe_result; 1542 if (maybe_result->IsFailure()) return maybe_result;
1543 1543
1544 // Return the generated code. 1544 // Return the generated code.
1545 return GetCode(FIELD, name); 1545 return GetCode(FIELD, name);
1546 } 1546 }
1547 1547
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 1846
1847 const int argc = arguments().immediate(); 1847 const int argc = arguments().immediate();
1848 1848
1849 Label miss; 1849 Label miss;
1850 Label name_miss; 1850 Label name_miss;
1851 Label index_out_of_range; 1851 Label index_out_of_range;
1852 1852
1853 Label* index_out_of_range_label = &index_out_of_range; 1853 Label* index_out_of_range_label = &index_out_of_range;
1854 1854
1855 if (kind_ == Code::CALL_IC && 1855 if (kind_ == Code::CALL_IC &&
1856 (CallICBase::StringStubState::decode(extra_ic_state_) == 1856 (CallICBase::StringStubState::decode(extra_state_) ==
1857 DEFAULT_STRING_STUB)) { 1857 DEFAULT_STRING_STUB)) {
1858 index_out_of_range_label = &miss; 1858 index_out_of_range_label = &miss;
1859 } 1859 }
1860 1860
1861 GenerateNameCheck(name, &name_miss); 1861 GenerateNameCheck(name, &name_miss);
1862 1862
1863 // Check that the maps starting from the prototype haven't changed. 1863 // Check that the maps starting from the prototype haven't changed.
1864 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1864 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1865 Context::STRING_FUNCTION_INDEX, 1865 Context::STRING_FUNCTION_INDEX,
1866 v0, 1866 v0,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); 1932 if (!object->IsString() || cell != NULL) return heap()->undefined_value();
1933 1933
1934 const int argc = arguments().immediate(); 1934 const int argc = arguments().immediate();
1935 1935
1936 Label miss; 1936 Label miss;
1937 Label name_miss; 1937 Label name_miss;
1938 Label index_out_of_range; 1938 Label index_out_of_range;
1939 Label* index_out_of_range_label = &index_out_of_range; 1939 Label* index_out_of_range_label = &index_out_of_range;
1940 1940
1941 if (kind_ == Code::CALL_IC && 1941 if (kind_ == Code::CALL_IC &&
1942 (CallICBase::StringStubState::decode(extra_ic_state_) == 1942 (CallICBase::StringStubState::decode(extra_state_) ==
1943 DEFAULT_STRING_STUB)) { 1943 DEFAULT_STRING_STUB)) {
1944 index_out_of_range_label = &miss; 1944 index_out_of_range_label = &miss;
1945 } 1945 }
1946 1946
1947 GenerateNameCheck(name, &name_miss); 1947 GenerateNameCheck(name, &name_miss);
1948 1948
1949 // Check that the maps starting from the prototype haven't changed. 1949 // Check that the maps starting from the prototype haven't changed.
1950 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1950 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1951 Context::STRING_FUNCTION_INDEX, 1951 Context::STRING_FUNCTION_INDEX,
1952 v0, 1952 v0,
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
2477 CheckPrototypes(JSObject::cast(object->GetPrototype()), a0, holder, a3, 2477 CheckPrototypes(JSObject::cast(object->GetPrototype()), a0, holder, a3,
2478 a1, t0, name, &miss); 2478 a1, t0, name, &miss);
2479 } 2479 }
2480 break; 2480 break;
2481 } 2481 }
2482 2482
2483 default: 2483 default:
2484 UNREACHABLE(); 2484 UNREACHABLE();
2485 } 2485 }
2486 2486
2487 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) 2487 CallKind call_kind = CallICBase::Contextual::decode(extra_state_)
2488 ? CALL_AS_FUNCTION 2488 ? CALL_AS_FUNCTION
2489 : CALL_AS_METHOD; 2489 : CALL_AS_METHOD;
2490 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, call_kind); 2490 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, call_kind);
2491 2491
2492 // Handle call cache miss. 2492 // Handle call cache miss.
2493 __ bind(&miss); 2493 __ bind(&miss);
2494 2494
2495 MaybeObject* maybe_result = GenerateMissBranch(); 2495 MaybeObject* maybe_result = GenerateMissBranch();
2496 if (maybe_result->IsFailure()) return maybe_result; 2496 if (maybe_result->IsFailure()) return maybe_result;
2497 2497
(...skipping 16 matching lines...) Expand all
2514 2514
2515 // Get the number of arguments. 2515 // Get the number of arguments.
2516 const int argc = arguments().immediate(); 2516 const int argc = arguments().immediate();
2517 2517
2518 LookupResult lookup(isolate()); 2518 LookupResult lookup(isolate());
2519 LookupPostInterceptor(holder, name, &lookup); 2519 LookupPostInterceptor(holder, name, &lookup);
2520 2520
2521 // Get the receiver from the stack. 2521 // Get the receiver from the stack.
2522 __ lw(a1, MemOperand(sp, argc * kPointerSize)); 2522 __ lw(a1, MemOperand(sp, argc * kPointerSize));
2523 2523
2524 CallInterceptorCompiler compiler(this, arguments(), a2, extra_ic_state_); 2524 CallInterceptorCompiler compiler(this, arguments(), a2, extra_state_);
2525 MaybeObject* result = compiler.Compile(masm(), 2525 MaybeObject* result = compiler.Compile(masm(),
2526 object, 2526 object,
2527 holder, 2527 holder,
2528 name, 2528 name,
2529 &lookup, 2529 &lookup,
2530 a1, 2530 a1,
2531 a3, 2531 a3,
2532 t0, 2532 t0,
2533 a0, 2533 a0,
2534 &miss); 2534 &miss);
2535 if (result->IsFailure()) { 2535 if (result->IsFailure()) {
2536 return result; 2536 return result;
2537 } 2537 }
2538 2538
2539 // Move returned value, the function to call, to a1. 2539 // Move returned value, the function to call, to a1.
2540 __ mov(a1, v0); 2540 __ mov(a1, v0);
2541 // Restore receiver. 2541 // Restore receiver.
2542 __ lw(a0, MemOperand(sp, argc * kPointerSize)); 2542 __ lw(a0, MemOperand(sp, argc * kPointerSize));
2543 2543
2544 GenerateCallFunction(masm(), object, arguments(), &miss, extra_ic_state_); 2544 GenerateCallFunction(masm(), object, arguments(), &miss, extra_state_);
2545 2545
2546 // Handle call cache miss. 2546 // Handle call cache miss.
2547 __ bind(&miss); 2547 __ bind(&miss);
2548 MaybeObject* maybe_result = GenerateMissBranch(); 2548 MaybeObject* maybe_result = GenerateMissBranch();
2549 if (maybe_result->IsFailure()) return maybe_result; 2549 if (maybe_result->IsFailure()) return maybe_result;
2550 2550
2551 // Return the generated code. 2551 // Return the generated code.
2552 return GetCode(INTERCEPTOR, name); 2552 return GetCode(INTERCEPTOR, name);
2553 } 2553 }
2554 2554
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 __ lw(a3, FieldMemOperand(a0, GlobalObject::kGlobalReceiverOffset)); 2588 __ lw(a3, FieldMemOperand(a0, GlobalObject::kGlobalReceiverOffset));
2589 __ sw(a3, MemOperand(sp, argc * kPointerSize)); 2589 __ sw(a3, MemOperand(sp, argc * kPointerSize));
2590 } 2590 }
2591 2591
2592 // Setup the context (function already in r1). 2592 // Setup the context (function already in r1).
2593 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 2593 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
2594 2594
2595 // Jump to the cached code (tail call). 2595 // Jump to the cached code (tail call).
2596 Counters* counters = masm()->isolate()->counters(); 2596 Counters* counters = masm()->isolate()->counters();
2597 __ IncrementCounter(counters->call_global_inline(), 1, a3, t0); 2597 __ IncrementCounter(counters->call_global_inline(), 1, a3, t0);
2598 ASSERT(function->is_compiled());
2599 Handle<Code> code(function->code()); 2598 Handle<Code> code(function->code());
2600 ParameterCount expected(function->shared()->formal_parameter_count()); 2599 ParameterCount expected(function->shared()->formal_parameter_count());
2601 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) 2600 CallKind call_kind = CallICBase::Contextual::decode(extra_state_)
2602 ? CALL_AS_FUNCTION 2601 ? CALL_AS_FUNCTION
2603 : CALL_AS_METHOD; 2602 : CALL_AS_METHOD;
2604 if (V8::UseCrankshaft()) { 2603 // We call indirectly through the code field in the function to
2605 // TODO(kasperl): For now, we always call indirectly through the 2604 // allow recompilation to take effect without changing any of the
2606 // code field in the function to allow recompilation to take effect 2605 // call sites.
2607 // without changing any of the call sites. 2606 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
2608 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 2607 __ InvokeCode(a3, expected, arguments(), JUMP_FUNCTION,
2609 __ InvokeCode(a3, expected, arguments(), JUMP_FUNCTION, 2608 NullCallWrapper(), call_kind);
2610 NullCallWrapper(), call_kind);
2611 } else {
2612 __ InvokeCode(code, expected, arguments(), RelocInfo::CODE_TARGET,
2613 JUMP_FUNCTION, call_kind);
2614 }
2615 2609
2616 // Handle call cache miss. 2610 // Handle call cache miss.
2617 __ bind(&miss); 2611 __ bind(&miss);
2618 __ IncrementCounter(counters->call_global_inline_miss(), 1, a1, a3); 2612 __ IncrementCounter(counters->call_global_inline_miss(), 1, a1, a3);
2619 MaybeObject* maybe_result = GenerateMissBranch(); 2613 MaybeObject* maybe_result = GenerateMissBranch();
2620 if (maybe_result->IsFailure()) return maybe_result; 2614 if (maybe_result->IsFailure()) return maybe_result;
2621 2615
2622 // Return the generated code. 2616 // Return the generated code.
2623 return GetCode(NORMAL, name); 2617 return GetCode(NORMAL, name);
2624 } 2618 }
(...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after
4530 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); 4524 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss();
4531 __ Jump(ic_miss, RelocInfo::CODE_TARGET); 4525 __ Jump(ic_miss, RelocInfo::CODE_TARGET);
4532 } 4526 }
4533 4527
4534 4528
4535 #undef __ 4529 #undef __
4536 4530
4537 } } // namespace v8::internal 4531 } } // namespace v8::internal
4538 4532
4539 #endif // V8_TARGET_ARCH_MIPS 4533 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698