Lines Matching defs:code
2 // Use of this source code is governed by a BSD-style license that can be
43 // computed from the original code - not the patched code. Let
44 // these cases fall through to the unreachable code below.
92 Code* new_target = raw_target();
102 Code* new_target = raw_target();
108 // the frame's code == builtin(Builtins::kFunctionApply):
115 JavaScriptFrame::PrintFunctionAndOffset(function, function->code(), pc(),
121 if (new_target->kind() == Code::KEYED_STORE_IC) {
143 // To improve the performance of the (much used) IC code, we unfold a few
144 // levels of the stack frame iteration code. This yields a ~35% speedup when
194 // Find the function on the stack and both the active code for the
195 // function and the original code.
201 Code* IC::GetCode() const {
204 Code* code = shared->code();
205 return code;
209 Code* IC::GetOriginalCode() const {
213 Code* original_code = Debug::GetDebugInfo(shared)->original_code();
321 // Remove the target from the code cache if it became invalid
395 Code* host =
396 isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code;
397 if (host->kind() != Code::FUNCTION) return;
400 // Not all Code objects have TypeFeedbackInfo.
422 void IC::PostPatching(Address address, Code* target, Code* old_target) {
425 if (target->kind() == Code::CALL_IC) return;
442 void IC::RegisterWeakMapDependency(Handle<Code> stub) {
460 void IC::InvalidateMaps(Code* stub) {
480 Code* target = GetTargetAtAddress(address, constant_pool);
486 case Code::LOAD_IC:
488 case Code::KEYED_LOAD_IC:
490 case Code::STORE_IC:
492 case Code::KEYED_STORE_IC:
494 case Code::CALL_IC:
496 case Code::COMPARE_IC:
498 case Code::COMPARE_NIL_IC:
500 case Code::BINARY_OP_IC:
501 case Code::TO_BOOLEAN_IC:
511 void KeyedLoadIC::Clear(Isolate* isolate, Address address, Code* target,
515 // do not clear these maps, cached code can keep objects alive
521 void CallIC::Clear(Isolate* isolate, Address address, Code* target,
527 void LoadIC::Clear(Isolate* isolate, Address address, Code* target,
530 Code* code = PropertyICCompiler::FindPreMonomorphic(isolate, Code::LOAD_IC,
532 SetTargetAtAddress(address, code, constant_pool);
536 void StoreIC::Clear(Isolate* isolate, Address address, Code* target,
539 Code* code = PropertyICCompiler::FindPreMonomorphic(isolate, Code::STORE_IC,
541 SetTargetAtAddress(address, code, constant_pool);
545 void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target,
555 void CompareIC::Clear(Isolate* isolate, Address address, Code* target,
568 Handle<Code> KeyedLoadIC::generic_stub(Isolate* isolate) {
596 if (kind() == Code::KEYED_LOAD_IC && name->AsArrayIndex(&index)) {
649 bool IC::UpdatePolymorphicIC(Handle<Name> name, Handle<Code> code) {
650 if (!code->is_handler()) return false;
689 Handle<Code> ic;
691 ic = PropertyICCompiler::ComputeMonomorphic(kind(), name, type, code,
695 handlers.Set(handler_to_overwrite, code);
701 handlers.Add(code);
753 void IC::UpdateMonomorphicIC(Handle<Code> handler, Handle<Name> name) {
755 Handle<Code> ic = PropertyICCompiler::ComputeMonomorphic(
787 void IC::PatchCache(Handle<Name> name, Handle<Code> code) {
791 UpdateMonomorphicIC(code, name);
797 if (UpdatePolymorphicIC(name, code)) break;
803 UpdateMegamorphicCache(*receiver_type(), *name, *code);
815 Handle<Code> LoadIC::initialize_stub(Isolate* isolate,
821 Handle<Code> LoadIC::megamorphic_stub() {
822 if (kind() == Code::LOAD_IC) {
826 DCHECK_EQ(Code::KEYED_LOAD_IC, kind());
832 Handle<Code> LoadIC::pre_monomorphic_stub(Isolate* isolate,
838 Handle<Code> KeyedLoadIC::pre_monomorphic_stub(Isolate* isolate) {
843 Handle<Code> LoadIC::pre_monomorphic_stub() const {
844 if (kind() == Code::LOAD_IC) {
847 DCHECK_EQ(Code::KEYED_LOAD_IC, kind());
853 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) {
868 Handle<Code> code;
871 code = slow_stub();
873 if (kind() == Code::LOAD_IC) {
874 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(),
877 if (code.is_null()) code = slow_stub();
879 code = slow_stub();
882 code = ComputeHandler(lookup);
885 PatchCache(lookup->name(), code);
890 void IC::UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {
891 if (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC) return;
893 isolate()->stub_cache()->Set(name, map, code);
897 Handle<Code> IC::ComputeHandler(LookupIterator* lookup, Handle<Object> value) {
904 Handle<Code> code = PropertyHandlerCompiler::Find(
906 lookup->is_dictionary_holder() ? Code::NORMAL : Code::FAST);
909 if (!code.is_null()) {
911 !maybe_handler_.ToHandleChecked().is_identical_to(code)) {
912 return code;
920 Code* megamorphic_cached_code =
921 isolate()->stub_cache()->Get(*lookup->name(), map, code->flags());
922 if (megamorphic_cached_code != *code) return code;
924 return code;
929 code = CompileHandler(lookup, value, flag);
930 DCHECK(code->is_handler());
932 // TODO(mvstanton): we'd only like to cache code on the map when it's custom
933 // code compiled for this map, otherwise it's already cached in the global
934 // code
935 // cache. We are also guarding against installing code with flags that don't
938 if (code->type() != Code::NORMAL &&
939 Code::ExtractCacheHolderFromFlags(code->flags()) == flag) {
940 Map::UpdateCodeCache(stub_holder_map, lookup->name(), code);
943 return code;
947 Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
963 // Use specialized code for getting prototype of functions.
970 Handle<Code> stub;
1048 if (kind() != Code::LOAD_IC) break;
1053 Handle<Code> code = compiler.CompileLoadGlobal(
1059 Map::UpdateCodeCache(stub_holder_map, lookup->name(), code);
1060 return code;
1124 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) {
1182 Handle<Code> stub = generic_stub();
1204 Code* generic = *generic_stub();
1338 Handle<Code> CallIC::initialize_stub(Isolate* isolate, int argc,
1341 Handle<Code> code = stub.GetCode();
1342 return code;
1346 Handle<Code> StoreIC::initialize_stub(Isolate* isolate,
1349 Handle<Code> ic =
1355 Handle<Code> StoreIC::megamorphic_stub() {
1356 if (kind() == Code::STORE_IC) {
1360 DCHECK(kind() == Code::KEYED_STORE_IC);
1370 Handle<Code> StoreIC::generic_stub() const {
1371 if (kind() == Code::STORE_IC) {
1375 DCHECK(kind() == Code::KEYED_STORE_IC);
1385 Handle<Code> StoreIC::slow_stub() const {
1386 if (kind() == Code::STORE_IC) {
1389 DCHECK(kind() == Code::KEYED_STORE_IC);
1395 Handle<Code> StoreIC::pre_monomorphic_stub(Isolate* isolate,
1416 Handle<Code> code = use_ic ? ComputeHandler(lookup, value) : slow_stub();
1418 PatchCache(lookup->name(), code);
1423 Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
1504 Handle<Code> code = stub.GetCodeCopyFromTemplate(
1507 HeapObject::UpdateMapCodeCache(receiver, lookup->name(), code);
1508 return code;
1547 Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
1552 if (target()->type() != Code::NORMAL) {
1802 Handle<Code> stub = generic_stub();
1876 Code* generic = *generic_stub();
1938 Handle<Code> code = stub.GetCode();
1939 set_target(*code);
1970 // It might be an allocation site because if we re-compile the full code
2240 Handle<Code> target;
2274 // Patch the inlined smi code as necessary.
2317 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) {
2321 Code* code = NULL;
2322 CHECK(stub.FindCodeInCache(&code));
2323 return code;
2327 Handle<Code> CompareIC::GetUninitialized(Isolate* isolate, Token::Value op) {
2335 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
2350 Handle<Code> new_target = stub.GetCode();
2366 // Activate inlined smi code.
2375 // Used from CompareICStub::GenerateMiss in code-stubs-<arch>.cc.
2385 void CompareNilIC::Clear(Address address, Code* target,
2394 Code* code = NULL;
2395 CHECK(stub.FindCodeInCache(&code));
2397 SetTargetAtAddress(address, code, constant_pool);
2424 Handle<Code> code;
2429 code = PropertyICCompiler::ComputeCompareNil(monomorphic_map, &stub);
2431 code = stub.GetCode();
2433 set_target(*code);
2498 Handle<Code> code = stub.GetCode();
2499 set_target(*code);