| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 490       if (!maybe_result->ToObject(&result)) return maybe_result; | 490       if (!maybe_result->ToObject(&result)) return maybe_result; | 
| 491     } | 491     } | 
| 492   } | 492   } | 
| 493   return code; | 493   return code; | 
| 494 } | 494 } | 
| 495 | 495 | 
| 496 | 496 | 
| 497 MaybeObject* StubCache::ComputeStoreField(String* name, | 497 MaybeObject* StubCache::ComputeStoreField(String* name, | 
| 498                                           JSObject* receiver, | 498                                           JSObject* receiver, | 
| 499                                           int field_index, | 499                                           int field_index, | 
| 500                                           Map* transition) { | 500                                           Map* transition, | 
|  | 501                                           Code::ExtraICState extra_ic_state) { | 
| 501   PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 502   PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 
| 502   Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); | 503   Code::Flags flags = Code::ComputeMonomorphicFlags( | 
|  | 504       Code::STORE_IC, type, extra_ic_state); | 
| 503   Object* code = receiver->map()->FindInCodeCache(name, flags); | 505   Object* code = receiver->map()->FindInCodeCache(name, flags); | 
| 504   if (code->IsUndefined()) { | 506   if (code->IsUndefined()) { | 
| 505     StoreStubCompiler compiler; | 507     StoreStubCompiler compiler(extra_ic_state); | 
| 506     { MaybeObject* maybe_code = | 508     { MaybeObject* maybe_code = | 
| 507           compiler.CompileStoreField(receiver, field_index, transition, name); | 509           compiler.CompileStoreField(receiver, field_index, transition, name); | 
| 508       if (!maybe_code->ToObject(&code)) return maybe_code; | 510       if (!maybe_code->ToObject(&code)) return maybe_code; | 
| 509     } | 511     } | 
| 510     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 512     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 
| 511     GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 513     GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 
| 512     Object* result; | 514     Object* result; | 
| 513     { MaybeObject* maybe_result = | 515     { MaybeObject* maybe_result = | 
| 514           receiver->UpdateMapCodeCache(name, Code::cast(code)); | 516           receiver->UpdateMapCodeCache(name, Code::cast(code)); | 
| 515       if (!maybe_result->ToObject(&result)) return maybe_result; | 517       if (!maybe_result->ToObject(&result)) return maybe_result; | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 601     Object* result; | 603     Object* result; | 
| 602     { MaybeObject* maybe_result = | 604     { MaybeObject* maybe_result = | 
| 603           map->UpdateCodeCache(name, Code::cast(code)); | 605           map->UpdateCodeCache(name, Code::cast(code)); | 
| 604       if (!maybe_result->ToObject(&result)) return maybe_result; | 606       if (!maybe_result->ToObject(&result)) return maybe_result; | 
| 605     } | 607     } | 
| 606   } | 608   } | 
| 607   return code; | 609   return code; | 
| 608 } | 610 } | 
| 609 | 611 | 
| 610 | 612 | 
| 611 MaybeObject* StubCache::ComputeStoreNormal() { | 613 MaybeObject* StubCache::ComputeStoreNormal(Code::ExtraICState extra_ic_state) { | 
| 612   return Builtins::builtin(Builtins::StoreIC_Normal); | 614   return Builtins::builtin(extra_ic_state == StoreIC::kStoreICStrict | 
|  | 615                             ? Builtins::StoreIC_Normal_Strict | 
|  | 616                             : Builtins::StoreIC_Normal); | 
| 613 } | 617 } | 
| 614 | 618 | 
| 615 | 619 | 
| 616 MaybeObject* StubCache::ComputeStoreGlobal(String* name, | 620 MaybeObject* StubCache::ComputeStoreGlobal(String* name, | 
| 617                                            GlobalObject* receiver, | 621                                            GlobalObject* receiver, | 
| 618                                            JSGlobalPropertyCell* cell) { | 622                                            JSGlobalPropertyCell* cell, | 
| 619   Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 623                                            Code::ExtraICState extra_ic_state) { | 
|  | 624   Code::Flags flags = Code::ComputeMonomorphicFlags( | 
|  | 625       Code::STORE_IC, NORMAL, extra_ic_state); | 
| 620   Object* code = receiver->map()->FindInCodeCache(name, flags); | 626   Object* code = receiver->map()->FindInCodeCache(name, flags); | 
| 621   if (code->IsUndefined()) { | 627   if (code->IsUndefined()) { | 
| 622     StoreStubCompiler compiler; | 628     StoreStubCompiler compiler(extra_ic_state); | 
| 623     { MaybeObject* maybe_code = | 629     { MaybeObject* maybe_code = | 
| 624           compiler.CompileStoreGlobal(receiver, cell, name); | 630           compiler.CompileStoreGlobal(receiver, cell, name); | 
| 625       if (!maybe_code->ToObject(&code)) return maybe_code; | 631       if (!maybe_code->ToObject(&code)) return maybe_code; | 
| 626     } | 632     } | 
| 627     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 633     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 
| 628     GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 634     GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 
| 629     Object* result; | 635     Object* result; | 
| 630     { MaybeObject* maybe_result = | 636     { MaybeObject* maybe_result = | 
| 631           receiver->UpdateMapCodeCache(name, Code::cast(code)); | 637           receiver->UpdateMapCodeCache(name, Code::cast(code)); | 
| 632       if (!maybe_result->ToObject(&result)) return maybe_result; | 638       if (!maybe_result->ToObject(&result)) return maybe_result; | 
| 633     } | 639     } | 
| 634   } | 640   } | 
| 635   return code; | 641   return code; | 
| 636 } | 642 } | 
| 637 | 643 | 
| 638 | 644 | 
| 639 MaybeObject* StubCache::ComputeStoreCallback(String* name, | 645 MaybeObject* StubCache::ComputeStoreCallback( | 
| 640                                              JSObject* receiver, | 646     String* name, | 
| 641                                              AccessorInfo* callback) { | 647     JSObject* receiver, | 
|  | 648     AccessorInfo* callback, | 
|  | 649     Code::ExtraICState extra_ic_state) { | 
| 642   ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 650   ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 
| 643   Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, CALLBACKS); | 651   Code::Flags flags = Code::ComputeMonomorphicFlags( | 
|  | 652       Code::STORE_IC, CALLBACKS, extra_ic_state); | 
| 644   Object* code = receiver->map()->FindInCodeCache(name, flags); | 653   Object* code = receiver->map()->FindInCodeCache(name, flags); | 
| 645   if (code->IsUndefined()) { | 654   if (code->IsUndefined()) { | 
| 646     StoreStubCompiler compiler; | 655     StoreStubCompiler compiler(extra_ic_state); | 
| 647     { MaybeObject* maybe_code = | 656     { MaybeObject* maybe_code = | 
| 648           compiler.CompileStoreCallback(receiver, callback, name); | 657           compiler.CompileStoreCallback(receiver, callback, name); | 
| 649       if (!maybe_code->ToObject(&code)) return maybe_code; | 658       if (!maybe_code->ToObject(&code)) return maybe_code; | 
| 650     } | 659     } | 
| 651     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 660     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 
| 652     GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 661     GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 
| 653     Object* result; | 662     Object* result; | 
| 654     { MaybeObject* maybe_result = | 663     { MaybeObject* maybe_result = | 
| 655           receiver->UpdateMapCodeCache(name, Code::cast(code)); | 664           receiver->UpdateMapCodeCache(name, Code::cast(code)); | 
| 656       if (!maybe_result->ToObject(&result)) return maybe_result; | 665       if (!maybe_result->ToObject(&result)) return maybe_result; | 
| 657     } | 666     } | 
| 658   } | 667   } | 
| 659   return code; | 668   return code; | 
| 660 } | 669 } | 
| 661 | 670 | 
| 662 | 671 | 
| 663 MaybeObject* StubCache::ComputeStoreInterceptor(String* name, | 672 MaybeObject* StubCache::ComputeStoreInterceptor( | 
| 664                                                 JSObject* receiver) { | 673     String* name, | 
| 665   Code::Flags flags = | 674     JSObject* receiver, | 
| 666       Code::ComputeMonomorphicFlags(Code::STORE_IC, INTERCEPTOR); | 675     Code::ExtraICState extra_ic_state) { | 
|  | 676   Code::Flags flags = Code::ComputeMonomorphicFlags( | 
|  | 677       Code::STORE_IC, INTERCEPTOR, extra_ic_state); | 
| 667   Object* code = receiver->map()->FindInCodeCache(name, flags); | 678   Object* code = receiver->map()->FindInCodeCache(name, flags); | 
| 668   if (code->IsUndefined()) { | 679   if (code->IsUndefined()) { | 
| 669     StoreStubCompiler compiler; | 680     StoreStubCompiler compiler(extra_ic_state); | 
| 670     { MaybeObject* maybe_code = | 681     { MaybeObject* maybe_code = | 
| 671           compiler.CompileStoreInterceptor(receiver, name); | 682           compiler.CompileStoreInterceptor(receiver, name); | 
| 672       if (!maybe_code->ToObject(&code)) return maybe_code; | 683       if (!maybe_code->ToObject(&code)) return maybe_code; | 
| 673     } | 684     } | 
| 674     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 685     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 
| 675     GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 686     GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 
| 676     Object* result; | 687     Object* result; | 
| 677     { MaybeObject* maybe_result = | 688     { MaybeObject* maybe_result = | 
| 678           receiver->UpdateMapCodeCache(name, Code::cast(code)); | 689           receiver->UpdateMapCodeCache(name, Code::cast(code)); | 
| 679       if (!maybe_result->ToObject(&result)) return maybe_result; | 690       if (!maybe_result->ToObject(&result)) return maybe_result; | 
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1630                             name)); | 1641                             name)); | 
| 1631     GDBJIT(AddCode(GDBJITInterface::LOAD_IC, | 1642     GDBJIT(AddCode(GDBJITInterface::LOAD_IC, | 
| 1632                    name, | 1643                    name, | 
| 1633                    Code::cast(result->ToObjectUnchecked()))); | 1644                    Code::cast(result->ToObjectUnchecked()))); | 
| 1634   } | 1645   } | 
| 1635   return result; | 1646   return result; | 
| 1636 } | 1647 } | 
| 1637 | 1648 | 
| 1638 | 1649 | 
| 1639 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { | 1650 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { | 
| 1640   Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); | 1651   Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type, | 
|  | 1652                                                     extra_ic_state_); | 
| 1641   MaybeObject* result = GetCodeWithFlags(flags, name); | 1653   MaybeObject* result = GetCodeWithFlags(flags, name); | 
| 1642   if (!result->IsFailure()) { | 1654   if (!result->IsFailure()) { | 
| 1643     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, | 1655     PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, | 
| 1644                             Code::cast(result->ToObjectUnchecked()), | 1656                             Code::cast(result->ToObjectUnchecked()), | 
| 1645                             name)); | 1657                             name)); | 
| 1646     GDBJIT(AddCode(GDBJITInterface::STORE_IC, | 1658     GDBJIT(AddCode(GDBJITInterface::STORE_IC, | 
| 1647                    name, | 1659                    name, | 
| 1648                    Code::cast(result->ToObjectUnchecked()))); | 1660                    Code::cast(result->ToObjectUnchecked()))); | 
| 1649   } | 1661   } | 
| 1650   return result; | 1662   return result; | 
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1816     if (!maybe_result->ToObject(&result)) return maybe_result; | 1828     if (!maybe_result->ToObject(&result)) return maybe_result; | 
| 1817   } | 1829   } | 
| 1818   Code* code = Code::cast(result); | 1830   Code* code = Code::cast(result); | 
| 1819   USE(code); | 1831   USE(code); | 
| 1820   PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); | 1832   PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); | 
| 1821   return result; | 1833   return result; | 
| 1822 } | 1834 } | 
| 1823 | 1835 | 
| 1824 | 1836 | 
| 1825 } }  // namespace v8::internal | 1837 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|