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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 __ cmpq(FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset), rax); | 1287 __ cmpq(FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset), rax); |
1288 __ j(not_equal, miss); | 1288 __ j(not_equal, miss); |
1289 } else { | 1289 } else { |
1290 __ Cmp(rdi, Handle<JSFunction>(function)); | 1290 __ Cmp(rdi, Handle<JSFunction>(function)); |
1291 __ j(not_equal, miss); | 1291 __ j(not_equal, miss); |
1292 } | 1292 } |
1293 } | 1293 } |
1294 | 1294 |
1295 | 1295 |
1296 MaybeObject* CallStubCompiler::GenerateMissBranch() { | 1296 MaybeObject* CallStubCompiler::GenerateMissBranch() { |
1297 MaybeObject* maybe_obj = isolate()->stub_cache()->ComputeCallMiss( | 1297 MaybeObject* maybe_obj = |
1298 arguments().immediate(), kind_); | 1298 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), |
| 1299 kind_, |
| 1300 extra_ic_state_); |
1299 Object* obj; | 1301 Object* obj; |
1300 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1302 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1301 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); | 1303 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
1302 return obj; | 1304 return obj; |
1303 } | 1305 } |
1304 | 1306 |
1305 | 1307 |
1306 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, | 1308 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, |
1307 JSObject* holder, | 1309 JSObject* holder, |
1308 int index, | 1310 int index, |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 // If object is not a string, bail out to regular call. | 1621 // If object is not a string, bail out to regular call. |
1620 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); | 1622 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); |
1621 | 1623 |
1622 const int argc = arguments().immediate(); | 1624 const int argc = arguments().immediate(); |
1623 | 1625 |
1624 Label miss; | 1626 Label miss; |
1625 Label name_miss; | 1627 Label name_miss; |
1626 Label index_out_of_range; | 1628 Label index_out_of_range; |
1627 Label* index_out_of_range_label = &index_out_of_range; | 1629 Label* index_out_of_range_label = &index_out_of_range; |
1628 | 1630 |
1629 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { | 1631 if (kind_ == Code::CALL_IC && |
| 1632 (CallICBase::StringStubState::decode(extra_ic_state_) == |
| 1633 DEFAULT_STRING_STUB)) { |
1630 index_out_of_range_label = &miss; | 1634 index_out_of_range_label = &miss; |
1631 } | 1635 } |
1632 | 1636 |
1633 GenerateNameCheck(name, &name_miss); | 1637 GenerateNameCheck(name, &name_miss); |
1634 | 1638 |
1635 // Check that the maps starting from the prototype haven't changed. | 1639 // Check that the maps starting from the prototype haven't changed. |
1636 GenerateDirectLoadGlobalFunctionPrototype(masm(), | 1640 GenerateDirectLoadGlobalFunctionPrototype(masm(), |
1637 Context::STRING_FUNCTION_INDEX, | 1641 Context::STRING_FUNCTION_INDEX, |
1638 rax, | 1642 rax, |
1639 &miss); | 1643 &miss); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 // If object is not a string, bail out to regular call. | 1705 // If object is not a string, bail out to regular call. |
1702 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); | 1706 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); |
1703 | 1707 |
1704 const int argc = arguments().immediate(); | 1708 const int argc = arguments().immediate(); |
1705 | 1709 |
1706 Label miss; | 1710 Label miss; |
1707 Label name_miss; | 1711 Label name_miss; |
1708 Label index_out_of_range; | 1712 Label index_out_of_range; |
1709 Label* index_out_of_range_label = &index_out_of_range; | 1713 Label* index_out_of_range_label = &index_out_of_range; |
1710 | 1714 |
1711 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { | 1715 if (kind_ == Code::CALL_IC && |
| 1716 (CallICBase::StringStubState::decode(extra_ic_state_) == |
| 1717 DEFAULT_STRING_STUB)) { |
1712 index_out_of_range_label = &miss; | 1718 index_out_of_range_label = &miss; |
1713 } | 1719 } |
1714 | 1720 |
1715 GenerateNameCheck(name, &name_miss); | 1721 GenerateNameCheck(name, &name_miss); |
1716 | 1722 |
1717 // Check that the maps starting from the prototype haven't changed. | 1723 // Check that the maps starting from the prototype haven't changed. |
1718 GenerateDirectLoadGlobalFunctionPrototype(masm(), | 1724 GenerateDirectLoadGlobalFunctionPrototype(masm(), |
1719 Context::STRING_FUNCTION_INDEX, | 1725 Context::STRING_FUNCTION_INDEX, |
1720 rax, | 1726 rax, |
1721 &miss); | 1727 &miss); |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 // Handle load cache miss. | 2210 // Handle load cache miss. |
2205 __ bind(&miss); | 2211 __ bind(&miss); |
2206 MaybeObject* maybe_result = GenerateMissBranch(); | 2212 MaybeObject* maybe_result = GenerateMissBranch(); |
2207 if (maybe_result->IsFailure()) return maybe_result; | 2213 if (maybe_result->IsFailure()) return maybe_result; |
2208 | 2214 |
2209 // Return the generated code. | 2215 // Return the generated code. |
2210 return GetCode(INTERCEPTOR, name); | 2216 return GetCode(INTERCEPTOR, name); |
2211 } | 2217 } |
2212 | 2218 |
2213 | 2219 |
2214 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, | 2220 MaybeObject* CallStubCompiler::CompileCallGlobal( |
2215 GlobalObject* holder, | 2221 JSObject* object, |
2216 JSGlobalPropertyCell* cell, | 2222 GlobalObject* holder, |
2217 JSFunction* function, | 2223 JSGlobalPropertyCell* cell, |
2218 String* name) { | 2224 JSFunction* function, |
| 2225 String* name, |
| 2226 Code::ExtraICState extra_ic_state) { |
2219 // ----------- S t a t e ------------- | 2227 // ----------- S t a t e ------------- |
2220 // rcx : function name | 2228 // rcx : function name |
2221 // rsp[0] : return address | 2229 // rsp[0] : return address |
2222 // rsp[8] : argument argc | 2230 // rsp[8] : argument argc |
2223 // rsp[16] : argument argc - 1 | 2231 // rsp[16] : argument argc - 1 |
2224 // ... | 2232 // ... |
2225 // rsp[argc * 8] : argument 1 | 2233 // rsp[argc * 8] : argument 1 |
2226 // rsp[(argc + 1) * 8] : argument 0 = receiver | 2234 // rsp[(argc + 1) * 8] : argument 0 = receiver |
2227 // ----------------------------------- | 2235 // ----------------------------------- |
2228 | 2236 |
(...skipping 24 matching lines...) Expand all Loading... |
2253 } | 2261 } |
2254 | 2262 |
2255 // Setup the context (function already in rdi). | 2263 // Setup the context (function already in rdi). |
2256 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 2264 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
2257 | 2265 |
2258 // Jump to the cached code (tail call). | 2266 // Jump to the cached code (tail call). |
2259 Counters* counters = isolate()->counters(); | 2267 Counters* counters = isolate()->counters(); |
2260 __ IncrementCounter(counters->call_global_inline(), 1); | 2268 __ IncrementCounter(counters->call_global_inline(), 1); |
2261 ASSERT(function->is_compiled()); | 2269 ASSERT(function->is_compiled()); |
2262 ParameterCount expected(function->shared()->formal_parameter_count()); | 2270 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 2271 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state) |
| 2272 ? CALL_AS_FUNCTION |
| 2273 : CALL_AS_METHOD; |
2263 if (V8::UseCrankshaft()) { | 2274 if (V8::UseCrankshaft()) { |
2264 // TODO(kasperl): For now, we always call indirectly through the | 2275 // TODO(kasperl): For now, we always call indirectly through the |
2265 // code field in the function to allow recompilation to take effect | 2276 // code field in the function to allow recompilation to take effect |
2266 // without changing any of the call sites. | 2277 // without changing any of the call sites. |
2267 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 2278 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
2268 __ InvokeCode(rdx, expected, arguments(), JUMP_FUNCTION); | 2279 __ InvokeCode(rdx, expected, arguments(), JUMP_FUNCTION, |
| 2280 NullCallWrapper(), call_kind); |
2269 } else { | 2281 } else { |
2270 Handle<Code> code(function->code()); | 2282 Handle<Code> code(function->code()); |
2271 __ InvokeCode(code, expected, arguments(), | 2283 __ InvokeCode(code, expected, arguments(), |
2272 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 2284 RelocInfo::CODE_TARGET, JUMP_FUNCTION, |
| 2285 NullCallWrapper(), call_kind); |
2273 } | 2286 } |
2274 // Handle call cache miss. | 2287 // Handle call cache miss. |
2275 __ bind(&miss); | 2288 __ bind(&miss); |
2276 __ IncrementCounter(counters->call_global_inline_miss(), 1); | 2289 __ IncrementCounter(counters->call_global_inline_miss(), 1); |
2277 MaybeObject* maybe_result = GenerateMissBranch(); | 2290 MaybeObject* maybe_result = GenerateMissBranch(); |
2278 if (maybe_result->IsFailure()) return maybe_result; | 2291 if (maybe_result->IsFailure()) return maybe_result; |
2279 | 2292 |
2280 // Return the generated code. | 2293 // Return the generated code. |
2281 return GetCode(NORMAL, name); | 2294 return GetCode(NORMAL, name); |
2282 } | 2295 } |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3588 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3601 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3589 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3602 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3590 } | 3603 } |
3591 | 3604 |
3592 | 3605 |
3593 #undef __ | 3606 #undef __ |
3594 | 3607 |
3595 } } // namespace v8::internal | 3608 } } // namespace v8::internal |
3596 | 3609 |
3597 #endif // V8_TARGET_ARCH_X64 | 3610 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |