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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 Object* result; | 535 Object* result; |
536 { MaybeObject* maybe_result = | 536 { MaybeObject* maybe_result = |
537 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 537 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
538 if (!maybe_result->ToObject(&result)) return maybe_result; | 538 if (!maybe_result->ToObject(&result)) return maybe_result; |
539 } | 539 } |
540 } | 540 } |
541 return code; | 541 return code; |
542 } | 542 } |
543 | 543 |
544 | 544 |
| 545 MaybeObject* StubCache::ComputeKeyedStorePixelArray(JSObject* receiver) { |
| 546 // Using NORMAL as the PropertyType for array element stores is a misuse. The |
| 547 // generated stub always accesses fast elements, not slow-mode fields, but |
| 548 // some property type is required for the stub lookup. Note that overloading |
| 549 // the NORMAL PropertyType is only safe as long as no stubs are generated for |
| 550 // other keyed field stores. This is guaranteed to be the case since all field |
| 551 // keyed stores that are not array elements go through a generic builtin stub. |
| 552 Code::Flags flags = |
| 553 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL); |
| 554 String* name = Heap::KeyedStorePixelArray_symbol(); |
| 555 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 556 if (code->IsUndefined()) { |
| 557 KeyedStoreStubCompiler compiler; |
| 558 { MaybeObject* maybe_code = compiler.CompileStorePixelArray(receiver); |
| 559 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 560 } |
| 561 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); |
| 562 Object* result; |
| 563 { MaybeObject* maybe_result = |
| 564 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 565 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 566 } |
| 567 } |
| 568 return code; |
| 569 } |
| 570 |
| 571 |
545 namespace { | 572 namespace { |
546 | 573 |
547 ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) { | 574 ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) { |
548 switch (kind) { | 575 switch (kind) { |
549 case JSObject::EXTERNAL_BYTE_ELEMENTS: | 576 case JSObject::EXTERNAL_BYTE_ELEMENTS: |
550 return kExternalByteArray; | 577 return kExternalByteArray; |
551 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 578 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
552 return kExternalUnsignedByteArray; | 579 return kExternalUnsignedByteArray; |
553 case JSObject::EXTERNAL_SHORT_ELEMENTS: | 580 case JSObject::EXTERNAL_SHORT_ELEMENTS: |
554 return kExternalShortArray; | 581 return kExternalShortArray; |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 if (!maybe_result->ToObject(&result)) return maybe_result; | 1855 if (!maybe_result->ToObject(&result)) return maybe_result; |
1829 } | 1856 } |
1830 Code* code = Code::cast(result); | 1857 Code* code = Code::cast(result); |
1831 USE(code); | 1858 USE(code); |
1832 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); | 1859 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); |
1833 return result; | 1860 return result; |
1834 } | 1861 } |
1835 | 1862 |
1836 | 1863 |
1837 } } // namespace v8::internal | 1864 } } // namespace v8::internal |
OLD | NEW |