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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 } else { | 1323 } else { |
1324 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); | 1324 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); |
1325 __ j(not_equal, miss); | 1325 __ j(not_equal, miss); |
1326 } | 1326 } |
1327 } | 1327 } |
1328 | 1328 |
1329 | 1329 |
1330 MaybeObject* CallStubCompiler::GenerateMissBranch() { | 1330 MaybeObject* CallStubCompiler::GenerateMissBranch() { |
1331 MaybeObject* maybe_obj = | 1331 MaybeObject* maybe_obj = |
1332 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), | 1332 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), |
1333 kind_); | 1333 kind_, |
| 1334 extra_ic_state_); |
1334 Object* obj; | 1335 Object* obj; |
1335 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1336 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1336 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); | 1337 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
1337 return obj; | 1338 return obj; |
1338 } | 1339 } |
1339 | 1340 |
1340 | 1341 |
1341 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField( | 1342 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField( |
1342 JSObject* object, | 1343 JSObject* object, |
1343 JSObject* holder, | 1344 JSObject* holder, |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 return isolate()->heap()->undefined_value(); | 1651 return isolate()->heap()->undefined_value(); |
1651 } | 1652 } |
1652 | 1653 |
1653 const int argc = arguments().immediate(); | 1654 const int argc = arguments().immediate(); |
1654 | 1655 |
1655 Label miss; | 1656 Label miss; |
1656 Label name_miss; | 1657 Label name_miss; |
1657 Label index_out_of_range; | 1658 Label index_out_of_range; |
1658 Label* index_out_of_range_label = &index_out_of_range; | 1659 Label* index_out_of_range_label = &index_out_of_range; |
1659 | 1660 |
1660 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { | 1661 if (kind_ == Code::CALL_IC && |
| 1662 (CallICBase::StringStubState::decode(extra_ic_state_) == |
| 1663 DEFAULT_STRING_STUB)) { |
1661 index_out_of_range_label = &miss; | 1664 index_out_of_range_label = &miss; |
1662 } | 1665 } |
1663 | 1666 |
1664 GenerateNameCheck(name, &name_miss); | 1667 GenerateNameCheck(name, &name_miss); |
1665 | 1668 |
1666 // Check that the maps starting from the prototype haven't changed. | 1669 // Check that the maps starting from the prototype haven't changed. |
1667 GenerateDirectLoadGlobalFunctionPrototype(masm(), | 1670 GenerateDirectLoadGlobalFunctionPrototype(masm(), |
1668 Context::STRING_FUNCTION_INDEX, | 1671 Context::STRING_FUNCTION_INDEX, |
1669 eax, | 1672 eax, |
1670 &miss); | 1673 &miss); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 return heap()->undefined_value(); | 1737 return heap()->undefined_value(); |
1735 } | 1738 } |
1736 | 1739 |
1737 const int argc = arguments().immediate(); | 1740 const int argc = arguments().immediate(); |
1738 | 1741 |
1739 Label miss; | 1742 Label miss; |
1740 Label name_miss; | 1743 Label name_miss; |
1741 Label index_out_of_range; | 1744 Label index_out_of_range; |
1742 Label* index_out_of_range_label = &index_out_of_range; | 1745 Label* index_out_of_range_label = &index_out_of_range; |
1743 | 1746 |
1744 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { | 1747 if (kind_ == Code::CALL_IC && |
| 1748 (CallICBase::StringStubState::decode(extra_ic_state_) == |
| 1749 DEFAULT_STRING_STUB)) { |
1745 index_out_of_range_label = &miss; | 1750 index_out_of_range_label = &miss; |
1746 } | 1751 } |
1747 | 1752 |
1748 GenerateNameCheck(name, &name_miss); | 1753 GenerateNameCheck(name, &name_miss); |
1749 | 1754 |
1750 // Check that the maps starting from the prototype haven't changed. | 1755 // Check that the maps starting from the prototype haven't changed. |
1751 GenerateDirectLoadGlobalFunctionPrototype(masm(), | 1756 GenerateDirectLoadGlobalFunctionPrototype(masm(), |
1752 Context::STRING_FUNCTION_INDEX, | 1757 Context::STRING_FUNCTION_INDEX, |
1753 eax, | 1758 eax, |
1754 &miss); | 1759 &miss); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 // Handle load cache miss. | 2371 // Handle load cache miss. |
2367 __ bind(&miss); | 2372 __ bind(&miss); |
2368 MaybeObject* maybe_result = GenerateMissBranch(); | 2373 MaybeObject* maybe_result = GenerateMissBranch(); |
2369 if (maybe_result->IsFailure()) return maybe_result; | 2374 if (maybe_result->IsFailure()) return maybe_result; |
2370 | 2375 |
2371 // Return the generated code. | 2376 // Return the generated code. |
2372 return GetCode(INTERCEPTOR, name); | 2377 return GetCode(INTERCEPTOR, name); |
2373 } | 2378 } |
2374 | 2379 |
2375 | 2380 |
2376 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, | 2381 MaybeObject* CallStubCompiler::CompileCallGlobal( |
2377 GlobalObject* holder, | 2382 JSObject* object, |
2378 JSGlobalPropertyCell* cell, | 2383 GlobalObject* holder, |
2379 JSFunction* function, | 2384 JSGlobalPropertyCell* cell, |
2380 String* name) { | 2385 JSFunction* function, |
| 2386 String* name, |
| 2387 Code::ExtraICState extra_ic_state) { |
2381 // ----------- S t a t e ------------- | 2388 // ----------- S t a t e ------------- |
2382 // -- ecx : name | 2389 // -- ecx : name |
2383 // -- esp[0] : return address | 2390 // -- esp[0] : return address |
2384 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 2391 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
2385 // -- ... | 2392 // -- ... |
2386 // -- esp[(argc + 1) * 4] : receiver | 2393 // -- esp[(argc + 1) * 4] : receiver |
2387 // ----------------------------------- | 2394 // ----------------------------------- |
2388 | 2395 |
2389 if (HasCustomCallGenerator(function)) { | 2396 if (HasCustomCallGenerator(function)) { |
2390 MaybeObject* maybe_result = CompileCustomCall( | 2397 MaybeObject* maybe_result = CompileCustomCall( |
(...skipping 22 matching lines...) Expand all Loading... |
2413 } | 2420 } |
2414 | 2421 |
2415 // Setup the context (function already in edi). | 2422 // Setup the context (function already in edi). |
2416 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 2423 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
2417 | 2424 |
2418 // Jump to the cached code (tail call). | 2425 // Jump to the cached code (tail call). |
2419 Counters* counters = isolate()->counters(); | 2426 Counters* counters = isolate()->counters(); |
2420 __ IncrementCounter(counters->call_global_inline(), 1); | 2427 __ IncrementCounter(counters->call_global_inline(), 1); |
2421 ASSERT(function->is_compiled()); | 2428 ASSERT(function->is_compiled()); |
2422 ParameterCount expected(function->shared()->formal_parameter_count()); | 2429 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 2430 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state) |
| 2431 ? CALL_AS_FUNCTION |
| 2432 : CALL_AS_METHOD; |
2423 if (V8::UseCrankshaft()) { | 2433 if (V8::UseCrankshaft()) { |
2424 // TODO(kasperl): For now, we always call indirectly through the | 2434 // TODO(kasperl): For now, we always call indirectly through the |
2425 // code field in the function to allow recompilation to take effect | 2435 // code field in the function to allow recompilation to take effect |
2426 // without changing any of the call sites. | 2436 // without changing any of the call sites. |
2427 __ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 2437 __ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
2428 expected, arguments(), JUMP_FUNCTION); | 2438 expected, arguments(), JUMP_FUNCTION, |
| 2439 NullCallWrapper(), call_kind); |
2429 } else { | 2440 } else { |
2430 Handle<Code> code(function->code()); | 2441 Handle<Code> code(function->code()); |
2431 __ InvokeCode(code, expected, arguments(), | 2442 __ InvokeCode(code, expected, arguments(), |
2432 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 2443 RelocInfo::CODE_TARGET, JUMP_FUNCTION, |
| 2444 NullCallWrapper(), call_kind); |
2433 } | 2445 } |
2434 | 2446 |
2435 // Handle call cache miss. | 2447 // Handle call cache miss. |
2436 __ bind(&miss); | 2448 __ bind(&miss); |
2437 __ IncrementCounter(counters->call_global_inline_miss(), 1); | 2449 __ IncrementCounter(counters->call_global_inline_miss(), 1); |
2438 MaybeObject* maybe_result = GenerateMissBranch(); | 2450 MaybeObject* maybe_result = GenerateMissBranch(); |
2439 if (maybe_result->IsFailure()) return maybe_result; | 2451 if (maybe_result->IsFailure()) return maybe_result; |
2440 | 2452 |
2441 // Return the generated code. | 2453 // Return the generated code. |
2442 return GetCode(NORMAL, name); | 2454 return GetCode(NORMAL, name); |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3826 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3838 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3827 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3839 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3828 } | 3840 } |
3829 | 3841 |
3830 | 3842 |
3831 #undef __ | 3843 #undef __ |
3832 | 3844 |
3833 } } // namespace v8::internal | 3845 } } // namespace v8::internal |
3834 | 3846 |
3835 #endif // V8_TARGET_ARCH_IA32 | 3847 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |