Lines Matching defs:code
6 // * Redistributions of source code must retain the above copyright
1063 accumulator->Add("<Code>");
1161 reinterpret_cast<Code*>(this)->CodeIterateBody(v);
2196 // present, add it with attributes NONE. This code is an exact clone of
2488 MaybeObject* JSObject::UpdateMapCodeCache(String* name, Code* code) {
2502 return map()->UpdateCodeCache(name, code);
3359 // caches which have a global property cell reference directly in the code.
3669 MaybeObject* Map::UpdateCodeCache(String* name, Code* code) {
3670 // Allocate the code cache if not present.
3673 { MaybeObject* maybe_result = code->heap()->AllocateCodeCache();
3679 // Update the code cache.
3680 return CodeCache::cast(code_cache())->Update(name, code);
3684 Object* Map::FindInCodeCache(String* name, Code::Flags flags) {
3685 // Do a lookup if a code cache exists.
3694 int Map::IndexInCodeCache(Object* name, Code* code) {
3695 // Get the internal index if a code cache exists.
3697 return CodeCache::cast(code_cache())->GetIndex(name, code);
3703 void Map::RemoveFromCodeCache(String* name, Code* code, int index) {
3705 // RemoveFromCodeCache so the code cache must be there.
3707 CodeCache::cast(code_cache())->RemoveByIndex(name, code, index);
3784 MaybeObject* CodeCache::Update(String* name, Code* code) {
3785 ASSERT(code->ic_state() == MONOMORPHIC);
3790 if (code->type() == NORMAL) {
3791 // Make sure that a hash table is allocated for the normal load code cache.
3800 return UpdateNormalTypeCache(name, code);
3803 return UpdateDefaultCache(name, code);
3808 MaybeObject* CodeCache::UpdateDefaultCache(String* name, Code* code) {
3809 // When updating the default code cache we disregard the type encoded in the
3812 Code::Flags flags = Code::RemoveTypeFromFlags(code->flags());
3814 // First check whether we can update existing code cache without
3828 cache->set(i + kCodeCacheEntryCodeOffset, code);
3832 Code::Flags found =
3833 Code::cast(cache->get(i + kCodeCacheEntryCodeOffset))->flags();
3834 if (Code::RemoveTypeFromFlags(found) == flags) {
3835 cache->set(i + kCodeCacheEntryCodeOffset, code);
3841 // Reached the end of the code cache. If there were deleted
3845 cache->set(deleted_index + kCodeCacheEntryCodeOffset, code);
3849 // Extend the code cache with some new entries (at least one). Must be a
3859 // Add the (name, code) pair to the new cache.
3862 cache->set(length + kCodeCacheEntryCodeOffset, code);
3868 MaybeObject* CodeCache::UpdateNormalTypeCache(String* name, Code* code) {
3872 { MaybeObject* maybe_new_cache = cache->Put(name, code);
3880 Object* CodeCache::Lookup(String* name, Code::Flags flags) {
3881 if (Code::ExtractTypeFromFlags(flags) == NORMAL) {
3889 Object* CodeCache::LookupDefaultCache(String* name, Code::Flags flags) {
3898 Code* code = Code::cast(cache->get(i + kCodeCacheEntryCodeOffset));
3899 if (code->flags() == flags) {
3900 return code;
3908 Object* CodeCache::LookupNormalTypeCache(String* name, Code::Flags flags) {
3918 int CodeCache::GetIndex(Object* name, Code* code) {
3919 if (code->type() == NORMAL) {
3922 return cache->GetIndex(String::cast(name), code->flags());
3928 if (array->get(i + kCodeCacheEntryCodeOffset) == code) return i + 1;
3934 void CodeCache::RemoveByIndex(Object* name, Code* code, int index) {
3935 if (code->type() == NORMAL) {
3938 ASSERT(cache->GetIndex(String::cast(name), code->flags()) == index);
3948 array->set_null(index); // Code.
3953 // The key in the code cache hash table consists of the property name and the
3954 // code object. The actual match is on the name and the code flags. If a key
3955 // is created using the flags and not a code object it can only be used for
3959 CodeCacheHashTableKey(String* name, Code::Flags flags)
3962 CodeCacheHashTableKey(String* name, Code* code)
3964 flags_(code->flags()),
3965 code_(code) { }
3972 Code::Flags flags = Code::cast(pair->get(1))->flags();
3979 static uint32_t NameFlagsHashHelper(String* name, Code::Flags flags) {
3988 Code* code = Code::cast(pair->get(1));
3989 return NameFlagsHashHelper(name, code->flags());
4006 Code::Flags flags_;
4007 Code* code_;
4011 Object* CodeCacheHashTable::Lookup(String* name, Code::Flags flags) {
4019 MaybeObject* CodeCacheHashTable::Put(String* name, Code* code) {
4020 CodeCacheHashTableKey key(name, code);
4036 cache->set(EntryToIndex(entry) + 1, code);
4042 int CodeCacheHashTable::GetIndex(String* name, Code::Flags flags) {
4455 // Found an element with the same hash-code.
5383 // Fast check: if hash code is computed for both strings
5502 // Should only be called if hash code has not yet been computed.
5507 // Compute the hash code.
5518 // Store the hash code in the object.
5521 // Check the hash code is there.
5561 Hash(); // force computation of hash code
5714 // the code entry.
5724 code()->optimizable());
5749 Code* codecode();
5750 if (code->kind() == Code::OPTIMIZED_FUNCTION) return true;
5752 if (code->kind() != Code::FUNCTION) return true;
5753 return code->optimizable();
5903 // Check the basic conditions for generating inline constructor code.
6001 // Support function for printing the source code to a StringStream
6042 static bool IsCodeEquivalent(Code* code, Code* recompiled) {
6043 if (code->instruction_size() != recompiled->instruction_size()) return false;
6044 ByteArray* code_relocation = code->relocation_info();
6055 void SharedFunctionInfo::EnableDeoptimizationSupport(Code* recompiled) {
6058 Code* code = this->code();
6059 if (IsCodeEquivalent(code, recompiled)) {
6060 // Copy the deoptimization data from the recompiled code.
6061 code->set_deoptimization_data(recompiled->deoptimization_data());
6062 code->set_has_deoptimization_support(true);
6065 // old code, we have to replace it. We should try to avoid this
6079 Code* unoptimized = code();
6196 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
6199 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target.
6204 Object* code = Code::GetObjectFromEntryAddress(entry_address);
6205 Object* old_code = code;
6206 VisitPointer(&code);
6207 if (code != old_code) {
6208 Memory::Address_at(entry_address) = reinterpret_cast<Code*>(code)->entry();
6229 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address());
6232 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target.
6236 void Code::InvalidateRelocation() {
6241 void Code::Relocate(intptr_t delta) {
6249 void Code::CopyFrom(const CodeDesc& desc) {
6250 // copy code
6274 // rewrite code handles in inline cache targets to direct
6275 // pointers to the first instruction in the code object
6277 Code* code = Code::cast(*p);
6278 it.rinfo()->set_target_address(code->instruction_start());
6287 // Locate the source position which is closest to the address in the code. This
6291 int Code::SourcePosition(Address pc) {
6295 // position. All the code needs to be considered as the sequence of the
6296 // instructions in the code does not necessarily follow the same order as the
6321 // Same as Code::SourcePosition above except it only looks for statement
6323 int Code::SourceStatementPosition(Address pc) {
6343 SafepointEntry Code::GetSafepointEntry(Address pc) {
6349 void Code::SetNoStackCheckTable() {
6356 Map* Code::FindFirstMap() {
6522 // Identify kind of code.
6523 const char* Code::Kind2String(Kind kind) {
6545 const char* Code::ICState2String(InlineCacheState state) {
6560 const char* Code::PropertyType2String(PropertyType type) {
6577 void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) {
6602 void Code::Disassemble(const char* name, FILE* out) {
8507 // code computation, we use a combination of the hash of the
8508 // script source code and the start and end positions. We do
8624 int chars_; // Caches the number of characters when computing the hash code.
8799 // perform further lookups in code stubs (and significant performance boost
8800 // a certain style of code).
10159 // Check if there is a break point at this code position.
10161 // Get the break point info object for this code position.
10165 // point info object there is no break point at this code position.
10171 // Get the break point info object for this code position.
10173 // Find the index of the break point info object for this code position.
10182 // Clear a break point at the specified code position.
10208 // Adding a new break point for a code position which did not have any
10248 // Get the break point objects for a code position.
10292 // Find the index of the break point info object for the specified code