OLD | NEW |
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 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 __ li(a3, Handle<SharedFunctionInfo>(function->shared())); | 1462 __ li(a3, Handle<SharedFunctionInfo>(function->shared())); |
1463 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1463 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
1464 __ Branch(miss, ne, t0, Operand(a3)); | 1464 __ Branch(miss, ne, t0, Operand(a3)); |
1465 } else { | 1465 } else { |
1466 __ Branch(miss, ne, a1, Operand(Handle<JSFunction>(function))); | 1466 __ Branch(miss, ne, a1, Operand(Handle<JSFunction>(function))); |
1467 } | 1467 } |
1468 } | 1468 } |
1469 | 1469 |
1470 | 1470 |
1471 MaybeObject* CallStubCompiler::GenerateMissBranch() { | 1471 MaybeObject* CallStubCompiler::GenerateMissBranch() { |
1472 MaybeObject* maybe_obj = masm()->isolate()->stub_cache()->ComputeCallMiss( | 1472 MaybeObject* maybe_obj = |
1473 arguments().immediate(), kind_); | 1473 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), |
| 1474 kind_, |
| 1475 extra_ic_state_); |
1474 Object* obj; | 1476 Object* obj; |
1475 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1477 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1476 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); | 1478 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
1477 return obj; | 1479 return obj; |
1478 } | 1480 } |
1479 | 1481 |
1480 | 1482 |
1481 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, | 1483 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, |
1482 JSObject* holder, | 1484 JSObject* holder, |
1483 int index, | 1485 int index, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); | 1784 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); |
1783 | 1785 |
1784 const int argc = arguments().immediate(); | 1786 const int argc = arguments().immediate(); |
1785 | 1787 |
1786 Label miss; | 1788 Label miss; |
1787 Label name_miss; | 1789 Label name_miss; |
1788 Label index_out_of_range; | 1790 Label index_out_of_range; |
1789 | 1791 |
1790 Label* index_out_of_range_label = &index_out_of_range; | 1792 Label* index_out_of_range_label = &index_out_of_range; |
1791 | 1793 |
1792 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { | 1794 if (kind_ == Code::CALL_IC && |
| 1795 (CallICBase::StringStubState::decode(extra_ic_state_) == |
| 1796 DEFAULT_STRING_STUB)) { |
1793 index_out_of_range_label = &miss; | 1797 index_out_of_range_label = &miss; |
1794 } | 1798 } |
1795 | 1799 |
1796 GenerateNameCheck(name, &name_miss); | 1800 GenerateNameCheck(name, &name_miss); |
1797 | 1801 |
1798 // Check that the maps starting from the prototype haven't changed. | 1802 // Check that the maps starting from the prototype haven't changed. |
1799 GenerateDirectLoadGlobalFunctionPrototype(masm(), | 1803 GenerateDirectLoadGlobalFunctionPrototype(masm(), |
1800 Context::STRING_FUNCTION_INDEX, | 1804 Context::STRING_FUNCTION_INDEX, |
1801 v0, | 1805 v0, |
1802 &miss); | 1806 &miss); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 // If object is not a string, bail out to regular call. | 1870 // If object is not a string, bail out to regular call. |
1867 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); | 1871 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); |
1868 | 1872 |
1869 const int argc = arguments().immediate(); | 1873 const int argc = arguments().immediate(); |
1870 | 1874 |
1871 Label miss; | 1875 Label miss; |
1872 Label name_miss; | 1876 Label name_miss; |
1873 Label index_out_of_range; | 1877 Label index_out_of_range; |
1874 Label* index_out_of_range_label = &index_out_of_range; | 1878 Label* index_out_of_range_label = &index_out_of_range; |
1875 | 1879 |
1876 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { | 1880 if (kind_ == Code::CALL_IC && |
| 1881 (CallICBase::StringStubState::decode(extra_ic_state_) == |
| 1882 DEFAULT_STRING_STUB)) { |
1877 index_out_of_range_label = &miss; | 1883 index_out_of_range_label = &miss; |
1878 } | 1884 } |
1879 | 1885 |
1880 GenerateNameCheck(name, &name_miss); | 1886 GenerateNameCheck(name, &name_miss); |
1881 | 1887 |
1882 // Check that the maps starting from the prototype haven't changed. | 1888 // Check that the maps starting from the prototype haven't changed. |
1883 GenerateDirectLoadGlobalFunctionPrototype(masm(), | 1889 GenerateDirectLoadGlobalFunctionPrototype(masm(), |
1884 Context::STRING_FUNCTION_INDEX, | 1890 Context::STRING_FUNCTION_INDEX, |
1885 v0, | 1891 v0, |
1886 &miss); | 1892 &miss); |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2478 // Handle call cache miss. | 2484 // Handle call cache miss. |
2479 __ bind(&miss); | 2485 __ bind(&miss); |
2480 MaybeObject* maybe_result = GenerateMissBranch(); | 2486 MaybeObject* maybe_result = GenerateMissBranch(); |
2481 if (maybe_result->IsFailure()) return maybe_result; | 2487 if (maybe_result->IsFailure()) return maybe_result; |
2482 | 2488 |
2483 // Return the generated code. | 2489 // Return the generated code. |
2484 return GetCode(INTERCEPTOR, name); | 2490 return GetCode(INTERCEPTOR, name); |
2485 } | 2491 } |
2486 | 2492 |
2487 | 2493 |
2488 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, | 2494 MaybeObject* CallStubCompiler::CompileCallGlobal( |
2489 GlobalObject* holder, | 2495 JSObject* object, |
2490 JSGlobalPropertyCell* cell, | 2496 GlobalObject* holder, |
2491 JSFunction* function, | 2497 JSGlobalPropertyCell* cell, |
2492 String* name) { | 2498 JSFunction* function, |
| 2499 String* name, |
| 2500 Code::ExtraICState extra_ic_state) { |
2493 // ----------- S t a t e ------------- | 2501 // ----------- S t a t e ------------- |
2494 // -- a2 : name | 2502 // -- a2 : name |
2495 // -- ra : return address | 2503 // -- ra : return address |
2496 // ----------------------------------- | 2504 // ----------------------------------- |
2497 | 2505 |
2498 if (HasCustomCallGenerator(function)) { | 2506 if (HasCustomCallGenerator(function)) { |
2499 MaybeObject* maybe_result = CompileCustomCall( | 2507 MaybeObject* maybe_result = CompileCustomCall( |
2500 object, holder, cell, function, name); | 2508 object, holder, cell, function, name); |
2501 Object* result; | 2509 Object* result; |
2502 if (!maybe_result->ToObject(&result)) return maybe_result; | 2510 if (!maybe_result->ToObject(&result)) return maybe_result; |
(...skipping 20 matching lines...) Expand all Loading... |
2523 | 2531 |
2524 // Setup the context (function already in r1). | 2532 // Setup the context (function already in r1). |
2525 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 2533 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
2526 | 2534 |
2527 // Jump to the cached code (tail call). | 2535 // Jump to the cached code (tail call). |
2528 Counters* counters = masm()->isolate()->counters(); | 2536 Counters* counters = masm()->isolate()->counters(); |
2529 __ IncrementCounter(counters->call_global_inline(), 1, a3, t0); | 2537 __ IncrementCounter(counters->call_global_inline(), 1, a3, t0); |
2530 ASSERT(function->is_compiled()); | 2538 ASSERT(function->is_compiled()); |
2531 Handle<Code> code(function->code()); | 2539 Handle<Code> code(function->code()); |
2532 ParameterCount expected(function->shared()->formal_parameter_count()); | 2540 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 2541 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state) |
| 2542 ? CALL_AS_FUNCTION |
| 2543 : CALL_AS_METHOD; |
2533 if (V8::UseCrankshaft()) { | 2544 if (V8::UseCrankshaft()) { |
2534 UNIMPLEMENTED_MIPS(); | 2545 UNIMPLEMENTED_MIPS(); |
2535 } else { | 2546 } else { |
2536 __ InvokeCode(code, expected, arguments(), | 2547 __ InvokeCode(code, expected, arguments(), RelocInfo::CODE_TARGET, |
2537 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 2548 JUMP_FUNCTION, call_kind); |
2538 } | 2549 } |
2539 | 2550 |
2540 // Handle call cache miss. | 2551 // Handle call cache miss. |
2541 __ bind(&miss); | 2552 __ bind(&miss); |
2542 __ IncrementCounter(counters->call_global_inline_miss(), 1, a1, a3); | 2553 __ IncrementCounter(counters->call_global_inline_miss(), 1, a1, a3); |
2543 MaybeObject* maybe_result = GenerateMissBranch(); | 2554 MaybeObject* maybe_result = GenerateMissBranch(); |
2544 if (maybe_result->IsFailure()) return maybe_result; | 2555 if (maybe_result->IsFailure()) return maybe_result; |
2545 | 2556 |
2546 // Return the generated code. | 2557 // Return the generated code. |
2547 return GetCode(NORMAL, name); | 2558 return GetCode(NORMAL, name); |
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4265 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 4276 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
4266 __ Jump(ic, RelocInfo::CODE_TARGET); | 4277 __ Jump(ic, RelocInfo::CODE_TARGET); |
4267 } | 4278 } |
4268 | 4279 |
4269 | 4280 |
4270 #undef __ | 4281 #undef __ |
4271 | 4282 |
4272 } } // namespace v8::internal | 4283 } } // namespace v8::internal |
4273 | 4284 |
4274 #endif // V8_TARGET_ARCH_MIPS | 4285 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |