Lines Matching defs:code
2 // Use of this source code is governed by a BSD-style license that can be
16 Handle<Code> PropertyICCompiler::Find(Handle<Name> name,
17 Handle<Map> stub_holder, Code::Kind kind,
20 Code::Flags flags =
21 Code::ComputeMonomorphicFlags(kind, extra_state, cache_holder);
23 if (probe->IsCode()) return handle(Code::cast(probe));
24 return Handle<Code>::null();
36 Handle<Code> PropertyICCompiler::CompileMonomorphic(Handle<HeapType> type,
37 Handle<Code> handler,
44 Code::StubType stub_type = handler->type();
49 Handle<Code> PropertyICCompiler::ComputeMonomorphic(
50 Code::Kind kind, Handle<Name> name, Handle<HeapType> type,
51 Handle<Code> handler, ExtraICState extra_ic_state) {
61 Handle<Code> ic;
72 if (kind == Code::KEYED_STORE_IC) {
86 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphic(
89 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC);
93 if (probe->IsCode()) return Handle<Code>::cast(probe);
96 Handle<Code> stub;
110 PropertyICCompiler compiler(isolate, Code::KEYED_LOAD_IC);
111 Handle<Code> code =
115 Map::UpdateCodeCache(receiver_map, name, code);
116 return code;
120 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic(
126 Code::Flags flags =
127 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, extra_state);
136 if (probe->IsCode()) return Handle<Code>::cast(probe);
138 PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state);
139 Handle<Code> code =
142 Map::UpdateCodeCache(receiver_map, name, code);
143 DCHECK(KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()) ==
145 return code;
149 Code* PropertyICCompiler::FindPreMonomorphic(Isolate* isolate, Code::Kind kind,
151 Code::Flags flags = Code::ComputeFlags(kind, PREMONOMORPHIC, state);
156 Object* code = dictionary->ValueAt(entry);
159 return reinterpret_cast<Code*>(code);
163 static void FillCache(Isolate* isolate, Handle<Code> code) {
165 isolate->factory()->non_monomorphic_cache(), code->flags(), code);
170 Handle<Code> PropertyICCompiler::ComputeLoad(Isolate* isolate,
173 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, ic_state, extra_state);
177 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
179 PropertyICCompiler compiler(isolate, Code::LOAD_IC);
180 Handle<Code> code;
182 code = compiler.CompileLoadInitialize(flags);
184 code = compiler.CompileLoadPreMonomorphic(flags);
188 FillCache(isolate, code);
189 return code;
193 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate,
196 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, ic_state, extra_state);
200 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
202 PropertyICCompiler compiler(isolate, Code::STORE_IC);
203 Handle<Code> code;
205 code = compiler.CompileStoreInitialize(flags);
207 code = compiler.CompileStorePreMonomorphic(flags);
209 code = compiler.CompileStoreGeneric(flags);
211 code = compiler.CompileStoreMegamorphic(flags);
216 FillCache(isolate, code);
217 return code;
221 Handle<Code> PropertyICCompiler::ComputeCompareNil(Handle<Map> receiver_map,
226 Handle<Code> cached_ic =
227 Find(name, receiver_map, Code::COMPARE_NIL_IC, stub->GetExtraICState());
231 Code::FindAndReplacePattern pattern;
233 Handle<Code> ic = stub->GetCodeCopy(pattern);
244 Handle<Code> PropertyICCompiler::ComputeKeyedLoadPolymorphic(
247 Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC);
251 if (probe->IsCode()) return Handle<Code>::cast(probe);
260 PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC);
261 Handle<Code> code = ic_compiler.CompilePolymorphic(
262 &types, &handlers, isolate->factory()->empty_string(), Code::NORMAL,
267 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
268 return code;
272 Handle<Code> PropertyICCompiler::ComputePolymorphic(
273 Code::Kind kind, TypeHandleList* types, CodeHandleList* handlers,
275 Handle<Code> handler = handlers->at(0);
276 Code::StubType type = valid_types == 1 ? handler->type() : Code::NORMAL;
277 DCHECK(kind == Code::LOAD_IC || kind == Code::STORE_IC);
283 Handle<Code> PropertyICCompiler::ComputeKeyedStorePolymorphic(
295 Code::Flags flags =
296 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state);
298 if (probe->IsCode()) return Handle<Code>::cast(probe);
300 PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state);
301 Handle<Code> code =
303 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
304 return code;
308 Handle<Code> PropertyICCompiler::CompileLoadInitialize(Code::Flags flags) {
310 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadInitialize");
311 PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_INITIALIZE_TAG, *code, 0));
312 return code;
316 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) {
318 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic");
320 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0));
321 return code;
325 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) {
327 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize");
328 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0));
329 return code;
333 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) {
335 Handle<Code> code = GetCodeWithFlags(flags, "CompileStorePreMonomorphic");
337 CodeCreateEvent(Logger::STORE_PREMONOMORPHIC_TAG, *code, 0));
338 return code;
342 Handle<Code> PropertyICCompiler::CompileStoreGeneric(Code::Flags flags) {
343 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
346 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric");
347 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0));
348 return code;
352 Handle<Code> PropertyICCompiler::CompileStoreMegamorphic(Code::Flags flags) {
354 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic");
355 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG, *code, 0));
356 return code;
360 Handle<Code> PropertyICCompiler::GetCode(Code::Kind kind, Code::StubType type,
363 Code::Flags flags =
364 Code::ComputeFlags(kind, state, extra_ic_state_, type, cache_holder());
365 Handle<Code> code = GetCodeWithFlags(flags, name);
366 IC::RegisterWeakMapDependency(code);
367 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name));
368 return code;
372 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
379 Handle<Code> cached_stub;
383 // TODO(mvstanton): The code below is doing pessimistic elements
412 Handle<Code> code = CompileKeyedStorePolymorphic(receiver_maps, &handlers,
415 code), *code, 0));
416 return code;
423 Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphic(
427 Handle<Code> stub;
441 return GetCode(kind(), Code::NORMAL, factory()->empty_string());