Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: src/stub-cache.cc

Issue 6770011: Cleanup usage of HEAP and FACTORY in the cache stub compiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor reformatting. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 } 58 }
59 59
60 60
61 Code* StubCache::Set(String* name, Map* map, Code* code) { 61 Code* StubCache::Set(String* name, Map* map, Code* code) {
62 // Get the flags from the code. 62 // Get the flags from the code.
63 Code::Flags flags = Code::RemoveTypeFromFlags(code->flags()); 63 Code::Flags flags = Code::RemoveTypeFromFlags(code->flags());
64 64
65 // Validate that the name does not move on scavenge, and that we 65 // Validate that the name does not move on scavenge, and that we
66 // can use identity checks instead of string equality checks. 66 // can use identity checks instead of string equality checks.
67 ASSERT(!isolate_->heap()->InNewSpace(name)); 67 ASSERT(!heap()->InNewSpace(name));
68 ASSERT(name->IsSymbol()); 68 ASSERT(name->IsSymbol());
69 69
70 // The state bits are not important to the hash function because 70 // The state bits are not important to the hash function because
71 // the stub cache only contains monomorphic stubs. Make sure that 71 // the stub cache only contains monomorphic stubs. Make sure that
72 // the bits are the least significant so they will be the ones 72 // the bits are the least significant so they will be the ones
73 // masked out. 73 // masked out.
74 ASSERT(Code::ExtractICStateFromFlags(flags) == MONOMORPHIC); 74 ASSERT(Code::ExtractICStateFromFlags(flags) == MONOMORPHIC);
75 ASSERT(Code::kFlagsICStateShift == 0); 75 ASSERT(Code::kFlagsICStateShift == 0);
76 76
77 // Make sure that the code type is not included in the hash. 77 // Make sure that the code type is not included in the hash.
(...skipping 23 matching lines...) Expand all
101 101
102 MaybeObject* StubCache::ComputeLoadNonexistent(String* name, 102 MaybeObject* StubCache::ComputeLoadNonexistent(String* name,
103 JSObject* receiver) { 103 JSObject* receiver) {
104 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties()); 104 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties());
105 // If no global objects are present in the prototype chain, the load 105 // If no global objects are present in the prototype chain, the load
106 // nonexistent IC stub can be shared for all names for a given map 106 // nonexistent IC stub can be shared for all names for a given map
107 // and we use the empty string for the map cache in that case. If 107 // and we use the empty string for the map cache in that case. If
108 // there are global objects involved, we need to check global 108 // there are global objects involved, we need to check global
109 // property cells in the stub and therefore the stub will be 109 // property cells in the stub and therefore the stub will be
110 // specific to the name. 110 // specific to the name.
111 String* cache_name = isolate_->heap()->empty_string(); 111 String* cache_name = heap()->empty_string();
112 if (receiver->IsGlobalObject()) cache_name = name; 112 if (receiver->IsGlobalObject()) cache_name = name;
113 JSObject* last = receiver; 113 JSObject* last = receiver;
114 while (last->GetPrototype() != isolate_->heap()->null_value()) { 114 while (last->GetPrototype() != heap()->null_value()) {
115 last = JSObject::cast(last->GetPrototype()); 115 last = JSObject::cast(last->GetPrototype());
116 if (last->IsGlobalObject()) cache_name = name; 116 if (last->IsGlobalObject()) cache_name = name;
117 } 117 }
118 // Compile the stub that is either shared for all names or 118 // Compile the stub that is either shared for all names or
119 // name specific if there are global objects involved. 119 // name specific if there are global objects involved.
120 Code::Flags flags = 120 Code::Flags flags =
121 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT); 121 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT);
122 Object* code = receiver->map()->FindInCodeCache(cache_name, flags); 122 Object* code = receiver->map()->FindInCodeCache(cache_name, flags);
123 if (code->IsUndefined()) { 123 if (code->IsUndefined()) {
124 LoadStubCompiler compiler; 124 LoadStubCompiler compiler;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 459
460 MaybeObject* StubCache::ComputeKeyedLoadSpecialized(JSObject* receiver) { 460 MaybeObject* StubCache::ComputeKeyedLoadSpecialized(JSObject* receiver) {
461 // Using NORMAL as the PropertyType for array element loads is a misuse. The 461 // Using NORMAL as the PropertyType for array element loads is a misuse. The
462 // generated stub always accesses fast elements, not slow-mode fields, but 462 // generated stub always accesses fast elements, not slow-mode fields, but
463 // some property type is required for the stub lookup. Note that overloading 463 // some property type is required for the stub lookup. Note that overloading
464 // the NORMAL PropertyType is only safe as long as no stubs are generated for 464 // the NORMAL PropertyType is only safe as long as no stubs are generated for
465 // other keyed field loads. This is guaranteed to be the case since all field 465 // other keyed field loads. This is guaranteed to be the case since all field
466 // keyed loads that are not array elements go through a generic builtin stub. 466 // keyed loads that are not array elements go through a generic builtin stub.
467 Code::Flags flags = 467 Code::Flags flags =
468 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, NORMAL); 468 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, NORMAL);
469 String* name = isolate_->heap()->KeyedLoadSpecialized_symbol(); 469 String* name = heap()->KeyedLoadSpecialized_symbol();
470 Object* code = receiver->map()->FindInCodeCache(name, flags); 470 Object* code = receiver->map()->FindInCodeCache(name, flags);
471 if (code->IsUndefined()) { 471 if (code->IsUndefined()) {
472 KeyedLoadStubCompiler compiler; 472 KeyedLoadStubCompiler compiler;
473 { MaybeObject* maybe_code = compiler.CompileLoadSpecialized(receiver); 473 { MaybeObject* maybe_code = compiler.CompileLoadSpecialized(receiver);
474 if (!maybe_code->ToObject(&code)) return maybe_code; 474 if (!maybe_code->ToObject(&code)) return maybe_code;
475 } 475 }
476 PROFILE(isolate_, 476 PROFILE(isolate_,
477 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0)); 477 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0));
478 Object* result; 478 Object* result;
479 { MaybeObject* maybe_result = 479 { MaybeObject* maybe_result =
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 511 }
512 return code; 512 return code;
513 } 513 }
514 514
515 515
516 MaybeObject* StubCache::ComputeKeyedStoreSpecialized( 516 MaybeObject* StubCache::ComputeKeyedStoreSpecialized(
517 JSObject* receiver, 517 JSObject* receiver,
518 StrictModeFlag strict_mode) { 518 StrictModeFlag strict_mode) {
519 Code::Flags flags = 519 Code::Flags flags =
520 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode); 520 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode);
521 String* name = isolate_->heap()->KeyedStoreSpecialized_symbol(); 521 String* name = heap()->KeyedStoreSpecialized_symbol();
522 Object* code = receiver->map()->FindInCodeCache(name, flags); 522 Object* code = receiver->map()->FindInCodeCache(name, flags);
523 if (code->IsUndefined()) { 523 if (code->IsUndefined()) {
524 KeyedStoreStubCompiler compiler(strict_mode); 524 KeyedStoreStubCompiler compiler(strict_mode);
525 { MaybeObject* maybe_code = compiler.CompileStoreSpecialized(receiver); 525 { MaybeObject* maybe_code = compiler.CompileStoreSpecialized(receiver);
526 if (!maybe_code->ToObject(&code)) return maybe_code; 526 if (!maybe_code->ToObject(&code)) return maybe_code;
527 } 527 }
528 PROFILE(isolate_, 528 PROFILE(isolate_,
529 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); 529 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0));
530 Object* result; 530 Object* result;
531 { MaybeObject* maybe_result = 531 { MaybeObject* maybe_result =
(...skipping 24 matching lines...) Expand all
556 case JSObject::EXTERNAL_FLOAT_ELEMENTS: 556 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
557 return kExternalFloatArray; 557 return kExternalFloatArray;
558 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 558 case JSObject::EXTERNAL_PIXEL_ELEMENTS:
559 return kExternalPixelArray; 559 return kExternalPixelArray;
560 default: 560 default:
561 UNREACHABLE(); 561 UNREACHABLE();
562 return static_cast<ExternalArrayType>(0); 562 return static_cast<ExternalArrayType>(0);
563 } 563 }
564 } 564 }
565 565
566 String* ExternalArrayTypeToStubName(ExternalArrayType array_type, 566 String* ExternalArrayTypeToStubName(Heap* heap,
567 ExternalArrayType array_type,
567 bool is_store) { 568 bool is_store) {
568 if (is_store) { 569 if (is_store) {
569 switch (array_type) { 570 switch (array_type) {
570 case kExternalByteArray: 571 case kExternalByteArray:
571 return HEAP->KeyedStoreExternalByteArray_symbol(); 572 return heap->KeyedStoreExternalByteArray_symbol();
572 case kExternalUnsignedByteArray: 573 case kExternalUnsignedByteArray:
573 return HEAP->KeyedStoreExternalUnsignedByteArray_symbol(); 574 return heap->KeyedStoreExternalUnsignedByteArray_symbol();
574 case kExternalShortArray: 575 case kExternalShortArray:
575 return HEAP->KeyedStoreExternalShortArray_symbol(); 576 return heap->KeyedStoreExternalShortArray_symbol();
576 case kExternalUnsignedShortArray: 577 case kExternalUnsignedShortArray:
577 return HEAP->KeyedStoreExternalUnsignedShortArray_symbol(); 578 return heap->KeyedStoreExternalUnsignedShortArray_symbol();
578 case kExternalIntArray: 579 case kExternalIntArray:
579 return HEAP->KeyedStoreExternalIntArray_symbol(); 580 return heap->KeyedStoreExternalIntArray_symbol();
580 case kExternalUnsignedIntArray: 581 case kExternalUnsignedIntArray:
581 return HEAP->KeyedStoreExternalUnsignedIntArray_symbol(); 582 return heap->KeyedStoreExternalUnsignedIntArray_symbol();
582 case kExternalFloatArray: 583 case kExternalFloatArray:
583 return HEAP->KeyedStoreExternalFloatArray_symbol(); 584 return heap->KeyedStoreExternalFloatArray_symbol();
584 case kExternalPixelArray: 585 case kExternalPixelArray:
585 return HEAP->KeyedStoreExternalPixelArray_symbol(); 586 return heap->KeyedStoreExternalPixelArray_symbol();
586 default: 587 default:
587 UNREACHABLE(); 588 UNREACHABLE();
588 return NULL; 589 return NULL;
589 } 590 }
590 } else { 591 } else {
591 switch (array_type) { 592 switch (array_type) {
592 case kExternalByteArray: 593 case kExternalByteArray:
593 return HEAP->KeyedLoadExternalByteArray_symbol(); 594 return heap->KeyedLoadExternalByteArray_symbol();
594 case kExternalUnsignedByteArray: 595 case kExternalUnsignedByteArray:
595 return HEAP->KeyedLoadExternalUnsignedByteArray_symbol(); 596 return heap->KeyedLoadExternalUnsignedByteArray_symbol();
596 case kExternalShortArray: 597 case kExternalShortArray:
597 return HEAP->KeyedLoadExternalShortArray_symbol(); 598 return heap->KeyedLoadExternalShortArray_symbol();
598 case kExternalUnsignedShortArray: 599 case kExternalUnsignedShortArray:
599 return HEAP->KeyedLoadExternalUnsignedShortArray_symbol(); 600 return heap->KeyedLoadExternalUnsignedShortArray_symbol();
600 case kExternalIntArray: 601 case kExternalIntArray:
601 return HEAP->KeyedLoadExternalIntArray_symbol(); 602 return heap->KeyedLoadExternalIntArray_symbol();
602 case kExternalUnsignedIntArray: 603 case kExternalUnsignedIntArray:
603 return HEAP->KeyedLoadExternalUnsignedIntArray_symbol(); 604 return heap->KeyedLoadExternalUnsignedIntArray_symbol();
604 case kExternalFloatArray: 605 case kExternalFloatArray:
605 return HEAP->KeyedLoadExternalFloatArray_symbol(); 606 return heap->KeyedLoadExternalFloatArray_symbol();
606 case kExternalPixelArray: 607 case kExternalPixelArray:
607 return HEAP->KeyedLoadExternalPixelArray_symbol(); 608 return heap->KeyedLoadExternalPixelArray_symbol();
608 default: 609 default:
609 UNREACHABLE(); 610 UNREACHABLE();
610 return NULL; 611 return NULL;
611 } 612 }
612 } 613 }
613 } 614 }
614 615
615 } // anonymous namespace 616 } // anonymous namespace
616 617
617 618
618 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( 619 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
619 JSObject* receiver, 620 JSObject* receiver,
620 bool is_store, 621 bool is_store,
621 StrictModeFlag strict_mode) { 622 StrictModeFlag strict_mode) {
622 Code::Flags flags = 623 Code::Flags flags =
623 Code::ComputeMonomorphicFlags( 624 Code::ComputeMonomorphicFlags(
624 is_store ? Code::KEYED_EXTERNAL_ARRAY_STORE_IC : 625 is_store ? Code::KEYED_EXTERNAL_ARRAY_STORE_IC :
625 Code::KEYED_EXTERNAL_ARRAY_LOAD_IC, 626 Code::KEYED_EXTERNAL_ARRAY_LOAD_IC,
626 NORMAL, 627 NORMAL,
627 strict_mode); 628 strict_mode);
628 ExternalArrayType array_type = 629 ExternalArrayType array_type =
629 ElementsKindToExternalArrayType(receiver->GetElementsKind()); 630 ElementsKindToExternalArrayType(receiver->GetElementsKind());
630 String* name = ExternalArrayTypeToStubName(array_type, is_store); 631 String* name = ExternalArrayTypeToStubName(heap(), array_type, is_store);
631 Object* code = receiver->map()->FindInCodeCache(name, flags); 632 Object* code = receiver->map()->FindInCodeCache(name, flags);
632 if (code->IsUndefined()) { 633 if (code->IsUndefined()) {
633 ExternalArrayStubCompiler compiler; 634 ExternalArrayStubCompiler compiler;
634 { MaybeObject* maybe_code = 635 { MaybeObject* maybe_code =
635 is_store ? 636 is_store ?
636 compiler.CompileKeyedStoreStub(receiver, array_type, flags) : 637 compiler.CompileKeyedStoreStub(receiver, array_type, flags) :
637 compiler.CompileKeyedLoadStub(receiver, array_type, flags); 638 compiler.CompileKeyedLoadStub(receiver, array_type, flags);
638 if (!maybe_code->ToObject(&code)) return maybe_code; 639 if (!maybe_code->ToObject(&code)) return maybe_code;
639 } 640 }
640 Code::cast(code)->set_external_array_type(array_type); 641 Code::cast(code)->set_external_array_type(array_type);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; 753 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION;
753 Code::Flags flags = Code::ComputeMonomorphicFlags( 754 Code::Flags flags = Code::ComputeMonomorphicFlags(
754 Code::KEYED_STORE_IC, type, strict_mode); 755 Code::KEYED_STORE_IC, type, strict_mode);
755 Object* code = receiver->map()->FindInCodeCache(name, flags); 756 Object* code = receiver->map()->FindInCodeCache(name, flags);
756 if (code->IsUndefined()) { 757 if (code->IsUndefined()) {
757 KeyedStoreStubCompiler compiler(strict_mode); 758 KeyedStoreStubCompiler compiler(strict_mode);
758 { MaybeObject* maybe_code = 759 { MaybeObject* maybe_code =
759 compiler.CompileStoreField(receiver, field_index, transition, name); 760 compiler.CompileStoreField(receiver, field_index, transition, name);
760 if (!maybe_code->ToObject(&code)) return maybe_code; 761 if (!maybe_code->ToObject(&code)) return maybe_code;
761 } 762 }
762 PROFILE(isolate_, 763 PROFILE(isolate(),
763 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, 764 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG,
764 Code::cast(code), name)); 765 Code::cast(code), name));
765 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); 766 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code)));
766 Object* result; 767 Object* result;
767 { MaybeObject* maybe_result = 768 { MaybeObject* maybe_result =
768 receiver->UpdateMapCodeCache(name, Code::cast(code)); 769 receiver->UpdateMapCodeCache(name, Code::cast(code));
769 if (!maybe_result->ToObject(&result)) return maybe_result; 770 if (!maybe_result->ToObject(&result)) return maybe_result;
770 } 771 }
771 } 772 }
772 return code; 773 return code;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 argc); 911 argc);
911 Object* code = map_holder->map()->FindInCodeCache(name, flags); 912 Object* code = map_holder->map()->FindInCodeCache(name, flags);
912 if (code->IsUndefined()) { 913 if (code->IsUndefined()) {
913 CallStubCompiler compiler( 914 CallStubCompiler compiler(
914 argc, NOT_IN_LOOP, kind, Code::kNoExtraICState, cache_holder); 915 argc, NOT_IN_LOOP, kind, Code::kNoExtraICState, cache_holder);
915 { MaybeObject* maybe_code = 916 { MaybeObject* maybe_code =
916 compiler.CompileCallInterceptor(JSObject::cast(object), holder, name); 917 compiler.CompileCallInterceptor(JSObject::cast(object), holder, name);
917 if (!maybe_code->ToObject(&code)) return maybe_code; 918 if (!maybe_code->ToObject(&code)) return maybe_code;
918 } 919 }
919 ASSERT_EQ(flags, Code::cast(code)->flags()); 920 ASSERT_EQ(flags, Code::cast(code)->flags());
920 PROFILE(isolate_, 921 PROFILE(isolate(),
921 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), 922 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
922 Code::cast(code), name)); 923 Code::cast(code), name));
923 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); 924 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
924 Object* result; 925 Object* result;
925 { MaybeObject* maybe_result = 926 { MaybeObject* maybe_result =
926 map_holder->UpdateMapCodeCache(name, Code::cast(code)); 927 map_holder->UpdateMapCodeCache(name, Code::cast(code));
927 if (!maybe_result->ToObject(&result)) return maybe_result; 928 if (!maybe_result->ToObject(&result)) return maybe_result;
928 } 929 }
929 } 930 }
930 return code; 931 return code;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 // internal error which will make sure we do not update any 969 // internal error which will make sure we do not update any
969 // caches. 970 // caches.
970 if (!function->is_compiled()) return Failure::InternalError(); 971 if (!function->is_compiled()) return Failure::InternalError();
971 CallStubCompiler compiler( 972 CallStubCompiler compiler(
972 argc, in_loop, kind, Code::kNoExtraICState, cache_holder); 973 argc, in_loop, kind, Code::kNoExtraICState, cache_holder);
973 { MaybeObject* maybe_code = 974 { MaybeObject* maybe_code =
974 compiler.CompileCallGlobal(receiver, holder, cell, function, name); 975 compiler.CompileCallGlobal(receiver, holder, cell, function, name);
975 if (!maybe_code->ToObject(&code)) return maybe_code; 976 if (!maybe_code->ToObject(&code)) return maybe_code;
976 } 977 }
977 ASSERT_EQ(flags, Code::cast(code)->flags()); 978 ASSERT_EQ(flags, Code::cast(code)->flags());
978 PROFILE(isolate_, 979 PROFILE(isolate(),
979 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), 980 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
980 Code::cast(code), name)); 981 Code::cast(code), name));
981 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); 982 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
982 Object* result; 983 Object* result;
983 { MaybeObject* maybe_result = 984 { MaybeObject* maybe_result =
984 map_holder->UpdateMapCodeCache(name, Code::cast(code)); 985 map_holder->UpdateMapCodeCache(name, Code::cast(code));
985 if (!maybe_result->ToObject(&result)) return maybe_result; 986 if (!maybe_result->ToObject(&result)) return maybe_result;
986 } 987 }
987 } 988 }
988 return code; 989 return code;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1040
1040 Code* StubCache::FindCallInitialize(int argc, 1041 Code* StubCache::FindCallInitialize(int argc,
1041 InLoopFlag in_loop, 1042 InLoopFlag in_loop,
1042 Code::Kind kind) { 1043 Code::Kind kind) {
1043 Code::Flags flags = Code::ComputeFlags(kind, 1044 Code::Flags flags = Code::ComputeFlags(kind,
1044 in_loop, 1045 in_loop,
1045 UNINITIALIZED, 1046 UNINITIALIZED,
1046 Code::kNoExtraICState, 1047 Code::kNoExtraICState,
1047 NORMAL, 1048 NORMAL,
1048 argc); 1049 argc);
1049 Object* result = ProbeCache(isolate_, flags)->ToObjectUnchecked(); 1050 Object* result = ProbeCache(isolate(), flags)->ToObjectUnchecked();
1050 ASSERT(result != isolate_->heap()->undefined_value()); 1051 ASSERT(result != heap()->undefined_value());
1051 // This might be called during the marking phase of the collector 1052 // This might be called during the marking phase of the collector
1052 // hence the unchecked cast. 1053 // hence the unchecked cast.
1053 return reinterpret_cast<Code*>(result); 1054 return reinterpret_cast<Code*>(result);
1054 } 1055 }
1055 1056
1056 1057
1057 MaybeObject* StubCache::ComputeCallInitialize(int argc, 1058 MaybeObject* StubCache::ComputeCallInitialize(int argc,
1058 InLoopFlag in_loop, 1059 InLoopFlag in_loop,
1059 Code::Kind kind) { 1060 Code::Kind kind) {
1060 Code::Flags flags = Code::ComputeFlags(kind, 1061 Code::Flags flags = Code::ComputeFlags(kind,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 } 1213 }
1213 if (!probe->IsUndefined()) return probe; 1214 if (!probe->IsUndefined()) return probe;
1214 StubCompiler compiler; 1215 StubCompiler compiler;
1215 return FillCache(isolate_, compiler.CompileCallDebugPrepareStepIn(flags)); 1216 return FillCache(isolate_, compiler.CompileCallDebugPrepareStepIn(flags));
1216 } 1217 }
1217 #endif 1218 #endif
1218 1219
1219 1220
1220 void StubCache::Clear() { 1221 void StubCache::Clear() {
1221 for (int i = 0; i < kPrimaryTableSize; i++) { 1222 for (int i = 0; i < kPrimaryTableSize; i++) {
1222 primary_[i].key = isolate_->heap()->empty_string(); 1223 primary_[i].key = heap()->empty_string();
1223 primary_[i].value = isolate_->builtins()->builtin( 1224 primary_[i].value = isolate_->builtins()->builtin(
1224 Builtins::kIllegal); 1225 Builtins::kIllegal);
1225 } 1226 }
1226 for (int j = 0; j < kSecondaryTableSize; j++) { 1227 for (int j = 0; j < kSecondaryTableSize; j++) {
1227 secondary_[j].key = isolate_->heap()->empty_string(); 1228 secondary_[j].key = heap()->empty_string();
1228 secondary_[j].value = isolate_->builtins()->builtin( 1229 secondary_[j].value = isolate_->builtins()->builtin(
1229 Builtins::kIllegal); 1230 Builtins::kIllegal);
1230 } 1231 }
1231 } 1232 }
1232 1233
1233 1234
1234 void StubCache::CollectMatchingMaps(ZoneMapList* types, 1235 void StubCache::CollectMatchingMaps(ZoneMapList* types,
1235 String* name, 1236 String* name,
1236 Code::Flags flags) { 1237 Code::Flags flags) {
1237 for (int i = 0; i < kPrimaryTableSize; i++) { 1238 for (int i = 0; i < kPrimaryTableSize; i++) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 #undef CALL_LOGGER_TAG 1662 #undef CALL_LOGGER_TAG
1662 1663
1663 MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags, 1664 MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags,
1664 const char* name) { 1665 const char* name) {
1665 // Check for allocation failures during stub compilation. 1666 // Check for allocation failures during stub compilation.
1666 if (failure_->IsFailure()) return failure_; 1667 if (failure_->IsFailure()) return failure_;
1667 1668
1668 // Create code object in the heap. 1669 // Create code object in the heap.
1669 CodeDesc desc; 1670 CodeDesc desc;
1670 masm_.GetCode(&desc); 1671 masm_.GetCode(&desc);
1671 MaybeObject* result = HEAP->CreateCode(desc, flags, masm_.CodeObject()); 1672 MaybeObject* result = heap()->CreateCode(desc, flags, masm_.CodeObject());
1672 #ifdef ENABLE_DISASSEMBLER 1673 #ifdef ENABLE_DISASSEMBLER
1673 if (FLAG_print_code_stubs && !result->IsFailure()) { 1674 if (FLAG_print_code_stubs && !result->IsFailure()) {
1674 Code::cast(result->ToObjectUnchecked())->Disassemble(name); 1675 Code::cast(result->ToObjectUnchecked())->Disassemble(name);
1675 } 1676 }
1676 #endif 1677 #endif
1677 return result; 1678 return result;
1678 } 1679 }
1679 1680
1680 1681
1681 MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags, String* name) { 1682 MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags, String* name) {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 } 1938 }
1938 Code* code = Code::cast(result); 1939 Code* code = Code::cast(result);
1939 USE(code); 1940 USE(code);
1940 PROFILE(isolate(), 1941 PROFILE(isolate(),
1941 CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); 1942 CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub"));
1942 return result; 1943 return result;
1943 } 1944 }
1944 1945
1945 1946
1946 } } // namespace v8::internal 1947 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698