OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 if (!stub.is_null()) return stub; | 308 if (!stub.is_null()) return stub; |
309 | 309 |
310 LoadStubCompiler compiler(isolate_); | 310 LoadStubCompiler compiler(isolate_); |
311 Handle<Code> handler = | 311 Handle<Code> handler = |
312 compiler.CompileLoadCallback(receiver, holder, name, callback); | 312 compiler.CompileLoadCallback(receiver, holder, name, callback); |
313 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 313 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
314 return handler; | 314 return handler; |
315 } | 315 } |
316 | 316 |
317 | 317 |
| 318 Handle<Code> StubCache::ComputeLoadCallback( |
| 319 Handle<Name> name, |
| 320 Handle<JSObject> receiver, |
| 321 Handle<JSObject> holder, |
| 322 const CallOptimization& call_optimization) { |
| 323 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
| 324 Handle<Code> stub = FindLoadHandler( |
| 325 name, receiver, stub_holder, Code::LOAD_IC, Code::CALLBACKS); |
| 326 if (!stub.is_null()) return stub; |
| 327 |
| 328 LoadStubCompiler compiler(isolate_); |
| 329 Handle<Code> handler = |
| 330 compiler.CompileLoadCallback(receiver, holder, name, call_optimization); |
| 331 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
| 332 return handler; |
| 333 } |
| 334 |
| 335 |
318 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<Name> name, | 336 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<Name> name, |
319 Handle<JSObject> receiver, | 337 Handle<JSObject> receiver, |
320 Handle<JSObject> holder, | 338 Handle<JSObject> holder, |
321 Handle<JSFunction> getter) { | 339 Handle<JSFunction> getter) { |
322 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 340 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
323 Handle<Code> stub = FindLoadHandler( | 341 Handle<Code> stub = FindLoadHandler( |
324 name, receiver, stub_holder, Code::LOAD_IC, Code::CALLBACKS); | 342 name, receiver, stub_holder, Code::LOAD_IC, Code::CALLBACKS); |
325 if (!stub.is_null()) return stub; | 343 if (!stub.is_null()) return stub; |
326 | 344 |
327 LoadStubCompiler compiler(isolate_); | 345 LoadStubCompiler compiler(isolate_); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 if (!stub.is_null()) return stub; | 476 if (!stub.is_null()) return stub; |
459 | 477 |
460 KeyedLoadStubCompiler compiler(isolate_); | 478 KeyedLoadStubCompiler compiler(isolate_); |
461 Handle<Code> handler = | 479 Handle<Code> handler = |
462 compiler.CompileLoadCallback(receiver, holder, name, callback); | 480 compiler.CompileLoadCallback(receiver, holder, name, callback); |
463 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 481 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
464 return handler; | 482 return handler; |
465 } | 483 } |
466 | 484 |
467 | 485 |
| 486 Handle<Code> StubCache::ComputeKeyedLoadCallback( |
| 487 Handle<Name> name, |
| 488 Handle<JSObject> receiver, |
| 489 Handle<JSObject> holder, |
| 490 const CallOptimization& call_optimization) { |
| 491 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
| 492 Handle<Code> stub = FindLoadHandler( |
| 493 name, receiver, stub_holder, Code::KEYED_LOAD_IC, Code::CALLBACKS); |
| 494 if (!stub.is_null()) return stub; |
| 495 |
| 496 KeyedLoadStubCompiler compiler(isolate_); |
| 497 Handle<Code> handler = |
| 498 compiler.CompileLoadCallback(receiver, holder, name, call_optimization); |
| 499 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
| 500 return handler; |
| 501 } |
| 502 |
| 503 |
468 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name, | 504 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name, |
469 Handle<JSObject> receiver, | 505 Handle<JSObject> receiver, |
470 LookupResult* lookup, | 506 LookupResult* lookup, |
471 StrictModeFlag strict_mode) { | 507 StrictModeFlag strict_mode) { |
472 Handle<Code> stub = FindStoreHandler( | 508 Handle<Code> stub = FindStoreHandler( |
473 name, receiver, Code::STORE_IC, Code::FIELD, strict_mode); | 509 name, receiver, Code::STORE_IC, Code::FIELD, strict_mode); |
474 if (!stub.is_null()) return stub; | 510 if (!stub.is_null()) return stub; |
475 | 511 |
476 StoreStubCompiler compiler(isolate_, strict_mode); | 512 StoreStubCompiler compiler(isolate_, strict_mode); |
477 Handle<Code> handler = compiler.CompileStoreField(receiver, lookup, name); | 513 Handle<Code> handler = compiler.CompileStoreField(receiver, lookup, name); |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 Register reg = CallbackHandlerFrontend( | 1677 Register reg = CallbackHandlerFrontend( |
1642 object, receiver(), holder, name, &success, callback); | 1678 object, receiver(), holder, name, &success, callback); |
1643 __ bind(&success); | 1679 __ bind(&success); |
1644 GenerateLoadCallback(reg, callback); | 1680 GenerateLoadCallback(reg, callback); |
1645 | 1681 |
1646 // Return the generated code. | 1682 // Return the generated code. |
1647 return GetCode(kind(), Code::CALLBACKS, name); | 1683 return GetCode(kind(), Code::CALLBACKS, name); |
1648 } | 1684 } |
1649 | 1685 |
1650 | 1686 |
| 1687 Handle<Code> BaseLoadStubCompiler::CompileLoadCallback( |
| 1688 Handle<JSObject> object, |
| 1689 Handle<JSObject> holder, |
| 1690 Handle<Name> name, |
| 1691 const CallOptimization& call_optimization) { |
| 1692 ASSERT(call_optimization.is_simple_api_call()); |
| 1693 Label success; |
| 1694 |
| 1695 Handle<JSFunction> callback = call_optimization.constant_function(); |
| 1696 CallbackHandlerFrontend( |
| 1697 object, receiver(), holder, name, &success, callback); |
| 1698 __ bind(&success); |
| 1699 GenerateLoadCallback(call_optimization); |
| 1700 |
| 1701 // Return the generated code. |
| 1702 return GetCode(kind(), Code::CALLBACKS, name); |
| 1703 } |
| 1704 |
| 1705 |
1651 Handle<Code> BaseLoadStubCompiler::CompileLoadInterceptor( | 1706 Handle<Code> BaseLoadStubCompiler::CompileLoadInterceptor( |
1652 Handle<JSObject> object, | 1707 Handle<JSObject> object, |
1653 Handle<JSObject> holder, | 1708 Handle<JSObject> holder, |
1654 Handle<Name> name) { | 1709 Handle<Name> name) { |
1655 Label success; | 1710 Label success; |
1656 | 1711 |
1657 LookupResult lookup(isolate()); | 1712 LookupResult lookup(isolate()); |
1658 LookupPostInterceptor(holder, name, &lookup); | 1713 LookupPostInterceptor(holder, name, &lookup); |
1659 | 1714 |
1660 Register reg = HandlerFrontend(object, receiver(), holder, name, &success); | 1715 Register reg = HandlerFrontend(object, receiver(), holder, name, &success); |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2190 Handle<FunctionTemplateInfo>( | 2245 Handle<FunctionTemplateInfo>( |
2191 FunctionTemplateInfo::cast(signature->receiver())); | 2246 FunctionTemplateInfo::cast(signature->receiver())); |
2192 } | 2247 } |
2193 } | 2248 } |
2194 | 2249 |
2195 is_simple_api_call_ = true; | 2250 is_simple_api_call_ = true; |
2196 } | 2251 } |
2197 | 2252 |
2198 | 2253 |
2199 } } // namespace v8::internal | 2254 } } // namespace v8::internal |
OLD | NEW |