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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 UNREACHABLE(); | 591 UNREACHABLE(); |
592 return static_cast<ExternalArrayType>(0); | 592 return static_cast<ExternalArrayType>(0); |
593 } | 593 } |
594 } | 594 } |
595 | 595 |
596 } // anonymous namespace | 596 } // anonymous namespace |
597 | 597 |
598 | 598 |
599 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( | 599 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( |
600 JSObject* receiver, | 600 JSObject* receiver, |
601 bool is_store) { | 601 bool is_store, |
602 Code::ExtraICState extra_ic_state) { | |
603 ASSERT(extra_ic_state == kNonStrictMode || extra_ic_state == kStrictMode); | |
602 Code::Flags flags = | 604 Code::Flags flags = |
603 Code::ComputeMonomorphicFlags( | 605 Code::ComputeMonomorphicFlags( |
604 is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC, | 606 is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC, |
605 NORMAL); | 607 NORMAL, |
608 extra_ic_state); | |
606 ExternalArrayType array_type = | 609 ExternalArrayType array_type = |
607 ElementsKindToExternalArrayType(receiver->GetElementsKind()); | 610 ElementsKindToExternalArrayType(receiver->GetElementsKind()); |
608 String* name = | 611 String* name = |
609 is_store ? Heap::KeyedStoreExternalArray_symbol() | 612 is_store ? Heap::KeyedStoreExternalArray_symbol() |
610 : Heap::KeyedLoadExternalArray_symbol(); | 613 : Heap::KeyedLoadExternalArray_symbol(); |
611 // Use the global maps for the particular external array types, | 614 // Use the global maps for the particular external array types, |
612 // rather than the receiver's map, when looking up the cached code, | 615 // rather than the receiver's map, when looking up the cached code, |
613 // so that we actually canonicalize these stubs. | 616 // so that we actually canonicalize these stubs. |
614 Map* map = Heap::MapForExternalArrayType(array_type); | 617 Map* map = Heap::MapForExternalArrayType(array_type); |
615 Object* code = map->FindInCodeCache(name, flags); | 618 Object* code = map->FindInCodeCache(name, flags); |
616 if (code->IsUndefined()) { | 619 if (code->IsUndefined()) { |
617 ExternalArrayStubCompiler compiler; | 620 ExternalArrayStubCompiler compiler; |
618 { MaybeObject* maybe_code = | 621 { MaybeObject* maybe_code = is_store |
619 is_store ? compiler.CompileKeyedStoreStub(array_type, flags) : | 622 ? compiler.CompileKeyedStoreStub(array_type, flags) |
620 compiler.CompileKeyedLoadStub(array_type, flags); | 623 : compiler.CompileKeyedLoadStub(array_type, flags); |
621 if (!maybe_code->ToObject(&code)) return maybe_code; | 624 if (!maybe_code->ToObject(&code)) return maybe_code; |
622 } | 625 } |
623 if (is_store) { | 626 if (is_store) { |
624 PROFILE( | 627 PROFILE( |
625 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); | 628 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); |
626 } else { | 629 } else { |
627 PROFILE( | 630 PROFILE( |
628 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0)); | 631 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0)); |
629 } | 632 } |
630 Object* result; | 633 Object* result; |
631 { MaybeObject* maybe_result = | 634 { MaybeObject* maybe_result = |
632 map->UpdateCodeCache(name, Code::cast(code)); | 635 map->UpdateCodeCache(name, Code::cast(code)); |
633 if (!maybe_result->ToObject(&result)) return maybe_result; | 636 if (!maybe_result->ToObject(&result)) return maybe_result; |
634 } | 637 } |
635 } | 638 } |
636 return code; | 639 return code; |
637 } | 640 } |
638 | 641 |
639 | 642 |
640 MaybeObject* StubCache::ComputeStoreNormal(Code::ExtraICState extra_ic_state) { | 643 MaybeObject* StubCache::ComputeStoreNormal(Code::ExtraICState extra_ic_state) { |
641 return Builtins::builtin(extra_ic_state == StoreIC::kStoreICStrict | 644 return Builtins::builtin(extra_ic_state == kStrictMode |
642 ? Builtins::StoreIC_Normal_Strict | 645 ? Builtins::StoreIC_Normal_Strict |
643 : Builtins::StoreIC_Normal); | 646 : Builtins::StoreIC_Normal); |
644 } | 647 } |
645 | 648 |
646 | 649 |
647 MaybeObject* StubCache::ComputeStoreGlobal(String* name, | 650 MaybeObject* StubCache::ComputeStoreGlobal(String* name, |
648 GlobalObject* receiver, | 651 GlobalObject* receiver, |
649 JSGlobalPropertyCell* cell, | 652 JSGlobalPropertyCell* cell, |
650 Code::ExtraICState extra_ic_state) { | 653 Code::ExtraICState extra_ic_state) { |
651 Code::Flags flags = Code::ComputeMonomorphicFlags( | 654 Code::Flags flags = Code::ComputeMonomorphicFlags( |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1415 return result; | 1418 return result; |
1416 } | 1419 } |
1417 | 1420 |
1418 | 1421 |
1419 MaybeObject* StoreInterceptorProperty(Arguments args) { | 1422 MaybeObject* StoreInterceptorProperty(Arguments args) { |
1420 JSObject* recv = JSObject::cast(args[0]); | 1423 JSObject* recv = JSObject::cast(args[0]); |
1421 String* name = String::cast(args[1]); | 1424 String* name = String::cast(args[1]); |
1422 Object* value = args[2]; | 1425 Object* value = args[2]; |
1423 ASSERT(recv->HasNamedInterceptor()); | 1426 ASSERT(recv->HasNamedInterceptor()); |
1424 PropertyAttributes attr = NONE; | 1427 PropertyAttributes attr = NONE; |
1425 MaybeObject* result = recv->SetPropertyWithInterceptor(name, value, attr); | 1428 MaybeObject* result = recv->SetPropertyWithInterceptor( |
Martin Maly
2011/02/24 06:33:34
This needs to be figured out whether we need to pa
Lasse Reichstein
2011/02/24 12:37:54
I'm guessing "yes" too.
| |
1429 name, value, attr, kNonStrictMode); // TODL(mmaly): Is this OK? | |
1426 return result; | 1430 return result; |
1427 } | 1431 } |
1428 | 1432 |
1429 | 1433 |
1430 MaybeObject* KeyedLoadPropertyWithInterceptor(Arguments args) { | 1434 MaybeObject* KeyedLoadPropertyWithInterceptor(Arguments args) { |
1431 JSObject* receiver = JSObject::cast(args[0]); | 1435 JSObject* receiver = JSObject::cast(args[0]); |
1432 ASSERT(Smi::cast(args[1])->value() >= 0); | 1436 ASSERT(Smi::cast(args[1])->value() >= 0); |
1433 uint32_t index = Smi::cast(args[1])->value(); | 1437 uint32_t index = Smi::cast(args[1])->value(); |
1434 return receiver->GetElementWithInterceptor(receiver, index); | 1438 return receiver->GetElementWithInterceptor(receiver, index); |
1435 } | 1439 } |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1855 if (!maybe_result->ToObject(&result)) return maybe_result; | 1859 if (!maybe_result->ToObject(&result)) return maybe_result; |
1856 } | 1860 } |
1857 Code* code = Code::cast(result); | 1861 Code* code = Code::cast(result); |
1858 USE(code); | 1862 USE(code); |
1859 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); | 1863 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); |
1860 return result; | 1864 return result; |
1861 } | 1865 } |
1862 | 1866 |
1863 | 1867 |
1864 } } // namespace v8::internal | 1868 } } // namespace v8::internal |
OLD | NEW |