OLD | NEW |
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 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 __ cmp(FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset), | 1354 __ cmp(FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset), |
1355 Immediate(Handle<SharedFunctionInfo>(function->shared()))); | 1355 Immediate(Handle<SharedFunctionInfo>(function->shared()))); |
1356 __ j(not_equal, miss, not_taken); | 1356 __ j(not_equal, miss, not_taken); |
1357 } else { | 1357 } else { |
1358 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); | 1358 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); |
1359 __ j(not_equal, miss, not_taken); | 1359 __ j(not_equal, miss, not_taken); |
1360 } | 1360 } |
1361 } | 1361 } |
1362 | 1362 |
1363 | 1363 |
1364 MaybeObject* CallStubCompiler::GenerateMissBranch() { | 1364 MaybeObject* CallStubCompiler::GenerateBranchHelper( |
| 1365 Code::ExtraICState extra_ic_state) { |
| 1366 MaybeObject* maybe_obj = StubCache::ComputeCallMiss(arguments().immediate(), |
| 1367 kind_, |
| 1368 extra_ic_state); |
1365 Object* obj; | 1369 Object* obj; |
1366 { MaybeObject* maybe_obj = | 1370 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1367 StubCache::ComputeCallMiss(arguments().immediate(), kind_); | |
1368 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
1369 } | |
1370 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); | 1371 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
1371 return obj; | 1372 return obj; |
1372 } | 1373 } |
1373 | 1374 |
1374 | 1375 |
1375 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField( | 1376 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField( |
1376 JSObject* object, | 1377 JSObject* object, |
1377 JSObject* holder, | 1378 JSObject* holder, |
1378 int index, | 1379 int index, |
1379 String* name) { | 1380 String* name) { |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 &miss, // When not a number. | 1718 &miss, // When not a number. |
1718 &index_out_of_range, | 1719 &index_out_of_range, |
1719 STRING_INDEX_IS_NUMBER); | 1720 STRING_INDEX_IS_NUMBER); |
1720 char_code_at_generator.GenerateFast(masm()); | 1721 char_code_at_generator.GenerateFast(masm()); |
1721 __ ret((argc + 1) * kPointerSize); | 1722 __ ret((argc + 1) * kPointerSize); |
1722 | 1723 |
1723 StubRuntimeCallHelper call_helper; | 1724 StubRuntimeCallHelper call_helper; |
1724 char_code_at_generator.GenerateSlow(masm(), call_helper); | 1725 char_code_at_generator.GenerateSlow(masm(), call_helper); |
1725 | 1726 |
1726 __ bind(&index_out_of_range); | 1727 __ bind(&index_out_of_range); |
1727 __ Set(eax, Immediate(Factory::nan_value())); | 1728 // Restore function name in ecx. |
1728 __ ret((argc + 1) * kPointerSize); | 1729 __ Set(ecx, Immediate(Handle<String>(name))); |
| 1730 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { |
| 1731 // Change the extra state to record the fact that we've seen an |
| 1732 // out of bounds index. |
| 1733 MaybeObject* maybe_obj = |
| 1734 GenerateExtraStateChangeBranch(STRING_INDEX_OUT_OF_BOUNDS); |
| 1735 if (maybe_obj->IsFailure()) return maybe_obj; |
| 1736 } else { |
| 1737 __ Set(eax, Immediate(Factory::nan_value())); |
| 1738 __ ret((argc + 1) * kPointerSize); |
| 1739 } |
1729 | 1740 |
1730 __ bind(&miss); | 1741 __ bind(&miss); |
1731 Object* obj; | 1742 Object* obj; |
1732 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1743 { MaybeObject* maybe_obj = GenerateMissBranch(); |
1733 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1744 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1734 } | 1745 } |
1735 | 1746 |
1736 // Return the generated code. | 1747 // Return the generated code. |
1737 return GetCode(function); | 1748 return GetCode(function); |
1738 } | 1749 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 &miss, // When not a number. | 1803 &miss, // When not a number. |
1793 &index_out_of_range, | 1804 &index_out_of_range, |
1794 STRING_INDEX_IS_NUMBER); | 1805 STRING_INDEX_IS_NUMBER); |
1795 char_at_generator.GenerateFast(masm()); | 1806 char_at_generator.GenerateFast(masm()); |
1796 __ ret((argc + 1) * kPointerSize); | 1807 __ ret((argc + 1) * kPointerSize); |
1797 | 1808 |
1798 StubRuntimeCallHelper call_helper; | 1809 StubRuntimeCallHelper call_helper; |
1799 char_at_generator.GenerateSlow(masm(), call_helper); | 1810 char_at_generator.GenerateSlow(masm(), call_helper); |
1800 | 1811 |
1801 __ bind(&index_out_of_range); | 1812 __ bind(&index_out_of_range); |
1802 __ Set(eax, Immediate(Factory::empty_string())); | 1813 // Restore function name in ecx. |
1803 __ ret((argc + 1) * kPointerSize); | 1814 __ Set(ecx, Immediate(Handle<String>(name))); |
| 1815 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { |
| 1816 // Change the extra state to record the fact that we've seen an |
| 1817 // out of bounds index. |
| 1818 MaybeObject* maybe_obj = |
| 1819 GenerateExtraStateChangeBranch(STRING_INDEX_OUT_OF_BOUNDS); |
| 1820 if (maybe_obj->IsFailure()) return maybe_obj; |
| 1821 } else { |
| 1822 __ Set(eax, Immediate(Factory::empty_string())); |
| 1823 __ ret((argc + 1) * kPointerSize); |
| 1824 } |
1804 | 1825 |
1805 __ bind(&miss); | 1826 __ bind(&miss); |
1806 Object* obj; | 1827 Object* obj; |
1807 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1828 { MaybeObject* maybe_obj = GenerateMissBranch(); |
1808 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1829 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1809 } | 1830 } |
1810 | 1831 |
1811 // Return the generated code. | 1832 // Return the generated code. |
1812 return GetCode(function); | 1833 return GetCode(function); |
1813 } | 1834 } |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3283 // Return the generated code. | 3304 // Return the generated code. |
3284 return GetCode(); | 3305 return GetCode(); |
3285 } | 3306 } |
3286 | 3307 |
3287 | 3308 |
3288 #undef __ | 3309 #undef __ |
3289 | 3310 |
3290 } } // namespace v8::internal | 3311 } } // namespace v8::internal |
3291 | 3312 |
3292 #endif // V8_TARGET_ARCH_IA32 | 3313 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |